diff options
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'); + } } } |