diff options
author | Gusted <williamzijl7@hotmail.com> | 2022-07-30 04:28:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-30 10:28:48 +0800 |
commit | d1e53bfd7f6bf62baa53c6e7b3973396db074075 (patch) | |
tree | 929d2fce8a4115fea177d17a252c4ff51bb2b454 | |
parent | fc7b5afd9b23a2b194b498dc6f4802ee31339639 (diff) | |
download | gitea-d1e53bfd7f6bf62baa53c6e7b3973396db074075.tar.gz gitea-d1e53bfd7f6bf62baa53c6e7b3973396db074075.zip |
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
-rw-r--r-- | web_src/js/features/notification.js | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/web_src/js/features/notification.js b/web_src/js/features/notification.js index 36df196cac..d184db0ddd 100644 --- a/web_src/js/features/notification.js +++ b/web_src/js/features/notification.js @@ -28,14 +28,12 @@ async function receiveUpdateCount(event) { try { const data = JSON.parse(event.data); - const notificationCount = document.querySelector('.notification_count'); - if (data.Count > 0) { - notificationCount.classList.remove('hidden'); - } else { - notificationCount.classList.add('hidden'); + const notificationCounts = document.querySelectorAll('.notification_count'); + for (const count of notificationCounts) { + count.classList.toggle('hidden', data.Count === 0); + count.textContent = `${data.Count}`; } - notificationCount.textContent = `${data.Count}`; await updateNotificationTable(); } catch (error) { console.error(error, event); |