Skip to content

Commit

Permalink
Merge pull request #16446 from dannon/fix-release-note-seen-pin
Browse files Browse the repository at this point in the history
[23.1] Fix webhook release note seen pin
  • Loading branch information
dannon authored Jul 24, 2023
2 parents 0a73e1c + 7c6bee2 commit 232f946
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions config/plugins/webhooks/news/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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();
Expand All @@ -92,7 +95,7 @@
});
}
document.getElementById("news-container").style.visibility = "visible";
newsSeen();
newsSeen(currentGalaxyVersion);
});
});

Expand Down

0 comments on commit 232f946

Please sign in to comment.