diff options
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 |