Speed up dashboard milestone index by scoping IssuesFinder to user authorized projects

It improves performance in dashboard milestone index page by passing a
hint to "IssuesFinder". "IssuesFinder" generates a more performant query
when it is limited to authorized projects for user.
In the dashboard we already limit the projects to these authorized for
user (see "Dashboard::ApplicationController#projects"), so we can safely
pass this option to "IssuesFinder".
This commit is contained in:
Adam Niedzielski 2017-01-13 10:12:27 -05:00
parent 0ff88ac562
commit cf3be218e1
3 changed files with 12 additions and 2 deletions

View file

@ -19,11 +19,11 @@ class Dashboard::MilestonesController < Dashboard::ApplicationController
private
def milestones
@milestones = GlobalMilestone.build_collection(@projects, params)
@milestones = DashboardMilestone.build_collection(@projects, params)
end
def milestone
@milestone = GlobalMilestone.build(@projects, params[:title])
@milestone = DashboardMilestone.build(@projects, params[:title])
render_404 unless @milestone
end
end

View file

@ -0,0 +1,5 @@
class DashboardMilestone < GlobalMilestone
def issues_finder_params
{ authorized_only: true }
end
end

View file

@ -0,0 +1,5 @@
---
title: Speed up dashboard milestone index by scoping IssuesFinder to user authorized
projects
merge_request: 8524
author: