Commit 68fa4de6 authored by Stan Hu's avatar Stan Hu

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.
parent 01fe50a7
...@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date. ...@@ -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) 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) - 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 - Add confidential issues
- Bump gitlab_git to 9.0.3 (Stan Hu) - Bump gitlab_git to 9.0.3 (Stan Hu)
- Support Golang subpackage fetching (Stan Hu) - Support Golang subpackage fetching (Stan Hu)
......
...@@ -209,7 +209,7 @@ module ProjectsHelper ...@@ -209,7 +209,7 @@ module ProjectsHelper
def default_clone_protocol def default_clone_protocol
if !current_user || current_user.require_ssh_key? if !current_user || current_user.require_ssh_key?
"http" gitlab_config.protocol
else else
"ssh" "ssh"
end end
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
SSH SSH
%li %li
%a#http-selector{href: @project.http_url_to_repo} %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 = text_field_tag :project_clone, default_url_to_repo(project), class: "js-select-on-focus form-control", readonly: true
.input-group-btn .input-group-btn
......
...@@ -94,4 +94,23 @@ describe ProjectsHelper do ...@@ -94,4 +94,23 @@ describe ProjectsHelper do
end end
end 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 end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment