Skip to content

Commit d1e53bf

Browse files
author
Gusted
authored
Update notification count for non-mobile version (#20544)
- Since #20108 we have two version of the notification bell, one for mobile the other for non-mobile. However the code only accounts for one notification count and thus was only updating the non-mobile one. - This code fixes that by applying the code for all `.notification_count`s. - Frontport will be in #20543
1 parent fc7b5af commit d1e53bf

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

web_src/js/features/notification.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,12 @@ async function receiveUpdateCount(event) {
2828
try {
2929
const data = JSON.parse(event.data);
3030

31-
const notificationCount = document.querySelector('.notification_count');
32-
if (data.Count > 0) {
33-
notificationCount.classList.remove('hidden');
34-
} else {
35-
notificationCount.classList.add('hidden');
31+
const notificationCounts = document.querySelectorAll('.notification_count');
32+
for (const count of notificationCounts) {
33+
count.classList.toggle('hidden', data.Count === 0);
34+
count.textContent = `${data.Count}`;
3635
}
3736

38-
notificationCount.textContent = `${data.Count}`;
3937
await updateNotificationTable();
4038
} catch (error) {
4139
console.error(error, event);

0 commit comments

Comments
 (0)