Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

notifications: Fix desktop notifications for message not grouping.

Pratik Chanda6af4e82c49c6
diff --git a/web/src/message_notifications.ts b/web/src/message_notifications.ts
index f435f272a38..7e52b06da84 100644
--- a/web/src/message_notifications.ts
+++ b/web/src/message_notifications.ts
@@ -215,7 +215,12 @@ export function process_notification(notification: {
window.focus();
});
notification_object.addEventListener("close", () => {
- desktop_notifications.notice_memory.delete(key);
+ const current_notice_memory = desktop_notifications.notice_memory.get(key);
+ // This check helps avoid race between close event for current notification
+ // object and the previous notification_object close handler.
+ if (current_notice_memory?.obj === notification_object) {
+ desktop_notifications.notice_memory.delete(key);
+ }
});
}
}