forked from AkkomaGang/akkoma-fe
#380: fix false alarm for unread notifications
This commit is contained in:
parent
1dd7120e16
commit
4e8b696797
2 changed files with 14 additions and 1 deletions
|
@ -303,6 +303,9 @@ const addNewNotifications = (state, { dispatch, notifications, older, visibleNot
|
|||
setTimeout(notification.close.bind(notification), 5000)
|
||||
}
|
||||
}
|
||||
} else if (notification.seen) {
|
||||
state.notifications.data.find(n => n.id === notification.id).seen = true
|
||||
state.notifications.idStore[notification.id].seen = true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -16,7 +16,17 @@ const fetchAndUpdate = ({store, credentials, older = false}) => {
|
|||
args['until'] = timelineData.minId
|
||||
}
|
||||
} else {
|
||||
// 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'
|
||||
|
|
Loading…
Reference in a new issue