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
This commit is contained in:
parent
a175922ccf
commit
45291f17a0
3 changed files with 25 additions and 17 deletions
|
@ -36,11 +36,12 @@ export async function fetchPage({
|
|||
moderationOpts: ModerationOpts | undefined
|
||||
threadMutes: string[]
|
||||
fetchAdditionalData: boolean
|
||||
}): Promise<FeedPage> {
|
||||
}): 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,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue