Skip to content

Commit

Permalink
Update notification count for non-mobile version
Browse files Browse the repository at this point in the history
- Since go-gitea#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 go-gitea#20543
  • Loading branch information
Gusted committed Jul 29, 2022
1 parent 975a962 commit 878ae35
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions web_src/js/features/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 878ae35

Please sign in to comment.