Commit cf3be218 authored by Adam Niedzielski's avatar Adam Niedzielski

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".
parent 0ff88ac5
...@@ -19,11 +19,11 @@ class Dashboard::MilestonesController < Dashboard::ApplicationController ...@@ -19,11 +19,11 @@ class Dashboard::MilestonesController < Dashboard::ApplicationController
private private
def milestones def milestones
@milestones = GlobalMilestone.build_collection(@projects, params) @milestones = DashboardMilestone.build_collection(@projects, params)
end end
def milestone def milestone
@milestone = GlobalMilestone.build(@projects, params[:title]) @milestone = DashboardMilestone.build(@projects, params[:title])
render_404 unless @milestone render_404 unless @milestone
end end
end end
class DashboardMilestone < GlobalMilestone
def issues_finder_params
{ authorized_only: true }
end
end
---
title: Speed up dashboard milestone index by scoping IssuesFinder to user authorized
projects
merge_request: 8524
author:
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment