diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2019-05-07 07:43:52 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2019-05-07 07:43:52 +0000 |
commit | 2f8154a4e57334292336bc726d215debe38caa8a (patch) | |
tree | ac3a69c128f7e493d6179cd7f9facce36ce886c3 /app/assets/javascripts/main.js | |
parent | bd73925b858cbb7229b3d335da0e5d0023f57caf (diff) | |
download | gitlab-ce-2f8154a4e57334292336bc726d215debe38caa8a.tar.gz |
Only renders Next badge for gitlab.com
Diffstat (limited to 'app/assets/javascripts/main.js')
-rw-r--r-- | app/assets/javascripts/main.js | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js index a2ca4b07a66..b503c746801 100644 --- a/app/assets/javascripts/main.js +++ b/app/assets/javascripts/main.js @@ -136,10 +136,22 @@ function deferredInitialisation() { loadAwardsHandler(); - // Toggle Canary Badge + /** + * Toggle Canary Badge + * + * For GitLab.com only, when the user is using canary + * we render a Next badge and hide the option to switch + * to canay + */ if (Cookies.get('gitlab_canary') && Cookies.get('gitlab_canary') === 'true') { - document.querySelector('.js-canary-badge').classList.remove('hidden'); - document.querySelector('.js-canary-link').classList.add('hidden'); + const canaryBadge = document.querySelector('.js-canary-badge'); + const canaryLink = document.querySelector('.js-canary-link'); + if (canaryBadge) { + canaryBadge.classList.remove('hidden'); + } + if (canaryLink) { + canaryLink.classList.add('hidden'); + } } } |