Commit f928c22f authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Return all runner tags when search is empty

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 88c8d177
...@@ -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