Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-10-24 16:25:18 +0300
committerStan Hu <stanhu@gmail.com>2016-10-25 08:40:09 +0300
commitaf4d16d9b8eada31be308f87ab596e34e9907e73 (patch)
tree43b8edea2c628a5b951f817e27a8a9fbcc53aec0 /app/finders
parent7c0ccbaac4aad5057f76d4f62b3a892aae64e190 (diff)
Allow the use of params[:name] when filtering labels
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/labels_finder.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/app/finders/labels_finder.rb b/app/finders/labels_finder.rb
index 2291c64b84d..032172fdfa8 100644
--- a/app/finders/labels_finder.rb
+++ b/app/finders/labels_finder.rb
@@ -37,10 +37,13 @@ class LabelsFinder < UnionFinder
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 Label.none if params[:title] && params[:title].empty?
+ return items.none if raw_title && raw_title.empty?
- items = items.where(title: title) if title
- items
+ if title
+ items = items.where(title: title)
+ else
+ items
+ end
end
def group_id
@@ -59,6 +62,10 @@ 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)