Refactor legacy JS (#33115)
Some checks are pending
release-nightly / nightly-binary (push) Waiting to run
release-nightly / nightly-docker-rootful (push) Waiting to run
release-nightly / nightly-docker-rootless (push) Waiting to run
cron-translations / crowdin-pull (push) Has been skipped

This commit is contained in:
wxiaoguang
2025-01-06 17:38:42 +08:00
committed by GitHub
parent 40765b5d45
commit ef736b7e27
5 changed files with 31 additions and 29 deletions

View File

@ -1,6 +1,5 @@
import $ from 'jquery';
import {GET} from '../modules/fetch.ts';
import {toggleElem, type DOMEvent} from '../utils/dom.ts';
import {toggleElem, type DOMEvent, createElementFromHTML} from '../utils/dom.ts';
import {logoutFromWorker} from '../modules/worker.ts';
const {appSubUrl, notificationSettings, assetVersionEncoded} = window.config;
@ -158,7 +157,8 @@ async function updateNotificationTable() {
}
const data = await response.text();
if ($(data).data('sequence-number') === notificationSequenceNumber) {
const el = createElementFromHTML(data);
if (parseInt(el.getAttribute('data-sequence-number')) === notificationSequenceNumber) {
notificationDiv.outerHTML = data;
initNotificationsTable();
}