Skip to content
Snippets Groups Projects
Unverified Commit f928c22f authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Return all runner tags when search is empty

parent 88c8d177
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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)
Loading
Loading
---
title: Fix runner tags search dropdown being empty when there are tags
merge_request: 29985
author:
type: fixed
Loading
Loading
@@ -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
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment