summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-03-19 12:30:00 -0700
committerStan Hu <stanhu@gmail.com>2016-03-19 22:47:27 -0700
commit68fa4de6e39dfa036bb74eeb01fa569c716aacdf (patch)
treeabe48e163c3f6dfe6d199410617ec71b38a0a82e
parent01fe50a72513a88f2168c8c0a649661b1382a42b (diff)
downloadgitlab-ce-68fa4de6e39dfa036bb74eeb01fa569c716aacdf.tar.gz
Make HTTP(s) label consistent on clone bar
Sites that use http:// for the external_url should always display HTTP on the clone bar. Similarly, sites that use https:// should show HTTPS.
-rw-r--r--CHANGELOG1
-rw-r--r--app/helpers/projects_helper.rb2
-rw-r--r--app/views/shared/_clone_panel.html.haml2
-rw-r--r--spec/helpers/projects_helper_spec.rb19
4 files changed, 22 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG
index d3171da81c3..47450b6b4f6 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.6.0 (unreleased)
- Fix bug where wrong commit ID was being used in a merge request diff to show old image (Stan Hu)
+ - Make HTTP(s) label consistent on clone bar (Stan Hu)
- Add confidential issues
- Bump gitlab_git to 9.0.3 (Stan Hu)
- Support Golang subpackage fetching (Stan Hu)
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 5473419ef24..322a7021fdd 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -209,7 +209,7 @@ module ProjectsHelper
def default_clone_protocol
if !current_user || current_user.require_ssh_key?
- "http"
+ gitlab_config.protocol
else
"ssh"
end
diff --git a/app/views/shared/_clone_panel.html.haml b/app/views/shared/_clone_panel.html.haml
index faf7e49ed29..5c7806459dd 100644
--- a/app/views/shared/_clone_panel.html.haml
+++ b/app/views/shared/_clone_panel.html.haml
@@ -12,7 +12,7 @@
SSH
%li
%a#http-selector{href: @project.http_url_to_repo}
- HTTPS
+ #{gitlab_config.protocol.upcase}
= text_field_tag :project_clone, default_url_to_repo(project), class: "js-select-on-focus form-control", readonly: true
.input-group-btn
diff --git a/spec/helpers/projects_helper_spec.rb b/spec/helpers/projects_helper_spec.rb
index 53207767581..86cbd29830c 100644
--- a/spec/helpers/projects_helper_spec.rb
+++ b/spec/helpers/projects_helper_spec.rb
@@ -94,4 +94,23 @@ describe ProjectsHelper do
end
end
end
+
+ describe 'default_clone_protocol' do
+ describe 'using HTTP' do
+ it 'returns HTTP' do
+ expect(helper).to receive(:current_user).and_return(nil)
+
+ expect(helper.send(:default_clone_protocol)).to eq('http')
+ end
+ end
+
+ describe 'using HTTPS' do
+ it 'returns HTTPS' do
+ allow(Gitlab.config.gitlab).to receive(:protocol).and_return('https')
+ expect(helper).to receive(:current_user).and_return(nil)
+
+ expect(helper.send(:default_clone_protocol)).to eq('https')
+ end
+ end
+ end
end