diff options
author | Rubén Dávila <rdavila84@gmail.com> | 2016-02-23 20:15:19 +0300 |
---|---|---|
committer | Rubén Dávila <rdavila84@gmail.com> | 2016-03-05 06:37:03 +0300 |
commit | e805becfe838b6ac351a15a01d58e355a0b1763b (patch) | |
tree | bc5c6a615d1cd677d5d0e1d20493d41cc2f7de62 /app/views/shared/milestones | |
parent | 37d92d0b7b91c678ce71393e73aa94860051fd5a (diff) |
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.
Diffstat (limited to 'app/views/shared/milestones')
-rw-r--r-- | app/views/shared/milestones/_issue.html.haml | 4 | ||||
-rw-r--r-- | app/views/shared/milestones/_merge_request.html.haml | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/app/views/shared/milestones/_issue.html.haml b/app/views/shared/milestones/_issue.html.haml index 07880404c9a..be55c5b6fe0 100644 --- a/app/views/shared/milestones/_issue.html.haml +++ b/app/views/shared/milestones/_issue.html.haml @@ -1,4 +1,6 @@ -- 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 diff --git a/app/views/shared/milestones/_merge_request.html.haml b/app/views/shared/milestones/_merge_request.html.haml index a58dadb4f84..66e2a2955da 100644 --- a/app/views/shared/milestones/_merge_request.html.haml +++ b/app/views/shared/milestones/_merge_request.html.haml @@ -1,3 +1,4 @@ +-# @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) } |