diff --git a/web_src/js/features/notification.js b/web_src/js/features/notification.js index d9f6e50202..2de640e674 100644 --- a/web_src/js/features/notification.js +++ b/web_src/js/features/notification.js @@ -1,5 +1,6 @@ import $ from 'jquery'; import {GET} from '../modules/fetch.js'; +import {toggleElem} from '../utils/dom.js'; const {appSubUrl, notificationSettings, assetVersionEncoded} = window.config; let notificationSequenceNumber = 0; @@ -177,14 +178,11 @@ async function updateNotificationCount() { const data = await response.json(); - const $notificationCount = $('.notification_count'); - if (data.new === 0) { - $notificationCount.addClass('tw-hidden'); - } else { - $notificationCount.removeClass('tw-hidden'); - } + toggleElem('.notification_count', data.new !== 0); - $notificationCount.text(`${data.new}`); + for (const el of document.getElementsByClassName('notification_count')) { + el.textContent = `${data.new}`; + } return `${data.new}`; } catch (error) {