logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe
commit: d5348c13ff542ae77c3c87e381dc54f5e7619acc
parent: fef0981bc400199c4466581f9bd16724d993782f
Author: HJ <spam@hjkos.com>
Date:   Mon, 25 Feb 2019 20:08:45 +0000

Merge branch 'issue-380-noification-unread' into 'develop'

#380: fix false alarm for unread notifications

Closes #380

See merge request pleroma/pleroma-fe!614

Diffstat:

Msrc/modules/statuses.js2++
Msrc/services/notifications_fetcher/notifications_fetcher.service.js12+++++++++++-
2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/modules/statuses.js b/src/modules/statuses.js @@ -303,6 +303,8 @@ const addNewNotifications = (state, { dispatch, notifications, older, visibleNot setTimeout(notification.close.bind(notification), 5000) } } + } else if (notification.seen) { + state.notifications.idStore[notification.id].seen = true } }) } diff --git 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'