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
path: root/app
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-12-16 17:28:18 +0300
committerClement Ho <ClemMakesApps@gmail.com>2017-01-10 01:01:35 +0300
commitf7f9e58092892e5bae0887aa2c0ee9f699085aad (patch)
tree2a7089fd2ac420f9ca3d3581bc16a103a12f1d90 /app
parent23d43243a1261be0af6142f7d34063587b11d51b (diff)
Make sure we could query against no one
We should separate the idea of not finding anyone, and the idea of against no one.
Diffstat (limited to 'app')
-rw-r--r--app/finders/issuable_finder.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb
index dce756544e7..5ffaf5ae0f8 100644
--- a/app/finders/issuable_finder.rb
+++ b/app/finders/issuable_finder.rb
@@ -173,6 +173,10 @@ class IssuableFinder
params[:assignee_username].present? && params[:assignee_username] != NONE
end
+ def no_assignee?
+ params[:assignee_id] == NONE || params[:assignee_username] == NONE
+ end
+
def assignee
return @assignee if defined?(@assignee)
@@ -194,6 +198,10 @@ class IssuableFinder
params[:author_username].present? && params[:author_username] != NONE
end
+ def no_author?
+ params[:author_id] == NONE || params[:author_username] == NONE
+ end
+
def author
return @author if defined?(@author)
@@ -277,6 +285,8 @@ class IssuableFinder
def by_assignee(items)
if assignee
items = items.where(assignee_id: assignee.id)
+ elsif no_assignee?
+ items = items.where(assignee_id: nil)
elsif assignee_id? || assignee_username? # assignee not found
items = items.none
end
@@ -287,6 +297,8 @@ class IssuableFinder
def by_author(items)
if author
items = items.where(author_id: author.id)
+ elsif no_author?
+ items = items.where(author_id: nil)
elsif author_id? || author_username? # author not found
items = items.none
end