diff --git a/CHANGELOG b/CHANGELOG index d3171da81c3d0cf90727034f21f1ceb7b76545a3..47450b6b4f6760072e0edebd5e72ce8431382abf 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 5473419ef247885db1d6830fd2c8546995ac8c8b..322a7021fddd3cc1833c167eaf9dad2345beb6b4 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 faf7e49ed2902fb6c43a0f54cae83ea9fb558fe7..5c7806459ddcf57d682fe5a7d855b82a4b9eee1c 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 53207767581e906005768c4e3313ea0beca51b35..86cbd29830cd55757aa29dd38c728a07a4d4186c 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