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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
dbd91a93
Commit
dbd91a93
authored
Jun 10, 2016
by
Patricio Cano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed documentation, corrected syntax, and added test scenario for Approvals API
parent
1955f4a1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
18 deletions
+21
-18
doc/api/merge_requests.md
doc/api/merge_requests.md
+8
-4
lib/api/entities.rb
lib/api/entities.rb
+2
-6
lib/api/merge_requests.rb
lib/api/merge_requests.rb
+9
-7
spec/requests/api/merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+2
-1
No files found.
doc/api/merge_requests.md
View file @
dbd91a93
...
...
@@ -498,8 +498,10 @@ GET /projects/:id/merge_requests/:merge_request_id/approvals
**Parameters:**
-
id (required) - The ID of a project
-
merge_request_id (required) - ID of MR
| Attribute | Type | Required | Description |
|--------------------|---------|----------|---------------------|
|
`id`
| integer | yes | The ID of a project |
|
`merge_request_id`
| integer | yes | The ID of MR |
```
json
{
...
...
@@ -542,8 +544,10 @@ POST /projects/:id/merge_requests/:merge_request_id/approvals
**Parameters:**
-
id (required) - The ID of a project
-
merge_request_id (required) - ID of MR
| Attribute | Type | Required | Description |
|--------------------|---------|----------|---------------------|
|
`id`
| integer | yes | The ID of a project |
|
`merge_request_id`
| integer | yes | The ID of MR |
```
json
{
...
...
lib/api/entities.rb
View file @
dbd91a93
...
...
@@ -222,12 +222,8 @@ module API
class
MergeRequestApprovals
<
ProjectEntity
expose
:merge_status
expose
:approvals_required
do
|
merge_request
,
_
|
merge_request
.
approvals_required
end
expose
:approvals_missing
do
|
merge_request
,
_
|
merge_request
.
approvals_left
end
expose
:approvals_required
expose
:approvals_left
expose
:approvals
,
as: :approved_by
,
using:
Entities
::
Approvals
end
...
...
lib/api/merge_requests.rb
View file @
dbd91a93
...
...
@@ -334,9 +334,10 @@ module API
end
# Get the status of the merge request's approvals
#
# Parameters:
# id (required)
- The ID of a project
# merge_request_id (required)
- ID of MR
# id (required) - The ID of a project
# merge_request_id (required) - ID of MR
# Examples:
# GET /projects/:id/merge_requests/:merge_request_id/approvals
#
...
...
@@ -348,9 +349,10 @@ module API
end
# Approve a merge request
#
# Parameters:
# id (required)
- The ID of a project
# merge_request_id (required)
- ID of MR
# id (required) - The ID of a project
# merge_request_id (required) - ID of MR
# Examples:
# POST /projects/:id/merge_requests/:merge_request_id/approvals
#
...
...
@@ -359,9 +361,9 @@ module API
unauthorized!
unless
merge_request
.
can_approve?
(
current_user
)
::
MergeRequests
::
ApprovalService
.
new
(
user_project
,
current_user
).
execute
(
merge_request
)
::
MergeRequests
::
ApprovalService
.
new
(
user_project
,
current_user
)
.
execute
(
merge_request
)
present
merge_request
,
with:
Entities
::
MergeRequestApprovals
,
current_user:
current_user
end
...
...
spec/requests/api/merge_requests_spec.rb
View file @
dbd91a93
...
...
@@ -616,7 +616,8 @@ describe API::API, api: true do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
id
}
/approve"
,
user
)
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
json_response
[
'approvals_required'
]).
to
eq
1
expect
(
json_response
[
'approvals_left'
]).
to
eq
(
1
)
expect
(
json_response
[
'approved_by'
][
0
][
'user'
][
'username'
]).
to
eq
(
user
.
username
)
end
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