Commit d6a8021e authored by Yorick Peterse's avatar Yorick Peterse

Scope issue projects to a Group when possible

When using IssuableFinder with a Group we can greatly reduce the amount
of projects operated on (due to not including all public/internal
projects) by simply passing it down to the ProjectsFinder class.

This reduces the timings of the involved queries from roughly 300
ms to roughly 20 ms.

Fixes gitlab-org/gitlab-ce#4071, gitlab-org/gitlab-ce#3707
parent 835f1961
...@@ -81,7 +81,8 @@ class IssuableFinder ...@@ -81,7 +81,8 @@ class IssuableFinder
elsif current_user && params[:authorized_only].presence && !current_user_related? elsif current_user && params[:authorized_only].presence && !current_user_related?
@projects = current_user.authorized_projects.reorder(nil) @projects = current_user.authorized_projects.reorder(nil)
else else
@projects = ProjectsFinder.new.execute(current_user).reorder(nil) @projects = ProjectsFinder.new.execute(current_user, group: group).
reorder(nil)
end end
end 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