From 68e5e5ff1fbeb8c046b128d61cd0f2abcd060b33 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Tue, 12 Mar 2024 10:57:07 -0400 Subject: [PATCH] Drop release notes webhook -- with the notification system in place we will be utilizing that moving forward --- config/plugins/webhooks/news/config.yml | 7 -- config/plugins/webhooks/news/script.js | 111 ------------------------ config/plugins/webhooks/news/styles.css | 38 -------- 3 files changed, 156 deletions(-) delete mode 100644 config/plugins/webhooks/news/config.yml delete mode 100644 config/plugins/webhooks/news/script.js delete mode 100644 config/plugins/webhooks/news/styles.css diff --git a/config/plugins/webhooks/news/config.yml b/config/plugins/webhooks/news/config.yml deleted file mode 100644 index cf49026fef96..000000000000 --- a/config/plugins/webhooks/news/config.yml +++ /dev/null @@ -1,7 +0,0 @@ -id: news -type: - - masthead -activate: true - -icon: fa-bullhorn -tooltip: See the Galaxy Release Notes diff --git a/config/plugins/webhooks/news/script.js b/config/plugins/webhooks/news/script.js deleted file mode 100644 index d5b7928e8327..000000000000 --- a/config/plugins/webhooks/news/script.js +++ /dev/null @@ -1,111 +0,0 @@ -(function () { - function hideNewsOverlay() { - const container = document.getElementById("news-container"); - if (container) { - container.style.visibility = "hidden"; - } - } - - function newsSeen(currentGalaxyVersion) { - // When it's seen, remove the red indicator if it exists and store the current version. - const newsIndicator = document.getElementById("news-indicator"); - if (newsIndicator) { - newsIndicator.remove(); - } - window.localStorage.setItem("galaxy-news-seen-release", currentGalaxyVersion); - } - - function newsUnseen() { - // When there is news, add an red indicator to the icon. - const newsIconSpan = document.querySelector("#news .nav-link"); - newsIconSpan.insertAdjacentHTML("beforeend", ''); - } - - /* The masthead icon may not exist yet when this webhook executes; we need this to wait for that to happen. - * elementReady function from gist: - * https://gist.github.com/jwilson8767/db379026efcbd932f64382db4b02853e - */ - function elementReadyNews(selector) { - return new Promise((resolve, reject) => { - const el = document.querySelector(selector); - if (el) { - resolve(el); - } - new MutationObserver((mutationRecords, observer) => { - // Query for elements matching the specified selector - Array.from(document.querySelectorAll(selector)).forEach((element) => { - resolve(element); - //Once we have resolved we don't need the observer anymore. - observer.disconnect(); - }); - }).observe(document.documentElement, { - childList: true, - subtree: true, - }); - }); - } - - elementReadyNews("#news a").then((el) => { - // External stuff may also have attached a click handler here (vue-based masthead) - // replace with a clean copy of the node to remove all that cruft. - clean = el.cloneNode(true); - el.parentNode.replaceChild(clean, el); - - let currentGalaxyVersion = Galaxy.config.version_major; - const lastSeenVersion = window.localStorage.getItem("galaxy-news-seen-release"); - - // 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(currentGalaxyVersion); - } - - const releaseNotes = `https://docs.galaxyproject.org/en/latest/releases/${currentGalaxyVersion}_announce_user.html`; - - clean.addEventListener("click", (e) => { - e.preventDefault(); - e.stopPropagation(); - - // If element doesn't exist, add it. - if (document.getElementById("news-container") == null) { - document.querySelector("body.full-content").insertAdjacentHTML( - "afterbegin", - ` - ` - ); - // Clicking outside of GTN closes it - document.getElementById("news-screen").addEventListener("click", () => { - hideNewsOverlay(); - }); - } - document.getElementById("news-container").style.visibility = "visible"; - newsSeen(currentGalaxyVersion); - }); - }); - - // Remove the overlay on escape button click - document.addEventListener("keydown", (e) => { - // Check for escape button - "27" - if (e.which === 27 || e.keyCode === 27) { - hideNewsOverlay(); - } - }); -})(); diff --git a/config/plugins/webhooks/news/styles.css b/config/plugins/webhooks/news/styles.css deleted file mode 100644 index d343e02312c8..000000000000 --- a/config/plugins/webhooks/news/styles.css +++ /dev/null @@ -1,38 +0,0 @@ -#news-screen { - position: fixed; - z-index: 5100; - width: 100%; - height: 100%; -} - -#news-screen-overlay { - position: fixed; - top: 0; - left: 0; - background: rgba(224, 224, 224, 0.75); - z-index: 5000; - width: 100%; - height: 100%; - opacity: 2; -} - -#news-header { - position: fixed; - height: 100%; - width: 100%; - z-index: 5200; - display: flex; - justify-content: center; - flex-direction: column; - align-items: center; -} - -#news-indicator { - position: absolute; - top: 0.5rem; - right: 0.2rem; - width: 0.6rem; - height: 0.6rem; - border-radius: 50%; - background: #e31a1e; -}