Commit 7311b53a authored by Valery Sizov's avatar Valery Sizov

[Multiple Issue Assignee] Fix issue filters

parent 985f8b1a
...@@ -40,7 +40,7 @@ module IssuableCollections ...@@ -40,7 +40,7 @@ module IssuableCollections
end end
def issues_collection def issues_collection
issues_finder.execute.preload(:project, :author, :assignees, :labels, :milestone, project: :namespace) issues_finder.execute.preload(:project, :author, :labels, :milestone, project: :namespace)
end end
def merge_requests_collection def merge_requests_collection
......
...@@ -26,12 +26,26 @@ class IssuesFinder < IssuableFinder ...@@ -26,12 +26,26 @@ class IssuesFinder < IssuableFinder
IssuesFinder.not_restricted_by_confidentiality(current_user) IssuesFinder.not_restricted_by_confidentiality(current_user)
end end
def by_assignee(items)
if assignee
items = items.where("issue_assignees.user_id = ?", assignee.id)
elsif no_assignee?
items = items.where("issue_assignees.user_id is NULL")
elsif assignee_id? || assignee_username? # assignee not found
items = items.none
end
items
end
def self.not_restricted_by_confidentiality(user) def self.not_restricted_by_confidentiality(user)
return Issue.where('issues.confidential IS NULL OR issues.confidential IS FALSE') if user.blank? issues = Issue.with_assignees
return issues.where('issues.confidential IS NULL OR issues.confidential IS FALSE') if user.blank?
return Issue.all if user.admin_or_auditor? return issues.all if user.admin_or_auditor?
Issue.with_assignees.where(' issues.where('
issues.confidential IS NULL issues.confidential IS NULL
OR issues.confidential IS FALSE OR issues.confidential IS FALSE
OR (issues.confidential = TRUE OR (issues.confidential = TRUE
......
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