Commit 877d351a authored by Douwe Maan's avatar Douwe Maan

Merge branch 'jramsay/committer-approval-api' into 'master'

Add committer approval API attribute

Closes gitlab-ce#61796

See merge request gitlab-org/gitlab-ee!15019
parents 648fb0e8 23a98653
---
title: Add missing merge request committer approval setting to API
merge_request: 15019
author: jramsay
type: changed
......@@ -28,8 +28,9 @@ module API
optional :approvals_before_merge, type: Integer, desc: 'The amount of approvals required before an MR can be merged'
optional :reset_approvals_on_push, type: Boolean, desc: 'Should the approval count be reset on a new push'
optional :disable_overriding_approvers_per_merge_request, type: Boolean, desc: 'Should MRs be able to override approvers and approval count'
optional :merge_requests_author_approval, type: Boolean, desc: 'Should authors be able to self approve merge requests'
at_least_one_of :approvals_before_merge, :reset_approvals_on_push, :disable_overriding_approvers_per_merge_request, :merge_requests_author_approval
optional :merge_requests_author_approval, type: Boolean, desc: 'Should merge request authors be able to self approve merge requests; `true` means authors cannot self approve'
optional :merge_requests_disable_committers_approval, type: Boolean, desc: 'Should committers be able to self approve merge requests'
at_least_one_of :approvals_before_merge, :reset_approvals_on_push, :disable_overriding_approvers_per_merge_request, :merge_requests_author_approval, :merge_requests_disable_committers_approval
end
post '/' do
project_params = declared(params, include_missing: false, include_parent_namespaces: false)
......
......@@ -367,6 +367,7 @@ module EE
expose :reset_approvals_on_push
expose :disable_overriding_approvers_per_merge_request
expose :merge_requests_author_approval
expose :merge_requests_disable_committers_approval
end
class Approvals < Grape::Entity
......
......@@ -5,6 +5,7 @@
"disable_overriding_approvers_per_merge_request": { "type": ["boolean", "null"] },
"reset_approvals_on_push": { "type": "boolean" },
"merge_requests_author_approval": { "type": ["boolean", "null"] },
"merge_requests_disable_committers_approval": { "type": ["boolean", "null"] },
"approvers": {
"type": "array",
"items": {
......
......@@ -66,13 +66,15 @@ describe API::ProjectApprovals do
project.reset_approvals_on_push = false
project.disable_overriding_approvers_per_merge_request = true
project.merge_requests_author_approval = false
project.merge_requests_disable_committers_approval = true
project.save
settings = {
approvals_before_merge: 4,
reset_approvals_on_push: true,
disable_overriding_approvers_per_merge_request: false,
merge_requests_author_approval: true
merge_requests_author_approval: true,
merge_requests_disable_committers_approval: false
}
post api(url, current_user), params: settings
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment