BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
e805becf
Commit
e805becf
authored
Feb 23, 2016
by
Rubén Dávila
Browse files
Options
Browse Files
Download
Email Patches
Plain 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.
parent
37d92d0b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
4 deletions
+7
-4
global_milestone.rb
app/models/global_milestone.rb
+2
-2
show.html.haml
app/views/groups/milestones/show.html.haml
+1
-1
_issue.html.haml
app/views/shared/milestones/_issue.html.haml
+3
-1
_merge_request.html.haml
app/views/shared/milestones/_merge_request.html.haml
+1
-0
No files found.
app/models/global_milestone.rb
View file @
e805becf
...
...
@@ -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
...
...
app/views/groups/milestones/show.html.haml
View file @
e805becf
...
...
@@ -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
...
...
app/views/shared/milestones/_issue.html.haml
View file @
e805becf
-
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
...
...
app/views/shared/milestones/_merge_request.html.haml
View file @
e805becf
-# @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
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment