summaryrefslogtreecommitdiff
path: root/app/finders
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-12-16 19:58:59 +0800
committerClement Ho <ClemMakesApps@gmail.com>2017-01-09 16:01:34 -0600
commit866bb202f29b8f5ad52563dd48ae57168dc6df77 (patch)
tree745ff790a1b47a930283b389efd5e10fa5ad779b /app/finders
parentb0d8d742c588baacf0ba08074f23e68498297d10 (diff)
downloadgitlab-ce-866bb202f29b8f5ad52563dd48ae57168dc6df77.tar.gz
Check if it's not NONE too
So that we don't have to check it again in somewhere else, and we don't really need to know if it's presented as NONE Feedback: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7345/diffs#note_20123999
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/issuable_finder.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb
index 2afde8ece65..dfd7de6afa9 100644
--- a/app/finders/issuable_finder.rb
+++ b/app/finders/issuable_finder.rb
@@ -166,20 +166,20 @@ class IssuableFinder
end
def assignee_id?
- params[:assignee_id].present?
+ params[:assignee_id].present? && params[:assignee_id] != NONE
end
def assignee_username?
- params[:assignee_username].present?
+ params[:assignee_username].present? && params[:assignee_username] != NONE
end
def assignee
return @assignee if defined?(@assignee)
@assignee =
- if assignee_id? && params[:assignee_id] != NONE
+ if assignee_id?
User.find(params[:assignee_id])
- elsif assignee_username? && params[:assignee_username] != NONE
+ elsif assignee_username?
User.find_by(username: params[:assignee_username])
else
nil
@@ -187,11 +187,11 @@ class IssuableFinder
end
def author_id?
- params[:author_id].present?
+ params[:author_id].present? && params[:author_id] != NONE
end
def author_username?
- params[:author_username].present?
+ params[:author_username].present? && params[:author_username] != NONE
end
def author