summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2018-08-15 09:29:20 +0000
committerNick Thomas <nick@gitlab.com>2018-08-15 09:29:20 +0000
commit9b718a761f1601394c3a1e0a15c7855d7eec6ac3 (patch)
tree79e1e49fcc38c61b494e1ba431e83e021e91b8fd /app/helpers
parentc87ca8322636db69b6f097336f163d0373bb415e (diff)
parentb6ba8cc696a45e58bde24a592a9c315a0eb16744 (diff)
downloadgitlab-ce-9b718a761f1601394c3a1e0a15c7855d7eec6ac3.tar.gz
Merge branch 'add-user_show_add_ssh_key_message-application-setting' into 'master'
Add a "user_show_add_ssh_key_message" application setting for use with SSH certificates Closes #49953 See merge request gitlab-org/gitlab-ce!21027
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/application_settings_helper.rb1
-rw-r--r--app/helpers/button_helper.rb6
-rw-r--r--app/helpers/projects_helper.rb5
3 files changed, 10 insertions, 2 deletions
diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb
index 2bdf2c2c120..1e05f07e676 100644
--- a/app/helpers/application_settings_helper.rb
+++ b/app/helpers/application_settings_helper.rb
@@ -254,6 +254,7 @@ module ApplicationSettingsHelper
:usage_ping_enabled,
:instance_statistics_visibility_private,
:user_default_external,
+ :user_show_add_ssh_key_message,
:user_oauth_applications,
:version_check_enabled,
:web_ide_clientside_preview_enabled
diff --git a/app/helpers/button_helper.rb b/app/helpers/button_helper.rb
index 0171a880164..7adc882bc47 100644
--- a/app/helpers/button_helper.rb
+++ b/app/helpers/button_helper.rb
@@ -73,7 +73,11 @@ module ButtonHelper
end
def ssh_clone_button(project, append_link: true)
- dropdown_description = _("You won't be able to pull or push project code via SSH until you add an SSH key to your profile") if current_user.try(:require_ssh_key?)
+ if Gitlab::CurrentSettings.user_show_add_ssh_key_message? &&
+ current_user.try(:require_ssh_key?)
+ dropdown_description = _("You won't be able to pull or push project code via SSH until you add an SSH key to your profile")
+ end
+
append_url = project.ssh_url_to_repo if append_link
dropdown_item_with_description('SSH', dropdown_description, href: append_url)
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index aaf9dff43ee..6b4079b4113 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -192,7 +192,10 @@ module ProjectsHelper
end
def show_no_ssh_key_message?
- cookies[:hide_no_ssh_message].blank? && !current_user.hide_no_ssh_key && current_user.require_ssh_key?
+ Gitlab::CurrentSettings.user_show_add_ssh_key_message? &&
+ cookies[:hide_no_ssh_message].blank? &&
+ !current_user.hide_no_ssh_key &&
+ current_user.require_ssh_key?
end
def show_no_password_message?