Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-01-25 18:56:23 +0300
committerYorick Peterse <yorickpeterse@gmail.com>2016-01-26 12:51:53 +0300
commit128a6411d2a60c855e3c99303d0157f436e32f13 (patch)
tree6affd244fa7353f7629bb567b2dcad6ca5c4b3bd /app/controllers/dashboard_controller.rb
parenteb7f669073b2b95a1956de5e22f97dc8f83711e8 (diff)
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/dashboard_controller.rb')
-rw-r--r--app/controllers/dashboard_controller.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb
index 087da935087..139e40db180 100644
--- a/app/controllers/dashboard_controller.rb
+++ b/app/controllers/dashboard_controller.rb
@@ -23,14 +23,14 @@ class DashboardController < Dashboard::ApplicationController
protected
def load_events
- project_ids =
+ projects =
if params[:filter] == "starred"
current_user.starred_projects
else
current_user.authorized_projects
- end.pluck(:id)
+ end
- @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