From f85b8d1be9e4fdfe6b52f34a8b966de833062556 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Fri, 28 Jul 2023 08:44:13 -0400 Subject: [PATCH] Avoid optional chaining in non-transpiled webhook code. Use getElementById instead of queryselectorall for the single id fetch. --- config/plugins/webhooks/news/script.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/config/plugins/webhooks/news/script.js b/config/plugins/webhooks/news/script.js index 947b6088193..d5b7928e832 100644 --- a/config/plugins/webhooks/news/script.js +++ b/config/plugins/webhooks/news/script.js @@ -8,8 +8,10 @@ function newsSeen(currentGalaxyVersion) { // When it's seen, remove the red indicator if it exists and store the current version. - const newsIndicator = document.querySelector("#news-indicator"); - newsIndicator?.remove(); + const newsIndicator = document.getElementById("news-indicator"); + if (newsIndicator) { + newsIndicator.remove(); + } window.localStorage.setItem("galaxy-news-seen-release", currentGalaxyVersion); }