gitlab-org--gitlab-foss/app/controllers/dashboard/milestones_controller.rb
Adam Niedzielski cf3be218e1 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".
2017-01-16 11:58:16 -05:00

29 lines
622 B
Ruby

class Dashboard::MilestonesController < Dashboard::ApplicationController
before_action :projects
before_action :milestone, only: [:show]
def index
respond_to do |format|
format.html do
@milestones = Kaminari.paginate_array(milestones).page(params[:page])
end
format.json do
render json: milestones
end
end
end
def show
end
private
def milestones
@milestones = DashboardMilestone.build_collection(@projects, params)
end
def milestone
@milestone = DashboardMilestone.build(@projects, params[:title])
render_404 unless @milestone
end
end