BigW Consortium Gitlab

Commit e805becf by Rubén Dávila

Eager load Issues/MRs project for Milestone.

With this change we avoid doing N+1 queries when viewing Milestone's Issues/MRs from a Group context.
parent 37d92d0b
......@@ -76,11 +76,11 @@ class GlobalMilestone
end
def issues
@issues ||= Issue.of_milestones(milestones.map(&:id))
@issues ||= Issue.of_milestones(milestones.map(&:id)).includes(:project)
end
def merge_requests
@merge_requests ||= MergeRequest.of_milestones(milestones.map(&:id))
@merge_requests ||= MergeRequest.of_milestones(milestones.map(&:id)).includes(:target_project)
end
def participants
......
......@@ -73,7 +73,7 @@
= render 'shared/milestones/issues_tab', unassigned: @milestone.opened_issues.unassigned, assigned: @milestone.opened_issues.assigned, closed: @milestone.closed_issues
.tab-pane#tab-merge-requests
= render 'shared/milestones/merge_requests_tab', unassigned: @milestone.opened_merge_requests.unassigned, assigned: @milestone.opened_merge_requests.assigned, closed: @milestone.closed_merge_requests, merged: @milestone.merge_requests.merged
= render 'shared/milestones/merge_requests_tab', unassigned: @milestone.opened_merge_requests.unassigned, assigned: @milestone.opened_merge_requests.assigned, closed: @milestone.merge_requests.closed, merged: @milestone.merge_requests.merged
.tab-pane#tab-participants
.gray-content-block.middle-block
......
- project = issue.project
-# @project is present when viewing Project's milestone
- project = @project || issue.project
%li{ id: dom_id(issue, 'sortable'), class: 'issue-row', 'data-iid' => issue.iid, 'data-url' => issue_path(issue) }
%span
= link_to_gfm issue.title, [project.namespace.becomes(Namespace), project, issue], title: issue.title
......
-# @project is present when viewing Project's milestone
- project = @project || merge_request.project
%li{ id: dom_id(merge_request, 'sortable'), class: 'mr-row', 'data-iid' => merge_request.iid, 'data-url' => merge_request_path(merge_request) }
......
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