diff options
| author | Henry Jameson <me@hjkos.com> | 2023-11-21 15:26:31 +0200 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2023-11-21 15:26:31 +0200 |
| commit | e36548579fb179d0431591529158a65f85e5b134 (patch) | |
| tree | 97de715d4614a9a64a281c7f5384409d4e4eff16 /src/services/notifications_fetcher | |
| parent | 37e3a23f2a25120e13aa4f1ff65e444060d24abb (diff) | |
fix notifications not catching up with "read" status as intended
Diffstat (limited to 'src/services/notifications_fetcher')
| -rw-r--r-- | src/services/notifications_fetcher/notifications_fetcher.service.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/services/notifications_fetcher/notifications_fetcher.service.js b/src/services/notifications_fetcher/notifications_fetcher.service.js index 3c280b74..21540845 100644 --- a/src/services/notifications_fetcher/notifications_fetcher.service.js +++ b/src/services/notifications_fetcher/notifications_fetcher.service.js @@ -49,9 +49,11 @@ const fetchAndUpdate = ({ store, credentials, older = false, since }) => { // The normal maxId-check does not tell if older notifications have changed const notifications = timelineData.data const readNotifsIds = notifications.filter(n => n.seen).map(n => n.id) - const numUnseenNotifs = notifications.length - readNotifsIds.length - if (numUnseenNotifs > 0 && readNotifsIds.length > 0) { - args.since = Math.max(...readNotifsIds) + const unreadNotifsIds = notifications.filter(n => !n.seen).map(n => n.id) + if (readNotifsIds.length > 0 && readNotifsIds.length > 0) { + const minId = Math.min(...unreadNotifsIds) // Oldest known unread notification + args.since = false // Don't use since_id since it sorta conflicts with min_id + args.minId = minId - 1 // go beyond fetchNotifications({ store, args, older }) } |
