2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
module VersionCheckHelper
|
|
|
|
def version_status_badge
|
2018-11-20 20:47:30 +05:30
|
|
|
return unless Rails.env.production?
|
|
|
|
return unless Gitlab::CurrentSettings.version_check_enabled
|
|
|
|
return if User.single_user&.requires_usage_stats_consent?
|
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
image_tag VersionCheck.url, class: 'js-version-status-badge'
|
2015-09-11 14:41:01 +05:30
|
|
|
end
|
2018-12-05 23:21:45 +05:30
|
|
|
|
|
|
|
def link_to_version
|
|
|
|
if Gitlab.pre_release?
|
2021-06-08 01:23:25 +05:30
|
|
|
commit_link = link_to(Gitlab.revision, source_host_url + namespace_project_commits_path(source_code_group, source_code_project, Gitlab.revision))
|
2018-12-05 23:21:45 +05:30
|
|
|
[Gitlab::VERSION, content_tag(:small, commit_link)].join(' ').html_safe
|
|
|
|
else
|
2021-06-08 01:23:25 +05:30
|
|
|
link_to Gitlab::VERSION, source_host_url + namespace_project_tag_path(source_code_group, source_code_project, "v#{Gitlab::VERSION}")
|
2018-12-05 23:21:45 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
def source_host_url
|
2021-09-04 01:27:46 +05:30
|
|
|
Gitlab::Saas.com_url
|
2021-06-08 01:23:25 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def source_code_group
|
|
|
|
'gitlab-org'
|
|
|
|
end
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
def source_code_project
|
2019-12-04 20:38:33 +05:30
|
|
|
'gitlab-foss'
|
2018-12-05 23:21:45 +05:30
|
|
|
end
|
2015-09-11 14:41:01 +05:30
|
|
|
end
|
2019-12-04 20:38:33 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
VersionCheckHelper.prepend_mod
|