aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShpuld Shpuldson <shpuld@shpposter.club>2020-01-14 11:13:59 +0200
committerShpuld Shpuldson <shpuld@shpposter.club>2020-01-14 11:13:59 +0200
commit910b82e231fd3a6fe2e53990d87972066fe1a23c (patch)
tree680971b99419fd3ce0a95b49b19bd22d7168fbc4
parent7257189ea796d51117285814d32ed6138fdb3458 (diff)
Use last seen notif instead of first unseen notif for sinceId
-rw-r--r--src/services/notifications_fetcher/notifications_fetcher.service.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/services/notifications_fetcher/notifications_fetcher.service.js b/src/services/notifications_fetcher/notifications_fetcher.service.js
index 47008026..64499a1b 100644
--- a/src/services/notifications_fetcher/notifications_fetcher.service.js
+++ b/src/services/notifications_fetcher/notifications_fetcher.service.js
@@ -2,7 +2,6 @@ import apiService from '../api/api.service.js'
const update = ({ store, notifications, older }) => {
store.dispatch('setNotificationsError', { value: false })
-
store.dispatch('addNewNotifications', { notifications, older })
}
@@ -30,9 +29,9 @@ const fetchAndUpdate = ({ store, credentials, older = false }) => {
// load unread notifications repeatedly 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'] = Math.min(...unread)
+ const readNotifsIds = notifications.filter(n => n.seen).map(n => n.id)
+ if (readNotifsIds.length) {
+ args['since'] = Math.max(...readNotifsIds)
fetchNotifications({ store, args, older })
}