diff options
-rw-r--r-- | app/helpers/button_helper.rb | 2 | ||||
-rw-r--r-- | changelogs/unreleased/fix-download-dropdown-link.yml | 5 | ||||
-rw-r--r-- | spec/helpers/button_helper_spec.rb | 14 |
3 files changed, 19 insertions, 2 deletions
diff --git a/app/helpers/button_helper.rb b/app/helpers/button_helper.rb index 7adc882bc47..26e3850a540 100644 --- a/app/helpers/button_helper.rb +++ b/app/helpers/button_helper.rb @@ -67,7 +67,7 @@ module ButtonHelper def http_dropdown_description(protocol) if current_user.try(:require_password_creation_for_git?) _("Set a password on your account to pull or push via %{protocol}.") % { protocol: protocol } - else + elsif current_user.try(:require_personal_access_token_creation_for_git_auth?) _("Create a personal access token on your account to pull or push via %{protocol}.") % { protocol: protocol } end end diff --git a/changelogs/unreleased/fix-download-dropdown-link.yml b/changelogs/unreleased/fix-download-dropdown-link.yml new file mode 100644 index 00000000000..998476b07bd --- /dev/null +++ b/changelogs/unreleased/fix-download-dropdown-link.yml @@ -0,0 +1,5 @@ +--- +title: Hide PAT creation advice for HTTP clone if PAT exists +merge_request: 18208 +author: George Thomas @thegeorgeous +type: fixed diff --git a/spec/helpers/button_helper_spec.rb b/spec/helpers/button_helper_spec.rb index 0c0a0003231..eebae1d7290 100644 --- a/spec/helpers/button_helper_spec.rb +++ b/spec/helpers/button_helper_spec.rb @@ -40,12 +40,24 @@ describe ButtonHelper do end context 'when user has no personal access tokens' do - it 'has a personal access token text on the dropdown description ' do + it 'has a personal access token text on the dropdown description' do description = element.search('.dropdown-menu-inner-content').first expect(description.inner_text).to eq 'Create a personal access token on your account to pull or push via HTTP.' end end + + context 'when user has personal access tokens' do + before do + create(:personal_access_token, user: user) + end + + it 'does not have a personal access token text on the dropdown description' do + description = element.search('.dropdown-menu-inner-content').first + + expect(description).to be_nil + end + end end context 'when user is ldap user' do |