diff options
author | Stan Hu <stanhu@gmail.com> | 2016-10-24 16:25:18 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2016-10-25 08:40:09 +0300 |
commit | af4d16d9b8eada31be308f87ab596e34e9907e73 (patch) | |
tree | 43b8edea2c628a5b951f817e27a8a9fbcc53aec0 /app/finders/labels_finder.rb | |
parent | 7c0ccbaac4aad5057f76d4f62b3a892aae64e190 (diff) |
Allow the use of params[:name] when filtering labels
Diffstat (limited to 'app/finders/labels_finder.rb')
-rw-r--r-- | app/finders/labels_finder.rb | 13 |
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) |