Improve label filtering implementation
This commit is contained in:
parent
af4d16d9b8
commit
ce256c28f2
|
@ -35,13 +35,11 @@ class LabelsFinder < UnionFinder
|
||||||
end
|
end
|
||||||
|
|
||||||
def with_title(items)
|
def with_title(items)
|
||||||
# Match no labels if an empty title is supplied to avoid matching all
|
|
||||||
# labels (e.g. when an issue is moved)
|
|
||||||
return items.none if raw_title && raw_title.empty?
|
|
||||||
|
|
||||||
if title
|
if title
|
||||||
items = items.where(title: title)
|
items.where(title: title)
|
||||||
else
|
elsif params[:title] || params[:name] # empty input, should match nothing
|
||||||
|
items.none
|
||||||
|
else # not filtering
|
||||||
items
|
items
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -62,10 +60,6 @@ class LabelsFinder < UnionFinder
|
||||||
params[:title].presence || params[:name].presence
|
params[:title].presence || params[:name].presence
|
||||||
end
|
end
|
||||||
|
|
||||||
def raw_title
|
|
||||||
params[:title] || params[:name]
|
|
||||||
end
|
|
||||||
|
|
||||||
def project
|
def project
|
||||||
return @project if defined?(@project)
|
return @project if defined?(@project)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue