mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-28 10:33:20 +00:00
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
This commit is contained in:
parent
fc7b5afd9b
commit
d1e53bfd7f
|
@ -28,14 +28,12 @@ async function receiveUpdateCount(event) {
|
||||||
try {
|
try {
|
||||||
const data = JSON.parse(event.data);
|
const data = JSON.parse(event.data);
|
||||||
|
|
||||||
const notificationCount = document.querySelector('.notification_count');
|
const notificationCounts = document.querySelectorAll('.notification_count');
|
||||||
if (data.Count > 0) {
|
for (const count of notificationCounts) {
|
||||||
notificationCount.classList.remove('hidden');
|
count.classList.toggle('hidden', data.Count === 0);
|
||||||
} else {
|
count.textContent = `${data.Count}`;
|
||||||
notificationCount.classList.add('hidden');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
notificationCount.textContent = `${data.Count}`;
|
|
||||||
await updateNotificationTable();
|
await updateNotificationTable();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error, event);
|
console.error(error, event);
|
||||||
|
|
Loading…
Reference in a new issue