Canary "next" badge flashes on page load

The next badge in the header indicates that you're using Gitlab's canary version.

Currently, its visibility is toggled on the client-side: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/assets/javascripts/main.js#L147

The cookie itself is defined when toggling canary on or off at https://next.gitlab.com/

The fact that the badge's visibility is toggled on the client-side causes some flashes in the frontend:

nextflash

A way of fixing this would be to:

  1. Set the cookie on the server-side
  2. Do the cookie check on the server-side and set a class (eg. .canary-enabled) where appropriate (body/header/...) when rendering pages
  3. Toggle the badge's visibility with CSS
  4. Cleanup Js responsible for toggling the visibility as it won't be needed anymore