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
794f3e88
Commit
794f3e88
authored
Nov 08, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ee into ce_upstream
parents
a6218748
b65089b9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
1 deletion
+19
-1
changelogs/unreleased-ee/approvals_required_api.yml
changelogs/unreleased-ee/approvals_required_api.yml
+4
-0
lib/api/entities.rb
lib/api/entities.rb
+3
-0
lib/api/projects.rb
lib/api/projects.rb
+3
-1
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+9
-0
No files found.
changelogs/unreleased-ee/approvals_required_api.yml
0 → 100644
View file @
794f3e88
---
title
:
Add ability to set approvals_before_merge for project through the API
merge_request
:
author
:
lib/api/entities.rb
View file @
794f3e88
...
...
@@ -107,6 +107,7 @@ module API
expose
:only_allow_merge_if_build_succeeds
expose
:request_access_enabled
expose
:only_allow_merge_if_all_discussions_are_resolved
expose
:approvals_before_merge
end
class
Member
<
UserBasic
...
...
@@ -263,9 +264,11 @@ module API
expose
:merge_status
expose
:diff_head_sha
,
as: :sha
expose
:merge_commit_sha
expose
:subscribed
do
|
merge_request
,
options
|
merge_request
.
subscribed?
(
options
[
:current_user
])
end
expose
:user_notes_count
expose
:approvals_before_merge
expose
:should_remove_source_branch?
,
as: :should_remove_source_branch
...
...
lib/api/projects.rb
View file @
794f3e88
...
...
@@ -263,6 +263,7 @@ module API
# public_builds (optional)
# repository_storage (optional)
# lfs_enabled (optional)
# approvals_before_merge (optional) - how many approvers should approve merge request by default
# Example Request
# PUT /projects/:id
put
':id'
do
...
...
@@ -284,7 +285,8 @@ module API
:snippets_enabled
,
:visibility_level
,
:wiki_enabled
,
:only_allow_merge_if_all_discussions_are_resolved
]
:only_allow_merge_if_all_discussions_are_resolved
,
:approvals_before_merge
]
attrs
=
map_public_to_visibility_level
(
attrs
)
authorize_admin_project
authorize!
:rename_project
,
user_project
if
attrs
[
:name
].
present?
...
...
spec/requests/api/projects_spec.rb
View file @
794f3e88
...
...
@@ -981,6 +981,15 @@ describe API::API, api: true do
expect
(
json_response
[
'request_access_enabled'
]).
to
eq
(
false
)
end
it
'updates approvals_before_merge'
do
project_param
=
{
approvals_before_merge:
3
}
put
api
(
"/projects/
#{
project
.
id
}
"
,
user
),
project_param
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
[
'approvals_before_merge'
]).
to
eq
(
3
)
end
it
'updates path & name to existing path & name in different namespace'
do
project_param
=
{
path:
project4
.
path
,
name:
project4
.
name
}
put
api
(
"/projects/
#{
project3
.
id
}
"
,
user
),
project_param
...
...
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