summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-01-18 12:16:55 +0100
committerYorick Peterse <yorickpeterse@gmail.com>2016-01-18 12:27:33 +0100
commitd6a8021ea11c97a8b65f8693a7afe1cb7216295b (patch)
tree2fbdbb337c9d16628c9e032a3763d2e72272dc09
parent835f1961e65fe9b4f943b17747b1518c555e8bfd (diff)
downloadgitlab-ce-issuable-group-projects.tar.gz
Scope issue projects to a Group when possibleissuable-group-projects
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
-rw-r--r--app/finders/issuable_finder.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb
index 4d56b48e3f8..0a4192e6bac 100644
--- a/app/finders/issuable_finder.rb
+++ b/app/finders/issuable_finder.rb
@@ -81,7 +81,8 @@ class IssuableFinder
elsif current_user && params[:authorized_only].presence && !current_user_related?
@projects = current_user.authorized_projects.reorder(nil)
else
- @projects = ProjectsFinder.new.execute(current_user).reorder(nil)
+ @projects = ProjectsFinder.new.execute(current_user, group: group).
+ reorder(nil)
end
end