aboutsummaryrefslogtreecommitdiff
path: root/src/services/notifications_fetcher/notifications_fetcher.service.js
diff options
context:
space:
mode:
authorShpuld Shpludson <shp@cock.li>2019-03-07 15:11:11 +0000
committerShpuld Shpludson <shp@cock.li>2019-03-07 15:11:11 +0000
commit7e9c8c3d219aa3b787c5606efbb54a73c1738b07 (patch)
tree1847fa78707d800e28997bd8828327cf5c890838 /src/services/notifications_fetcher/notifications_fetcher.service.js
parent4800169f36e0a71c322b9707a797c3b1ad48bf58 (diff)
parentc44f0a9bde08c50598207494b121ae4bdf1f0fb1 (diff)
Merge branch 'develop' into 'master'
Update master See merge request pleroma/pleroma-fe!646
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'