cf3be218e1
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".
29 lines
622 B
Ruby
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
|