summaryrefslogtreecommitdiff
path: root/app/finders
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-10-24 06:43:13 -0700
committerStan Hu <stanhu@gmail.com>2016-10-24 22:40:09 -0700
commitce256c28f2012a9c20fd1872fa91214b402528bf (patch)
treef2bb4d7e796bdd16cb1f24eebd9a951faf725cd8 /app/finders
parentaf4d16d9b8eada31be308f87ab596e34e9907e73 (diff)
downloadgitlab-ce-ce256c28f2012a9c20fd1872fa91214b402528bf.tar.gz
Improve label filtering implementation
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/labels_finder.rb14
1 files changed, 4 insertions, 10 deletions
diff --git a/app/finders/labels_finder.rb b/app/finders/labels_finder.rb
index 032172fdfa8..8a85f7a2952 100644
--- a/app/finders/labels_finder.rb
+++ b/app/finders/labels_finder.rb
@@ -35,13 +35,11 @@ class LabelsFinder < UnionFinder
end
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
- items = items.where(title: title)
- else
+ items.where(title: title)
+ elsif params[:title] || params[:name] # empty input, should match nothing
+ items.none
+ else # not filtering
items
end
end
@@ -62,10 +60,6 @@ class LabelsFinder < UnionFinder
params[:title].presence || params[:name].presence
end
- def raw_title
- params[:title] || params[:name]
- end
-
def project
return @project if defined?(@project)