mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
notifications: Fix desktop notifications for message not grouping.
Earlier, message notifications for same key would not get grouped
together because of the old notification_object close event listener
firing up when not supposed to.
This commit fixes this behaviour by checking the notification object
instance is the same as the currently displayed notification object
from notice memory when closing it.
Co-authored-by: prakhar1144 <prakhar@zulip.com>
(cherry picked from commit 6af4e82c49)
This commit is contained in:
committed by
Tim Abbott
parent
cd682f3dee
commit
6052630cae
@@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user