summaryrefslogtreecommitdiff
path: root/app/finders
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-03-26 18:56:42 -0700
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-03-26 18:56:42 -0700
commitdfb4fcb68544717d5cc74a2035a9d9c5bd61fc21 (patch)
tree66ade537268e685ea6fc71a45d8d03e2d33bc13f /app/finders
parent090f2344ecb6631b20df5853045536f1eb0589d3 (diff)
downloadgitlab-ce-dfb4fcb68544717d5cc74a2035a9d9c5bd61fc21.tar.gz
No magic numbers for issues filtering
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/issuable_finder.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb
index 088a766ed3a..67939c094c5 100644
--- a/app/finders/issuable_finder.rb
+++ b/app/finders/issuable_finder.rb
@@ -19,6 +19,8 @@
require_relative 'projects_finder'
class IssuableFinder
+ NONE = 0
+
attr_accessor :current_user, :params
def execute(current_user, params)
@@ -112,7 +114,7 @@ class IssuableFinder
def by_milestone(items)
if params[:milestone_id].present?
- items = items.where(milestone_id: (params[:milestone_id] == '0' ? nil : params[:milestone_id]))
+ items = items.where(milestone_id: (params[:milestone_id] == NONE ? nil : params[:milestone_id]))
end
items
@@ -120,7 +122,7 @@ class IssuableFinder
def by_assignee(items)
if params[:assignee_id].present?
- items = items.where(assignee_id: (params[:assignee_id] == '0' ? nil : params[:assignee_id]))
+ items = items.where(assignee_id: (params[:assignee_id] == NONE ? nil : params[:assignee_id]))
end
items
@@ -128,7 +130,7 @@ class IssuableFinder
def by_author(items)
if params[:author_id].present?
- items = items.where(author_id: (params[:author_id] == '0' ? nil : params[:author_id]))
+ items = items.where(author_id: (params[:author_id] == NONE ? nil : params[:author_id]))
end
items