diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2019-06-24 18:43:54 +0000 |
---|---|---|
committer | Jan Provaznik <jprovaznik@gitlab.com> | 2019-06-24 18:43:54 +0000 |
commit | 2b327c1b4ddde98719eca2b0e8edab8d9079f2f2 (patch) | |
tree | 913f7db0f9925fa6f2407d5aaf3149f1391dd772 | |
parent | a949cc3518bc97997cebbb586eddf98270126262 (diff) | |
parent | f928c22ff0952cd6a358ae0102aa45c58c2478aa (diff) | |
download | gitlab-ce-2b327c1b4ddde98719eca2b0e8edab8d9079f2f2.tar.gz |
Merge branch '63656-runner-tags-search-dropdown-is-empty' into 'master'
Resolve "Runner tags search dropdown is empty"
Closes #63656
See merge request gitlab-org/gitlab-ce!29985
3 files changed, 10 insertions, 6 deletions
diff --git a/app/finders/autocomplete/acts_as_taggable_on/tags_finder.rb b/app/finders/autocomplete/acts_as_taggable_on/tags_finder.rb index f38c187799c..78a17312e26 100644 --- a/app/finders/autocomplete/acts_as_taggable_on/tags_finder.rb +++ b/app/finders/autocomplete/acts_as_taggable_on/tags_finder.rb @@ -22,8 +22,7 @@ module Autocomplete end def filter_by_name(tags) - return tags unless search - return tags.none if search.empty? + return tags unless search.present? if search.length >= Gitlab::SQL::Pattern::MIN_CHARS_FOR_PARTIAL_MATCHING tags.named_like(search) diff --git a/changelogs/unreleased/63656-runner-tags-search-dropdown-is-empty.yml b/changelogs/unreleased/63656-runner-tags-search-dropdown-is-empty.yml new file mode 100644 index 00000000000..08c415f4a1c --- /dev/null +++ b/changelogs/unreleased/63656-runner-tags-search-dropdown-is-empty.yml @@ -0,0 +1,5 @@ +--- +title: Fix runner tags search dropdown being empty when there are tags +merge_request: 29985 +author: +type: fixed diff --git a/spec/finders/autocomplete/acts_as_taggable_on/tags_finder_spec.rb b/spec/finders/autocomplete/acts_as_taggable_on/tags_finder_spec.rb index 79d2f9cdb45..c4e6c9cc9f5 100644 --- a/spec/finders/autocomplete/acts_as_taggable_on/tags_finder_spec.rb +++ b/spec/finders/autocomplete/acts_as_taggable_on/tags_finder_spec.rb @@ -17,13 +17,13 @@ describe Autocomplete::ActsAsTaggableOn::TagsFinder do context 'filter by search' do context 'with an empty search term' do - it 'returns an empty collection' do - ActsAsTaggableOn::Tag.create!(name: 'tag1') - ActsAsTaggableOn::Tag.create!(name: 'tag2') + it 'returns all tags' do + tag1 = ActsAsTaggableOn::Tag.create!(name: 'tag1') + tag2 = ActsAsTaggableOn::Tag.create!(name: 'tag2') tags = described_class.new(params: { search: '' }).execute - expect(tags).to be_empty + expect(tags).to match_array [tag1, tag2] end end |