Commit 2b327c1b authored by Jan Provaznik's avatar Jan Provaznik

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
parents a949cc35 f928c22f
...@@ -22,8 +22,7 @@ module Autocomplete ...@@ -22,8 +22,7 @@ module Autocomplete
end end
def filter_by_name(tags) def filter_by_name(tags)
return tags unless search return tags unless search.present?
return tags.none if search.empty?
if search.length >= Gitlab::SQL::Pattern::MIN_CHARS_FOR_PARTIAL_MATCHING if search.length >= Gitlab::SQL::Pattern::MIN_CHARS_FOR_PARTIAL_MATCHING
tags.named_like(search) tags.named_like(search)
......
---
title: Fix runner tags search dropdown being empty when there are tags
merge_request: 29985
author:
type: fixed
...@@ -17,13 +17,13 @@ describe Autocomplete::ActsAsTaggableOn::TagsFinder do ...@@ -17,13 +17,13 @@ describe Autocomplete::ActsAsTaggableOn::TagsFinder do
context 'filter by search' do context 'filter by search' do
context 'with an empty search term' do context 'with an empty search term' do
it 'returns an empty collection' do it 'returns all tags' do
ActsAsTaggableOn::Tag.create!(name: 'tag1') tag1 = ActsAsTaggableOn::Tag.create!(name: 'tag1')
ActsAsTaggableOn::Tag.create!(name: 'tag2') tag2 = ActsAsTaggableOn::Tag.create!(name: 'tag2')
tags = described_class.new(params: { search: '' }).execute tags = described_class.new(params: { search: '' }).execute
expect(tags).to be_empty expect(tags).to match_array [tag1, tag2]
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment