diff --git a/config/plugins/webhooks/news/config.yml b/config/plugins/webhooks/news/config.yml new file mode 100644 index 00000000000..9c35b671c8c --- /dev/null +++ b/config/plugins/webhooks/news/config.yml @@ -0,0 +1,7 @@ +id: news +type: + - masthead +activate: true + +icon: fa-bell +tooltip: See the Galaxy Release Notes diff --git a/config/plugins/webhooks/news/script.js b/config/plugins/webhooks/news/script.js new file mode 100644 index 00000000000..a7d2fafe0d9 --- /dev/null +++ b/config/plugins/webhooks/news/script.js @@ -0,0 +1,112 @@ +function removeNewsOverlay() { + document.getElementById("news-container").style.visibility = "hidden"; +} + +function showNewsOverlay() { + document.getElementById("news-container").style.visibility = "visible"; + newsSeen(); +} + +function newsSeen() { + // When it's seen, remove fa, add far. + const newsIconSpan = document.querySelector("#news .fa-bell"); + newsIconSpan.classList.remove("fa"); + newsIconSpan.classList.add("far"); + window.localStorage.setItem("galaxy-news-seen-release", Galaxy.config.version_major); +} + +function newsUnseen() { + // When there is news, remove far, add fa for (default -- same as fas) solid style. + const newsIconSpan = document.querySelector("#news .fa-bell"); + newsIconSpan.classList.remove("far"); + newsIconSpan.classList.add("fa"); +} + +function addNewsIframe() { + var currentGalaxyVersion = Galaxy.config.version_major; + + // TODO/@hexylena: By 21.01 we will have a proper solution for this. For + // now we'll hardcode the version users 'see'. @hexylena will remove this + // code when she writes the user-facing release notes, and then will file + // an issue for how we'll fix this properly. + if(currentGalaxyVersion == "22.01") { + currentGalaxyVersion = "21.09"; + } else if(currentGalaxyVersion == "21.09") { + currentGalaxyVersion = "21.05"; + } + + const releaseNotes = `https://docs.galaxyproject.org/en/master/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) { + newsUnseen(); + } else { + newsSeen(); + } + + document.querySelector("body.full-content").insertAdjacentHTML( + "afterbegin", + ` +