From 45291f17a08acb8b62d0ff86f2ce40ad4fa9f1f6 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Tue, 30 Jan 2024 17:46:35 -0800 Subject: Fix notification mark-read behaviors (#2696) * Mark read on first notifs page fetch always; this is less optimal but it fixes a case where when the first full page's unreads are all filtered out * Use the pre-filter indexedAt for updateSeen --- src/state/queries/notifications/util.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/state/queries/notifications/util.ts') diff --git a/src/state/queries/notifications/util.ts b/src/state/queries/notifications/util.ts index e53a07258..1c85d2b6d 100644 --- a/src/state/queries/notifications/util.ts +++ b/src/state/queries/notifications/util.ts @@ -36,11 +36,12 @@ export async function fetchPage({ moderationOpts: ModerationOpts | undefined threadMutes: string[] fetchAdditionalData: boolean -}): Promise { +}): Promise<{page: FeedPage; indexedAt: string | undefined}> { const res = await getAgent().listNotifications({ limit, cursor, }) + const indexedAt = res.data.notifications[0]?.indexedAt // filter out notifs by mod rules const notifs = res.data.notifications.filter( @@ -75,9 +76,12 @@ export async function fetchPage({ } return { - cursor: res.data.cursor, - seenAt, - items: notifsGrouped, + page: { + cursor: res.data.cursor, + seenAt, + items: notifsGrouped, + }, + indexedAt, } } -- cgit 1.4.1