GitLab wurde aktualisiert. Dank regelmäßiger Updates bleibt das THM GitLab sicher und Sie profitieren von den neuesten Funktionen. Vielen Dank für Ihre Geduld.

Commit f7f9e580 authored by Lin Jen-Shin's avatar Lin Jen-Shin Committed by Clement Ho
Browse files

Make sure we could query against no one

We should separate the idea of not finding anyone,
and the idea of against no one.
parent 23d43243
......@@ -173,6 +173,10 @@ def assignee_username?
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 @@ def author_username?
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 @@ def sort(items)
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 @@ def by_assignee(items)
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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment