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:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-03-27 04:56:42 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-03-27 04:56:42 +0300
commitdfb4fcb68544717d5cc74a2035a9d9c5bd61fc21 (patch)
tree66ade537268e685ea6fc71a45d8d03e2d33bc13f /app/finders
parent090f2344ecb6631b20df5853045536f1eb0589d3 (diff)
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