Skip to content

Node.js based forum software built for the modern web

fix: mark chat notifications read when received in the open room (#14627)

palmoni5daa65da23559
diff --git a/public/src/modules/notifications.js b/public/src/modules/notifications.js
index 334a429dbd..b73d109e24 100644
--- a/public/src/modules/notifications.js
+++ b/public/src/modules/notifications.js
@@ -106,6 +106,11 @@ define('notifications', [
}
const { template } = ajaxify.data;
if (template.chats && String(ajaxify.data.roomId) === String(notifData.roomId)) {
+ // user is already looking at this room, mark the notification read
+ // instead of leaving it unread until the next room load
+ if (notifData.nid) {
+ markNotification(notifData.nid, true);
+ }
return;
}