diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-12 21:11:12 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-12 21:11:12 +0000 |
commit | beab869416d5720126a8cbe76f6c842a9b9d9300 (patch) | |
tree | 56426d4783e70252ebbdb5467f8246c497d1ee6e /app/assets/javascripts/whats_new/utils/notification.js | |
parent | da59ce8b217f67707b391d9fb3503dbdf8c4e511 (diff) | |
download | gitlab-ce-beab869416d5720126a8cbe76f6c842a9b9d9300.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/whats_new/utils/notification.js')
-rw-r--r-- | app/assets/javascripts/whats_new/utils/notification.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/app/assets/javascripts/whats_new/utils/notification.js b/app/assets/javascripts/whats_new/utils/notification.js index 52ca8058d1c..3d4326c4b3a 100644 --- a/app/assets/javascripts/whats_new/utils/notification.js +++ b/app/assets/javascripts/whats_new/utils/notification.js @@ -1,11 +1,18 @@ -export const getStorageKey = (appEl) => appEl.getAttribute('data-storage-key'); +export const STORAGE_KEY = 'display-whats-new-notification'; + +export const getVersionDigest = (appEl) => appEl.getAttribute('data-version-digest'); export const setNotification = (appEl) => { - const storageKey = getStorageKey(appEl); + const versionDigest = getVersionDigest(appEl); const notificationEl = document.querySelector('.header-help'); let notificationCountEl = notificationEl.querySelector('.js-whats-new-notification-count'); - if (JSON.parse(localStorage.getItem(storageKey)) === false) { + const legacyStorageKey = 'display-whats-new-notification-13.10'; + const localStoragePairs = [ + [legacyStorageKey, false], + [STORAGE_KEY, versionDigest], + ]; + if (localStoragePairs.some((pair) => localStorage.getItem(pair[0]) === pair[1].toString())) { notificationEl.classList.remove('with-notifications'); if (notificationCountEl) { notificationCountEl.parentElement.removeChild(notificationCountEl); |