diff options
author | Stan Hu <stanhu@gmail.com> | 2016-10-24 23:04:38 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2016-10-24 23:06:14 -0700 |
commit | 02f835c105df6c46d5c73468eedf1e2b0a0793b5 (patch) | |
tree | 769ff2e9ab3dbea79e6204fb774cd2c741d2299f /app | |
parent | ce256c28f2012a9c20fd1872fa91214b402528bf (diff) | |
download | gitlab-ce-02f835c105df6c46d5c73468eedf1e2b0a0793b5.tar.gz |
Improve readability and add specs for label filteringsh-fix-labels-move-issue
Diffstat (limited to 'app')
-rw-r--r-- | app/finders/labels_finder.rb | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/app/finders/labels_finder.rb b/app/finders/labels_finder.rb index 8a85f7a2952..95e62cdb02a 100644 --- a/app/finders/labels_finder.rb +++ b/app/finders/labels_finder.rb @@ -35,13 +35,10 @@ class LabelsFinder < UnionFinder end def with_title(items) - if title - items.where(title: title) - elsif params[:title] || params[:name] # empty input, should match nothing - items.none - else # not filtering - items - end + return items if title.nil? + return items.none if title.blank? + + items.where(title: title) end def group_id @@ -57,7 +54,7 @@ class LabelsFinder < UnionFinder end def title - params[:title].presence || params[:name].presence + params[:title] || params[:name] end def project |