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 ...@@ -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 :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 :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 :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 end
post '/' do post '/' do
project_params = declared(params, include_missing: false, include_parent_namespaces: false) project_params = declared(params, include_missing: false, include_parent_namespaces: false)
......
...@@ -324,6 +324,7 @@ module EE ...@@ -324,6 +324,7 @@ module EE
expose :approvals_before_merge expose :approvals_before_merge
expose :reset_approvals_on_push expose :reset_approvals_on_push
expose :disable_overriding_approvers_per_merge_request expose :disable_overriding_approvers_per_merge_request
expose :merge_requests_author_approval
end end
class Approvals < Grape::Entity class Approvals < Grape::Entity
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
"approvals_before_merge": { "type": "integer" }, "approvals_before_merge": { "type": "integer" },
"disable_overriding_approvers_per_merge_request": { "type": ["boolean", "null"] }, "disable_overriding_approvers_per_merge_request": { "type": ["boolean", "null"] },
"reset_approvals_on_push": { "type": "boolean" }, "reset_approvals_on_push": { "type": "boolean" },
"merge_requests_author_approval": { "type": ["boolean", "null"] },
"approvers": { "approvers": {
"type": "array", "type": "array",
"items": { "items": {
......
...@@ -70,12 +70,14 @@ describe API::ProjectApprovals do ...@@ -70,12 +70,14 @@ describe API::ProjectApprovals do
project.approvals_before_merge = 2 project.approvals_before_merge = 2
project.reset_approvals_on_push = false project.reset_approvals_on_push = false
project.disable_overriding_approvers_per_merge_request = true project.disable_overriding_approvers_per_merge_request = true
project.merge_requests_author_approval = false
project.save project.save
settings = { settings = {
approvals_before_merge: 4, approvals_before_merge: 4,
reset_approvals_on_push: true, 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 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