From 7c6bee2aa52edbf42604df291a13466b4477f5ad Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Mon, 24 Jul 2023 09:42:40 -0400 Subject: [PATCH] Fix release notes webhook tag handling for RC. --- config/plugins/webhooks/news/script.js | 35 ++++++++++++++------------ 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/config/plugins/webhooks/news/script.js b/config/plugins/webhooks/news/script.js index a0d0f63a09d9..ca497aa52e87 100644 --- a/config/plugins/webhooks/news/script.js +++ b/config/plugins/webhooks/news/script.js @@ -6,11 +6,11 @@ } } - function newsSeen() { + function newsSeen(currentGalaxyVersion) { // When it's seen, remove fa, add far. const newsIconSpan = document.querySelector("#news .fa-bullhorn"); newsIconSpan.classList.remove("fa-fade"); - window.localStorage.setItem("galaxy-news-seen-release", Galaxy.config.version_major); + window.localStorage.setItem("galaxy-news-seen-release", currentGalaxyVersion); } function newsUnseen() { @@ -50,24 +50,27 @@ el.parentNode.replaceChild(clean, el); let currentGalaxyVersion = Galaxy.config.version_major; - - // If we're at the 23.1 release candidate, we want to show the 23.0 release notes still. - // This should be the last release using this hack -- new notification - // system will provide notes moving forward - - if (currentGalaxyVersion == "23.1" && Galaxy.config.version_minor.startsWith("rc")) { - currentGalaxyVersion = "23.0"; - } - - const releaseNotes = `https://docs.galaxyproject.org/en/latest/releases/${currentGalaxyVersion}_announce_user.html`; const lastSeenVersion = window.localStorage.getItem("galaxy-news-seen-release"); - // Check that they've seen the current version's release notes. - if (lastSeenVersion != currentGalaxyVersion) { + + // If we're at a deployed release candidate, just mark it seen and show + // the previous notes if someone clicks the link. RC notes won't exist. + if (Galaxy.config.version_minor.startsWith("rc")) { + // If we, for whatever reason, need to do this again just add + // another case here. It's not worth parsing and doing version + // math, and we should be able to drop preferring notifications + // framework moving forward in 23.2 + if (currentGalaxyVersion == "23.1") { + currentGalaxyVersion = "23.0"; + } + newsSeen(currentGalaxyVersion); + } else if (lastSeenVersion != currentGalaxyVersion) { newsUnseen(); } else { - newsSeen(); + newsSeen(currentGalaxyVersion); } + const releaseNotes = `https://docs.galaxyproject.org/en/latest/releases/${currentGalaxyVersion}_announce_user.html`; + clean.addEventListener("click", (e) => { e.preventDefault(); e.stopPropagation(); @@ -92,7 +95,7 @@ }); } document.getElementById("news-container").style.visibility = "visible"; - newsSeen(); + newsSeen(currentGalaxyVersion); }); });