summaryrefslogtreecommitdiff
path: root/app/controllers/groups_controller.rb
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-01-25 16:56:23 +0100
committerYorick Peterse <yorickpeterse@gmail.com>2016-01-26 10:51:53 +0100
commit128a6411d2a60c855e3c99303d0157f436e32f13 (patch)
tree6affd244fa7353f7629bb567b2dcad6ca5c4b3bd /app/controllers/groups_controller.rb
parenteb7f669073b2b95a1956de5e22f97dc8f83711e8 (diff)
downloadgitlab-ce-128a6411d2a60c855e3c99303d0157f436e32f13.tar.gz
Don't pluck project IDs for events
By instead using a sub-query we save ourselves the overhead of loading any data into memory only to pass it on to another query.
Diffstat (limited to 'app/controllers/groups_controller.rb')
-rw-r--r--app/controllers/groups_controller.rb6
1 files changed, 1 insertions, 5 deletions
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
index fb26a4e6fc3..7bbef5ab29c 100644
--- a/app/controllers/groups_controller.rb
+++ b/app/controllers/groups_controller.rb
@@ -87,10 +87,6 @@ class GroupsController < Groups::ApplicationController
@projects ||= ProjectsFinder.new.execute(current_user, group: group).sorted_by_activity.non_archived
end
- def project_ids
- @projects.pluck(:id)
- end
-
# Dont allow unauthorized access to group
def authorize_read_group!
unless @group and (@projects.present? or can?(current_user, :read_group, @group))
@@ -123,7 +119,7 @@ class GroupsController < Groups::ApplicationController
end
def load_events
- @events = Event.in_projects(project_ids)
+ @events = Event.in_projects(@projects)
@events = event_filter.apply_filter(@events).with_associations
@events = @events.limit(20).offset(params[:offset] || 0)
end