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
43b9141c
Commit
43b9141c
authored
Jul 08, 2017
by
Stan Hu
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'sh-optimize-mr-api' into 'master'
Remove many N+1 queries with merge requests API See merge request !12726
parents
42481d1b
b963d45c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
merge_request.rb
app/models/merge_request.rb
+1
-1
merge_requests.rb
lib/api/merge_requests.rb
+3
-1
No files found.
app/models/merge_request.rb
View file @
43b9141c
...
...
@@ -15,7 +15,7 @@ class MergeRequest < ActiveRecord::Base
has_many
:merge_request_diffs
has_one
:merge_request_diff
,
->
{
order
(
'merge_request_diffs.id DESC'
)
}
->
{
order
(
'merge_request_diffs.id DESC'
)
}
,
inverse_of: :merge_request
belongs_to
:head_pipeline
,
foreign_key:
"head_pipeline_id"
,
class_name:
"Ci::Pipeline"
...
...
lib/api/merge_requests.rb
View file @
43b9141c
...
...
@@ -41,7 +41,9 @@ module API
args
[
:milestone_title
]
=
args
.
delete
(
:milestone
)
args
[
:label_name
]
=
args
.
delete
(
:labels
)
merge_requests
=
MergeRequestsFinder
.
new
(
current_user
,
args
).
execute
.
inc_notes_with_associations
merge_requests
=
MergeRequestsFinder
.
new
(
current_user
,
args
).
execute
.
inc_notes_with_associations
.
preload
(
:target_project
,
:author
,
:assignee
,
:milestone
,
:merge_request_diff
)
merge_requests
.
reorder
(
args
[
:order_by
]
=>
args
[
:sort
])
end
...
...
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