Merge branch 'sh-fix-clone-url-for-https' into 'master'
Fix clone URL not showing if protocol is HTTPS Closes #55896 See merge request gitlab-org/gitlab-ce!24131
This commit is contained in:
commit
64c582d184
3 changed files with 46 additions and 2 deletions
|
@ -20,7 +20,7 @@ module ApplicationSettingsHelper
|
||||||
def enabled_protocol
|
def enabled_protocol
|
||||||
case Gitlab::CurrentSettings.enabled_git_access_protocol
|
case Gitlab::CurrentSettings.enabled_git_access_protocol
|
||||||
when 'http'
|
when 'http'
|
||||||
gitlab_config.protocol
|
Gitlab.config.gitlab.protocol
|
||||||
when 'ssh'
|
when 'ssh'
|
||||||
'ssh'
|
'ssh'
|
||||||
end
|
end
|
||||||
|
@ -35,7 +35,7 @@ module ApplicationSettingsHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def http_enabled?
|
def http_enabled?
|
||||||
all_protocols_enabled? || enabled_protocol == 'http'
|
all_protocols_enabled? || Gitlab::CurrentSettings.enabled_git_access_protocol == 'http'
|
||||||
end
|
end
|
||||||
|
|
||||||
def enabled_project_button(project, protocol)
|
def enabled_project_button(project, protocol)
|
||||||
|
|
5
changelogs/unreleased/sh-fix-clone-url-for-https.yml
Normal file
5
changelogs/unreleased/sh-fix-clone-url-for-https.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: Fix clone URL not showing if protocol is HTTPS
|
||||||
|
merge_request: 24131
|
||||||
|
author:
|
||||||
|
type: fixed
|
39
spec/helpers/application_settings_helper_spec.rb
Normal file
39
spec/helpers/application_settings_helper_spec.rb
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe ApplicationSettingsHelper do
|
||||||
|
context 'when all protocols in use' do
|
||||||
|
before do
|
||||||
|
stub_application_setting(enabled_git_access_protocol: '')
|
||||||
|
end
|
||||||
|
|
||||||
|
it { expect(all_protocols_enabled?).to be_truthy }
|
||||||
|
it { expect(http_enabled?).to be_truthy }
|
||||||
|
it { expect(ssh_enabled?).to be_truthy }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when SSH is only in use' do
|
||||||
|
before do
|
||||||
|
stub_application_setting(enabled_git_access_protocol: 'ssh')
|
||||||
|
end
|
||||||
|
|
||||||
|
it { expect(all_protocols_enabled?).to be_falsey }
|
||||||
|
it { expect(http_enabled?).to be_falsey }
|
||||||
|
it { expect(ssh_enabled?).to be_truthy }
|
||||||
|
end
|
||||||
|
|
||||||
|
shared_examples 'when HTTP protocol is in use' do |protocol|
|
||||||
|
before do
|
||||||
|
allow(Gitlab.config.gitlab).to receive(:protocol).and_return(protocol)
|
||||||
|
stub_application_setting(enabled_git_access_protocol: 'http')
|
||||||
|
end
|
||||||
|
|
||||||
|
it { expect(all_protocols_enabled?).to be_falsey }
|
||||||
|
it { expect(http_enabled?).to be_truthy }
|
||||||
|
it { expect(ssh_enabled?).to be_falsey }
|
||||||
|
end
|
||||||
|
|
||||||
|
it_behaves_like 'when HTTP protocol is in use', 'https'
|
||||||
|
it_behaves_like 'when HTTP protocol is in use', 'http'
|
||||||
|
end
|
Loading…
Reference in a new issue