gitlab-org--gitlab-foss/app/helpers/version_check_helper.rb
Robert Speicher 04a3e48c2a
Use class methods for VersionCheck
All of these methods are stateless, there was no point to have them as
instance methods.

Mostly this allows us to remove an `allow_any_instance_of` usage.
2018-12-14 13:56:03 -06:00

24 lines
807 B
Ruby

# frozen_string_literal: true
module VersionCheckHelper
def version_status_badge
return unless Rails.env.production?
return unless Gitlab::CurrentSettings.version_check_enabled
return if User.single_user&.requires_usage_stats_consent?
image_tag VersionCheck.url, class: 'js-version-status-badge'
end
def link_to_version
if Gitlab.pre_release?
commit_link = link_to(Gitlab.revision, Gitlab::COM_URL + namespace_project_commits_path('gitlab-org', source_code_project, Gitlab.revision))
[Gitlab::VERSION, content_tag(:small, commit_link)].join(' ').html_safe
else
link_to Gitlab::VERSION, Gitlab::COM_URL + namespace_project_tag_path('gitlab-org', source_code_project, "v#{Gitlab::VERSION}")
end
end
def source_code_project
'gitlab-ce'
end
end