From: Marcel Werk Date: Mon, 15 Aug 2022 16:36:45 +0000 (+0200) Subject: Applied code suggestions X-Git-Tag: 6.0.0_Alpha_1~1034^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=756849d6e105f585285d6cb69453352ff50283c4;p=GitHub%2FWoltLab%2FWCF.git Applied code suggestions --- diff --git a/ts/WoltLabSuite/Core/Ui/User/ObjectWatch.ts b/ts/WoltLabSuite/Core/Ui/User/ObjectWatch.ts index 8304a6d4b4..84fe8f77cf 100644 --- a/ts/WoltLabSuite/Core/Ui/User/ObjectWatch.ts +++ b/ts/WoltLabSuite/Core/Ui/User/ObjectWatch.ts @@ -32,11 +32,13 @@ async function click(element: HTMLElement): Promise { if (dropdowns.has(objectID)) { dropdowns.get(objectID)!.forEach((element) => { - element.querySelectorAll(".userObjectWatchSelect").forEach((li) => { - li.classList.remove("active"); + element.querySelectorAll(".userObjectWatchSelect").forEach((li: HTMLElement) => { + if (parseInt(li.dataset.subscribe!, 10) === subscribe) { + li.classList.add("active"); + } else { + li.classList.remove("active"); + } }); - - element.querySelector(`.userObjectWatchSelect[data-subscribe="${subscribe}"]`)?.classList.add("active"); }); } diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/User/ObjectWatch.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/User/ObjectWatch.js index c9beb674ab..3392e50330 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/User/ObjectWatch.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/User/ObjectWatch.js @@ -31,11 +31,14 @@ define(["require", "exports", "tslib", "../../Ajax", "../Notification", "../../L .dispatch(); if (dropdowns.has(objectID)) { dropdowns.get(objectID).forEach((element) => { - var _a; element.querySelectorAll(".userObjectWatchSelect").forEach((li) => { - li.classList.remove("active"); + if (parseInt(li.dataset.subscribe, 10) === subscribe) { + li.classList.add("active"); + } + else { + li.classList.remove("active"); + } }); - (_a = element.querySelector(`.userObjectWatchSelect[data-subscribe="${subscribe}"]`)) === null || _a === void 0 ? void 0 : _a.classList.add("active"); }); } document