aboutsummaryrefslogtreecommitdiff
path: root/src/services/notifications_fetcher/notifications_fetcher.service.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/services/notifications_fetcher/notifications_fetcher.service.js')
-rw-r--r--src/services/notifications_fetcher/notifications_fetcher.service.js12
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'