Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
34e8d972
Commit
34e8d972
authored
Nov 05, 2018
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose {closed,merged}_{at,by} in merge requests API index
parent
90473e06
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
93 additions
and
29 deletions
+93
-29
changelogs/unreleased/dm-api-merge-requests-index-merged-at.yml
...logs/unreleased/dm-api-merge-requests-index-merged-at.yml
+5
-0
doc/api/merge_requests.md
doc/api/merge_requests.md
+44
-11
lib/api/entities.rb
lib/api/entities.rb
+16
-16
lib/api/issues.rb
lib/api/issues.rb
+1
-1
lib/api/merge_requests.rb
lib/api/merge_requests.rb
+1
-1
spec/fixtures/api/schemas/public_api/v4/merge_requests.json
spec/fixtures/api/schemas/public_api/v4/merge_requests.json
+26
-0
No files found.
changelogs/unreleased/dm-api-merge-requests-index-merged-at.yml
0 → 100644
View file @
34e8d972
---
title
:
Expose {closed,merged}_{at,by} in merge requests API index
merge_request
:
author
:
type
:
changed
doc/api/merge_requests.md
View file @
34e8d972
...
@@ -57,7 +57,18 @@ Parameters:
...
@@ -57,7 +57,18 @@ Parameters:
"project_id"
:
3
,
"project_id"
:
3
,
"title"
:
"test1"
,
"title"
:
"test1"
,
"description"
:
"fixed login page css paddings"
,
"description"
:
"fixed login page css paddings"
,
"state"
:
"opened"
,
"state"
:
"merged"
,
"merged_by"
:
{
"id"
:
87854
,
"name"
:
"Douwe Maan"
,
"username"
:
"DouweM"
,
"state"
:
"active"
,
"avatar_url"
:
"https://gitlab.example.com/uploads/-/system/user/avatar/87854/avatar.png"
,
"web_url"
:
"https://gitlab.com/DouweM"
},
"merged_at"
:
"2018-09-07T11:16:17.520Z"
,
"closed_by"
:
null
,
"closed_at"
:
null
,
"created_at"
:
"2017-04-29T08:46:00Z"
,
"created_at"
:
"2017-04-29T08:46:00Z"
,
"updated_at"
:
"2017-04-29T08:46:00Z"
,
"updated_at"
:
"2017-04-29T08:46:00Z"
,
"target_branch"
:
"master"
,
"target_branch"
:
"master"
,
...
@@ -180,7 +191,18 @@ Parameters:
...
@@ -180,7 +191,18 @@ Parameters:
"project_id"
:
3
,
"project_id"
:
3
,
"title"
:
"test1"
,
"title"
:
"test1"
,
"description"
:
"fixed login page css paddings"
,
"description"
:
"fixed login page css paddings"
,
"state"
:
"opened"
,
"state"
:
"merged"
,
"merged_by"
:
{
"id"
:
87854
,
"name"
:
"Douwe Maan"
,
"username"
:
"DouweM"
,
"state"
:
"active"
,
"avatar_url"
:
"https://gitlab.example.com/uploads/-/system/user/avatar/87854/avatar.png"
,
"web_url"
:
"https://gitlab.com/DouweM"
},
"merged_at"
:
"2018-09-07T11:16:17.520Z"
,
"closed_by"
:
null
,
"closed_at"
:
null
,
"created_at"
:
"2017-04-29T08:46:00Z"
,
"created_at"
:
"2017-04-29T08:46:00Z"
,
"updated_at"
:
"2017-04-29T08:46:00Z"
,
"updated_at"
:
"2017-04-29T08:46:00Z"
,
"target_branch"
:
"master"
,
"target_branch"
:
"master"
,
...
@@ -293,7 +315,18 @@ Parameters:
...
@@ -293,7 +315,18 @@ Parameters:
"project_id"
:
3
,
"project_id"
:
3
,
"title"
:
"test1"
,
"title"
:
"test1"
,
"description"
:
"fixed login page css paddings"
,
"description"
:
"fixed login page css paddings"
,
"state"
:
"opened"
,
"state"
:
"merged"
,
"merged_by"
:
{
"id"
:
87854
,
"name"
:
"Douwe Maan"
,
"username"
:
"DouweM"
,
"state"
:
"active"
,
"avatar_url"
:
"https://gitlab.example.com/uploads/-/system/user/avatar/87854/avatar.png"
,
"web_url"
:
"https://gitlab.com/DouweM"
},
"merged_at"
:
"2018-09-07T11:16:17.520Z"
,
"closed_by"
:
null
,
"closed_at"
:
null
,
"created_at"
:
"2017-04-29T08:46:00Z"
,
"created_at"
:
"2017-04-29T08:46:00Z"
,
"updated_at"
:
"2017-04-29T08:46:00Z"
,
"updated_at"
:
"2017-04-29T08:46:00Z"
,
"target_branch"
:
"master"
,
"target_branch"
:
"master"
,
...
@@ -383,7 +416,7 @@ Parameters:
...
@@ -383,7 +416,7 @@ Parameters:
"project_id"
:
3
,
"project_id"
:
3
,
"title"
:
"test1"
,
"title"
:
"test1"
,
"description"
:
"fixed login page css paddings"
,
"description"
:
"fixed login page css paddings"
,
"state"
:
"
open
ed"
,
"state"
:
"
merg
ed"
,
"created_at"
:
"2017-04-29T08:46:00Z"
,
"created_at"
:
"2017-04-29T08:46:00Z"
,
"updated_at"
:
"2017-04-29T08:46:00Z"
,
"updated_at"
:
"2017-04-29T08:46:00Z"
,
"target_branch"
:
"master"
,
"target_branch"
:
"master"
,
...
@@ -695,7 +728,7 @@ POST /projects/:id/merge_requests
...
@@ -695,7 +728,7 @@ POST /projects/:id/merge_requests
"project_id"
:
3
,
"project_id"
:
3
,
"title"
:
"test1"
,
"title"
:
"test1"
,
"description"
:
"fixed login page css paddings"
,
"description"
:
"fixed login page css paddings"
,
"state"
:
"
open
ed"
,
"state"
:
"
merg
ed"
,
"created_at"
:
"2017-04-29T08:46:00Z"
,
"created_at"
:
"2017-04-29T08:46:00Z"
,
"updated_at"
:
"2017-04-29T08:46:00Z"
,
"updated_at"
:
"2017-04-29T08:46:00Z"
,
"target_branch"
:
"master"
,
"target_branch"
:
"master"
,
...
@@ -822,7 +855,7 @@ Must include at least one non-required attribute from above.
...
@@ -822,7 +855,7 @@ Must include at least one non-required attribute from above.
"project_id"
:
3
,
"project_id"
:
3
,
"title"
:
"test1"
,
"title"
:
"test1"
,
"description"
:
"fixed login page css paddings"
,
"description"
:
"fixed login page css paddings"
,
"state"
:
"
open
ed"
,
"state"
:
"
merg
ed"
,
"created_at"
:
"2017-04-29T08:46:00Z"
,
"created_at"
:
"2017-04-29T08:46:00Z"
,
"updated_at"
:
"2017-04-29T08:46:00Z"
,
"updated_at"
:
"2017-04-29T08:46:00Z"
,
"target_branch"
:
"master"
,
"target_branch"
:
"master"
,
...
@@ -965,7 +998,7 @@ Parameters:
...
@@ -965,7 +998,7 @@ Parameters:
"project_id"
:
3
,
"project_id"
:
3
,
"title"
:
"test1"
,
"title"
:
"test1"
,
"description"
:
"fixed login page css paddings"
,
"description"
:
"fixed login page css paddings"
,
"state"
:
"
open
ed"
,
"state"
:
"
merg
ed"
,
"created_at"
:
"2017-04-29T08:46:00Z"
,
"created_at"
:
"2017-04-29T08:46:00Z"
,
"updated_at"
:
"2017-04-29T08:46:00Z"
,
"updated_at"
:
"2017-04-29T08:46:00Z"
,
"target_branch"
:
"master"
,
"target_branch"
:
"master"
,
...
@@ -1080,7 +1113,7 @@ Parameters:
...
@@ -1080,7 +1113,7 @@ Parameters:
"project_id"
:
3
,
"project_id"
:
3
,
"title"
:
"test1"
,
"title"
:
"test1"
,
"description"
:
"fixed login page css paddings"
,
"description"
:
"fixed login page css paddings"
,
"state"
:
"
open
ed"
,
"state"
:
"
merg
ed"
,
"created_at"
:
"2017-04-29T08:46:00Z"
,
"created_at"
:
"2017-04-29T08:46:00Z"
,
"updated_at"
:
"2017-04-29T08:46:00Z"
,
"updated_at"
:
"2017-04-29T08:46:00Z"
,
"target_branch"
:
"master"
,
"target_branch"
:
"master"
,
...
@@ -1279,7 +1312,7 @@ Example response:
...
@@ -1279,7 +1312,7 @@ Example response:
"project_id"
:
3
,
"project_id"
:
3
,
"title"
:
"test1"
,
"title"
:
"test1"
,
"description"
:
"fixed login page css paddings"
,
"description"
:
"fixed login page css paddings"
,
"state"
:
"
open
ed"
,
"state"
:
"
merg
ed"
,
"created_at"
:
"2017-04-29T08:46:00Z"
,
"created_at"
:
"2017-04-29T08:46:00Z"
,
"updated_at"
:
"2017-04-29T08:46:00Z"
,
"updated_at"
:
"2017-04-29T08:46:00Z"
,
"target_branch"
:
"master"
,
"target_branch"
:
"master"
,
...
@@ -1400,7 +1433,7 @@ Example response:
...
@@ -1400,7 +1433,7 @@ Example response:
"project_id"
:
3
,
"project_id"
:
3
,
"title"
:
"test1"
,
"title"
:
"test1"
,
"description"
:
"fixed login page css paddings"
,
"description"
:
"fixed login page css paddings"
,
"state"
:
"
open
ed"
,
"state"
:
"
merg
ed"
,
"created_at"
:
"2017-04-29T08:46:00Z"
,
"created_at"
:
"2017-04-29T08:46:00Z"
,
"updated_at"
:
"2017-04-29T08:46:00Z"
,
"updated_at"
:
"2017-04-29T08:46:00Z"
,
"target_branch"
:
"master"
,
"target_branch"
:
"master"
,
...
@@ -1540,7 +1573,7 @@ Example response:
...
@@ -1540,7 +1573,7 @@ Example response:
"project_id"
:
3
,
"project_id"
:
3
,
"title"
:
"Et voluptas laudantium minus nihil recusandae ut accusamus earum aut non."
,
"title"
:
"Et voluptas laudantium minus nihil recusandae ut accusamus earum aut non."
,
"description"
:
"Veniam sunt nihil modi earum cumque illum delectus. Nihil ad quis distinctio quia. Autem eligendi at quibusdam repellendus."
,
"description"
:
"Veniam sunt nihil modi earum cumque illum delectus. Nihil ad quis distinctio quia. Autem eligendi at quibusdam repellendus."
,
"state"
:
"
open
ed"
,
"state"
:
"
merg
ed"
,
"created_at"
:
"2016-06-17T07:48:04.330Z"
,
"created_at"
:
"2016-06-17T07:48:04.330Z"
,
"updated_at"
:
"2016-07-01T11:14:15.537Z"
,
"updated_at"
:
"2016-07-01T11:14:15.537Z"
,
"target_branch"
:
"allow_regex_for_project_skip_ref"
,
"target_branch"
:
"allow_regex_for_project_skip_ref"
,
...
...
lib/api/entities.rb
View file @
34e8d972
...
@@ -607,6 +607,22 @@ module API
...
@@ -607,6 +607,22 @@ module API
end
end
class
MergeRequestBasic
<
ProjectEntity
class
MergeRequestBasic
<
ProjectEntity
expose
:merged_by
,
using:
Entities
::
UserBasic
do
|
merge_request
,
_options
|
merge_request
.
metrics
&
.
merged_by
end
expose
:merged_at
do
|
merge_request
,
_options
|
merge_request
.
metrics
&
.
merged_at
end
expose
:closed_by
,
using:
Entities
::
UserBasic
do
|
merge_request
,
_options
|
merge_request
.
metrics
&
.
latest_closed_by
end
expose
:closed_at
do
|
merge_request
,
_options
|
merge_request
.
metrics
&
.
latest_closed_at
end
expose
:title_html
,
if:
->
(
_
,
options
)
{
options
[
:render_html
]
}
do
|
entity
|
expose
:title_html
,
if:
->
(
_
,
options
)
{
options
[
:render_html
]
}
do
|
entity
|
MarkupHelper
.
markdown_field
(
entity
,
:title
)
MarkupHelper
.
markdown_field
(
entity
,
:title
)
end
end
...
@@ -676,22 +692,6 @@ module API
...
@@ -676,22 +692,6 @@ module API
merge_request
.
merge_request_diff
.
real_size
merge_request
.
merge_request_diff
.
real_size
end
end
expose
:merged_by
,
using:
Entities
::
UserBasic
do
|
merge_request
,
_options
|
merge_request
.
metrics
&
.
merged_by
end
expose
:merged_at
do
|
merge_request
,
_options
|
merge_request
.
metrics
&
.
merged_at
end
expose
:closed_by
,
using:
Entities
::
UserBasic
do
|
merge_request
,
_options
|
merge_request
.
metrics
&
.
latest_closed_by
end
expose
:closed_at
do
|
merge_request
,
_options
|
merge_request
.
metrics
&
.
latest_closed_at
end
expose
:latest_build_started_at
,
if:
->
(
_
,
options
)
{
build_available?
(
options
)
}
do
|
merge_request
,
_options
|
expose
:latest_build_started_at
,
if:
->
(
_
,
options
)
{
build_available?
(
options
)
}
do
|
merge_request
,
_options
|
merge_request
.
metrics
&
.
latest_build_started_at
merge_request
.
metrics
&
.
latest_build_started_at
end
end
...
...
lib/api/issues.rb
View file @
34e8d972
...
@@ -28,7 +28,7 @@ module API
...
@@ -28,7 +28,7 @@ module API
args
[
:scope
]
=
args
[
:scope
].
underscore
if
args
[
:scope
]
args
[
:scope
]
=
args
[
:scope
].
underscore
if
args
[
:scope
]
issues
=
IssuesFinder
.
new
(
current_user
,
args
).
execute
issues
=
IssuesFinder
.
new
(
current_user
,
args
).
execute
.
preload
(
:assignees
,
:labels
,
:notes
,
:timelogs
,
:project
,
:author
)
.
preload
(
:assignees
,
:labels
,
:notes
,
:timelogs
,
:project
,
:author
,
:closed_by
)
issues
.
reorder
(
args
[
:order_by
]
=>
args
[
:sort
])
issues
.
reorder
(
args
[
:order_by
]
=>
args
[
:sort
])
end
end
...
...
lib/api/merge_requests.rb
View file @
34e8d972
...
@@ -45,7 +45,7 @@ module API
...
@@ -45,7 +45,7 @@ module API
return
merge_requests
if
args
[
:view
]
==
'simple'
return
merge_requests
if
args
[
:view
]
==
'simple'
merge_requests
merge_requests
.
preload
(
:notes
,
:author
,
:assignee
,
:milestone
,
:latest_merge_request_diff
,
:labels
,
:timelogs
)
.
preload
(
:notes
,
:author
,
:assignee
,
:milestone
,
:latest_merge_request_diff
,
:labels
,
:timelogs
,
metrics:
[
:latest_closed_by
,
:merged_by
]
)
end
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: enable CodeReuse/ActiveRecord
...
...
spec/fixtures/api/schemas/public_api/v4/merge_requests.json
View file @
34e8d972
...
@@ -9,6 +9,32 @@
...
@@ -9,6 +9,32 @@
"title"
:
{
"type"
:
"string"
},
"title"
:
{
"type"
:
"string"
},
"description"
:
{
"type"
:
[
"string"
,
"null"
]
},
"description"
:
{
"type"
:
[
"string"
,
"null"
]
},
"state"
:
{
"type"
:
"string"
},
"state"
:
{
"type"
:
"string"
},
"merged_by"
:
{
"type"
:
[
"object"
,
"null"
],
"properties"
:
{
"name"
:
{
"type"
:
"string"
},
"username"
:
{
"type"
:
"string"
},
"id"
:
{
"type"
:
"integer"
},
"state"
:
{
"type"
:
"string"
},
"avatar_url"
:
{
"type"
:
"uri"
},
"web_url"
:
{
"type"
:
"uri"
}
},
"additionalProperties"
:
false
},
"merged_at"
:
{
"type"
:
[
"date"
,
"null"
]
},
"closed_by"
:
{
"type"
:
[
"object"
,
"null"
],
"properties"
:
{
"name"
:
{
"type"
:
"string"
},
"username"
:
{
"type"
:
"string"
},
"id"
:
{
"type"
:
"integer"
},
"state"
:
{
"type"
:
"string"
},
"avatar_url"
:
{
"type"
:
"uri"
},
"web_url"
:
{
"type"
:
"uri"
}
},
"additionalProperties"
:
false
},
"closed_at"
:
{
"type"
:
[
"date"
,
"null"
]
},
"created_at"
:
{
"type"
:
"date"
},
"created_at"
:
{
"type"
:
"date"
},
"updated_at"
:
{
"type"
:
"date"
},
"updated_at"
:
{
"type"
:
"date"
},
"target_branch"
:
{
"type"
:
"string"
},
"target_branch"
:
{
"type"
:
"string"
},
...
...
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