Forbid HTML injection using jQuery (#29843)
See https://github.com/wikimedia/eslint-plugin-no-jquery/blob/master/docs/rules/no-append-html.md Tested the following components and they work as before: - notification table - issue author dropdown - comment edit box attachments div Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: Giteabot <teabot@gitea.io> (cherry picked from commit f9b4efd42c17d7f75b689142b17575a478fe903c)
This commit is contained in:
parent
9ea9b850da
commit
c1b6182625
5 changed files with 12 additions and 9 deletions
|
@ -143,8 +143,8 @@ async function updateNotificationCountWithCallback(callback, timeout, lastCount)
|
|||
}
|
||||
|
||||
async function updateNotificationTable() {
|
||||
const $notificationDiv = $('#notification_div');
|
||||
if ($notificationDiv.length > 0) {
|
||||
const notificationDiv = document.getElementById('notification_div');
|
||||
if (notificationDiv) {
|
||||
try {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
params.set('div-only', true);
|
||||
|
@ -158,7 +158,7 @@ async function updateNotificationTable() {
|
|||
|
||||
const data = await response.text();
|
||||
if ($(data).data('sequence-number') === notificationSequenceNumber) {
|
||||
$notificationDiv.replaceWith(data);
|
||||
notificationDiv.outerHTML = data;
|
||||
initNotificationsTable();
|
||||
}
|
||||
} catch (error) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue