diff options
| author | dave <starpumadev@gmail.com> | 2019-02-25 12:12:49 -0500 |
|---|---|---|
| committer | dave <starpumadev@gmail.com> | 2019-02-25 12:12:49 -0500 |
| commit | 4e8b696797d5c4010abbe12584b8d70badb76a4c (patch) | |
| tree | 39466fbbe9639297e19429ab1553c1242b4af456 /src/services/notifications_fetcher | |
| parent | 1dd7120e1630531f46f9dd101b877c614a0475e5 (diff) | |
#380: fix false alarm for unread notifications
Diffstat (limited to 'src/services/notifications_fetcher')
| -rw-r--r-- | src/services/notifications_fetcher/notifications_fetcher.service.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/services/notifications_fetcher/notifications_fetcher.service.js b/src/services/notifications_fetcher/notifications_fetcher.service.js index b69ec643..3ecdae6a 100644 --- a/src/services/notifications_fetcher/notifications_fetcher.service.js +++ b/src/services/notifications_fetcher/notifications_fetcher.service.js @@ -16,7 +16,17 @@ const fetchAndUpdate = ({store, credentials, older = false}) => { args['until'] = timelineData.minId } } else { - args['since'] = timelineData.maxId + // load unread notifications repeadedly to provide consistency between browser tabs + const notifications = timelineData.data + const unread = notifications.filter(n => !n.seen).map(n => n.id) + if (!unread.length) { + args['since'] = timelineData.maxId + } else { + args['since'] = Math.min(...unread) - 1 + if (timelineData.maxId !== Math.max(...unread)) { + args['until'] = Math.max(...unread, args['since'] + 20) + } + } } args['timeline'] = 'notifications' |
