Commit 83b2fa9c authored by Nick Thomas's avatar Nick Thomas

Merge branch...

Merge branch '9496-add-enable-self-approval-of-merge-requests-setting-to-merge-request-approvals-api' into 'master'

Add self approval of merge requests setting to Merge Request Approvals API

Closes #9496

See merge request gitlab-org/gitlab-ee!10050
parents 05e292d5 e4ccdc60
---
title: Add self approval of merge requests setting to merge requests approvals API
merge_request: 10050
author:
type: changed
......@@ -28,7 +28,8 @@ 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'
at_least_one_of :approvals_before_merge, :reset_approvals_on_push, :disable_overriding_approvers_per_merge_request
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
end
post '/' do
project_params = declared(params, include_missing: false, include_parent_namespaces: false)
......
......@@ -324,6 +324,7 @@ module EE
expose :approvals_before_merge
expose :reset_approvals_on_push
expose :disable_overriding_approvers_per_merge_request
expose :merge_requests_author_approval
end
class Approvals < Grape::Entity
......
......@@ -4,6 +4,7 @@
"approvals_before_merge": { "type": "integer" },
"disable_overriding_approvers_per_merge_request": { "type": ["boolean", "null"] },
"reset_approvals_on_push": { "type": "boolean" },
"merge_requests_author_approval": { "type": ["boolean", "null"] },
"approvers": {
"type": "array",
"items": {
......
......@@ -70,12 +70,14 @@ describe API::ProjectApprovals do
project.approvals_before_merge = 2
project.reset_approvals_on_push = false
project.disable_overriding_approvers_per_merge_request = true
project.merge_requests_author_approval = false
project.save
settings = {
approvals_before_merge: 4,
reset_approvals_on_push: true,
disable_overriding_approvers_per_merge_request: false
disable_overriding_approvers_per_merge_request: false,
merge_requests_author_approval: true
}
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