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:
parent
0ff88ac562
commit
cf3be218e1
3 changed files with 12 additions and 2 deletions
|
@ -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
|
||||
|
|
5
app/models/dashboard_milestone.rb
Normal file
5
app/models/dashboard_milestone.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class DashboardMilestone < GlobalMilestone
|
||||
def issues_finder_params
|
||||
{ authorized_only: true }
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Speed up dashboard milestone index by scoping IssuesFinder to user authorized
|
||||
projects
|
||||
merge_request: 8524
|
||||
author:
|
Loading…
Reference in a new issue