summaryrefslogtreecommitdiff
path: root/app/helpers/application_settings_helper.rb
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-12-23 20:58:24 -0800
committerStan Hu <stanhu@gmail.com>2018-12-23 21:02:19 -0800
commit4a8b4d8a515152a2dfd1eb9d400222d5c2892fff (patch)
tree6c8a91c0142ae11e6cd8e20a73805518dbdb8e2a /app/helpers/application_settings_helper.rb
parent751217987b0782115140e4c2858d91a4b596463a (diff)
downloadgitlab-ce-4a8b4d8a515152a2dfd1eb9d400222d5c2892fff.tar.gz
Fix missing Git clone button when protocol restriction setting enabled
If Git clones are restricted to either HTTP or SSH-only in the application settings, the clone button would not show. The refactoring in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22196 broke this. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/55676
Diffstat (limited to 'app/helpers/application_settings_helper.rb')
-rw-r--r--app/helpers/application_settings_helper.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb
index 72731d969a2..5a7c005fd06 100644
--- a/app/helpers/application_settings_helper.rb
+++ b/app/helpers/application_settings_helper.rb
@@ -26,6 +26,18 @@ module ApplicationSettingsHelper
end
end
+ def all_protocols_enabled?
+ Gitlab::CurrentSettings.enabled_git_access_protocol.blank?
+ end
+
+ def ssh_enabled?
+ all_protocols_enabled? || enabled_protocol == 'ssh'
+ end
+
+ def http_enabled?
+ all_protocols_enabled? || enabled_protocol == 'http'
+ end
+
def enabled_project_button(project, protocol)
case protocol
when 'ssh'