Skip to content

Take `relative_url_root` into account when retrieving upgrade badge

What does this MR do and why?

We can check for updates by checking the update badge on the admin screen. Internally, this is accomplished by retrieving /admin/version_check.json and comparing versions. However, the URL for this json file is hardcoded and the relative_url_root setting is ignored. This MR fixes this - it takes the value of relative_url_root into account when retrieving the file for version checking (as other front-end code does).

Screenshots or screen recordings

I have attached a screenshot of the "Network" tab of the developer tools in the browser (firefox). You can be sure that the URL when getting version check.json definitely reflects the value of relative_url_root (I used the value "/gitlab" for testing).

gitlab_admin_view_respect_relative_url_on_retrieving_version_check_json

How to set up and validate locally

  1. apply this patch
  2. enable relative url feature
  3. recompile asset by running bundle exec rake gitlab:assets:compile
  4. Visit admin page (e.g. http://127.0.0.1:3000/gitlab/admin) and check if upgrade badge is shown up

Please note that there is an another issue around upgrade badge display. It sometimes does not appears until reload the page at least once.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Fix #352355 (closed)
Fix #356105 (closed) (duplicated)
Reference: !87551 (merged) (similar issue for "what's new" contents)

Merge request reports