Skip to content

Commit 56ac5f1

Browse files
yardenshohamwxiaoguangGiteaBot
authored
Remove jQuery class from the notification count (#30172)
- Switched from jQuery class functions to plain JavaScript `classList` - Tested the notification count and it works as before --------- Signed-off-by: Yarden Shoham <[email protected]> Co-authored-by: wxiaoguang <[email protected]> Co-authored-by: Giteabot <[email protected]>
1 parent 9119934 commit 56ac5f1

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

web_src/js/features/notification.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import $ from 'jquery';
22
import {GET} from '../modules/fetch.js';
3+
import {toggleElem} from '../utils/dom.js';
34

45
const {appSubUrl, notificationSettings, assetVersionEncoded} = window.config;
56
let notificationSequenceNumber = 0;
@@ -177,14 +178,11 @@ async function updateNotificationCount() {
177178

178179
const data = await response.json();
179180

180-
const $notificationCount = $('.notification_count');
181-
if (data.new === 0) {
182-
$notificationCount.addClass('tw-hidden');
183-
} else {
184-
$notificationCount.removeClass('tw-hidden');
185-
}
181+
toggleElem('.notification_count', data.new !== 0);
186182

187-
$notificationCount.text(`${data.new}`);
183+
for (const el of document.getElementsByClassName('notification_count')) {
184+
el.textContent = `${data.new}`;
185+
}
188186

189187
return `${data.new}`;
190188
} catch (error) {

0 commit comments

Comments
 (0)