diff options
author | Mario de la Ossa <mdelaossa@gitlab.com> | 2018-02-02 18:39:55 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-02-02 18:39:55 +0000 |
commit | eaada9d7066a20b5af815f723e09cde60a5c8c10 (patch) | |
tree | 72ba4231e28f1c5e5405db21e0611a55e6428145 /app/helpers | |
parent | 8fa2932dc5cc7687e7d85ae7b00c07fd9bcc24a4 (diff) | |
download | gitlab-ce-eaada9d7066a20b5af815f723e09cde60a5c8c10.tar.gz |
use Gitlab::UserSettings directly as a singleton instead of including/extending it
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/application_settings_helper.rb | 14 | ||||
-rw-r--r-- | app/helpers/auth_helper.rb | 4 | ||||
-rw-r--r-- | app/helpers/projects_helper.rb | 10 | ||||
-rw-r--r-- | app/helpers/version_check_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/visibility_level_helper.rb | 4 |
5 files changed, 14 insertions, 20 deletions
diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb index e91e1d29d64..7548bc30247 100644 --- a/app/helpers/application_settings_helper.rb +++ b/app/helpers/application_settings_helper.rb @@ -1,25 +1,23 @@ module ApplicationSettingsHelper extend self - include Gitlab::CurrentSettings - delegate :allow_signup?, :gravatar_enabled?, :password_authentication_enabled_for_web?, :akismet_enabled?, :koding_enabled?, - to: :current_application_settings + to: :'Gitlab::CurrentSettings.current_application_settings' def user_oauth_applications? - current_application_settings.user_oauth_applications + Gitlab::CurrentSettings.user_oauth_applications end def allowed_protocols_present? - current_application_settings.enabled_git_access_protocol.present? + Gitlab::CurrentSettings.enabled_git_access_protocol.present? end def enabled_protocol - case current_application_settings.enabled_git_access_protocol + case Gitlab::CurrentSettings.enabled_git_access_protocol when 'http' gitlab_config.protocol when 'ssh' @@ -57,7 +55,7 @@ module ApplicationSettingsHelper # toggle button effect. def import_sources_checkboxes(help_block_id) Gitlab::ImportSources.options.map do |name, source| - checked = current_application_settings.import_sources.include?(source) + checked = Gitlab::CurrentSettings.import_sources.include?(source) css_class = checked ? 'active' : '' checkbox_name = 'application_setting[import_sources][]' @@ -72,7 +70,7 @@ module ApplicationSettingsHelper def oauth_providers_checkboxes button_based_providers.map do |source| - disabled = current_application_settings.disabled_oauth_sign_in_sources.include?(source.to_s) + disabled = Gitlab::CurrentSettings.disabled_oauth_sign_in_sources.include?(source.to_s) css_class = 'btn' css_class << ' active' unless disabled checkbox_name = 'application_setting[enabled_oauth_sign_in_sources][]' diff --git a/app/helpers/auth_helper.rb b/app/helpers/auth_helper.rb index 66dc0b1e6f7..f909f664034 100644 --- a/app/helpers/auth_helper.rb +++ b/app/helpers/auth_helper.rb @@ -1,6 +1,4 @@ module AuthHelper - include Gitlab::CurrentSettings - PROVIDERS_WITH_ICONS = %w(twitter github gitlab bitbucket google_oauth2 facebook azure_oauth2 authentiq).freeze FORM_BASED_PROVIDERS = [/\Aldap/, 'crowd'].freeze @@ -41,7 +39,7 @@ module AuthHelper end def enabled_button_based_providers - disabled_providers = current_application_settings.disabled_oauth_sign_in_sources || [] + disabled_providers = Gitlab::CurrentSettings.disabled_oauth_sign_in_sources || [] button_based_providers.map(&:to_s) - disabled_providers end diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index f7bdcc6fd9c..6512617a02d 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -1,6 +1,4 @@ module ProjectsHelper - include Gitlab::CurrentSettings - def link_to_project(project) link_to [project.namespace.becomes(Namespace), project], title: h(project.name) do title = content_tag(:span, project.name, class: 'project-name') @@ -214,7 +212,7 @@ module ProjectsHelper project.cache_key, controller.controller_name, controller.action_name, - current_application_settings.cache_key, + Gitlab::CurrentSettings.cache_key, 'v2.5' ] @@ -447,10 +445,10 @@ module ProjectsHelper path = "#{import_path}?repo=#{repo}&branch=#{branch}&sha=#{sha}" - return URI.join(current_application_settings.koding_url, path).to_s + return URI.join(Gitlab::CurrentSettings.koding_url, path).to_s end - current_application_settings.koding_url + Gitlab::CurrentSettings.koding_url end def contribution_guide_path(project) @@ -559,7 +557,7 @@ module ProjectsHelper def restricted_levels return [] if current_user.admin? - current_application_settings.restricted_visibility_levels || [] + Gitlab::CurrentSettings.restricted_visibility_levels || [] end def project_permissions_settings(project) diff --git a/app/helpers/version_check_helper.rb b/app/helpers/version_check_helper.rb index 456598b4c28..c20753ece72 100644 --- a/app/helpers/version_check_helper.rb +++ b/app/helpers/version_check_helper.rb @@ -1,6 +1,6 @@ module VersionCheckHelper def version_status_badge - if Rails.env.production? && current_application_settings.version_check_enabled + if Rails.env.production? && Gitlab::CurrentSettings.version_check_enabled image_url = VersionCheck.new.url image_tag image_url, class: 'js-version-status-badge' end diff --git a/app/helpers/visibility_level_helper.rb b/app/helpers/visibility_level_helper.rb index c3d5628f241..e395cda03d3 100644 --- a/app/helpers/visibility_level_helper.rb +++ b/app/helpers/visibility_level_helper.rb @@ -151,12 +151,12 @@ module VisibilityLevelHelper def restricted_visibility_levels(show_all = false) return [] if current_user.admin? && !show_all - current_application_settings.restricted_visibility_levels || [] + Gitlab::CurrentSettings.restricted_visibility_levels || [] end delegate :default_project_visibility, :default_group_visibility, - to: :current_application_settings + to: :'Gitlab::CurrentSettings.current_application_settings' def disallowed_visibility_level?(form_model, level) return false unless form_model.respond_to?(:visibility_level_allowed?) |