Skip to content
Snippets Groups Projects

Fix the notifications polling when all the latest notifications are unread

Merged Eugenij requested to merge eugenijm/pleroma-fe:fix-notification-polling into develop
1 unresolved thread
@@ -35,11 +35,8 @@ const fetchAndUpdate = ({ store, credentials, older = false }) => {
const notifications = timelineData.data
const readNotifsIds = notifications.filter(n => n.seen).map(n => n.id)
const numUnseenNotifs = notifications.length - readNotifsIds.length
if (numUnseenNotifs > 0) {
const latestNotifications = readNotifsIds.length === 0 ? notifications : readNotifsIds
if (latestNotifications.length > 0) {
args['since'] = Math.max(...latestNotifications)
}
if (numUnseenNotifs > 0 && readNotifsIds.length > 0) {
args['since'] = Math.max(...readNotifsIds)
fetchNotifications({ store, args, older })
}
return result
Loading