Skip to content

Node.js based forum software built for the modern web

Fix: resync notification count when loading the notification list (#14631)

palmoni5f01b041f90af
diff --git a/public/src/modules/notifications.js b/public/src/modules/notifications.js
index b73d109e24..8b7e1b8d3c 100644
--- a/public/src/modules/notifications.js
+++ b/public/src/modules/notifications.js
@@ -38,6 +38,9 @@ define('notifications', [
}
callback = callback || function () {};
api.get('/notifications').then((data) => {
+ // resync the unread count in case a socket push was missed
+ // or a notification was rescinded server-side
+ Notifications.updateNotifCount(data.unread.length);
const notifs = data.unread.concat(data.read).sort(function (a, b) {
return parseInt(a.datetime, 10) > parseInt(b.datetime, 10) ? -1 : 1;
});