Skip to content

Resolve change approval configuration" API not allowing to change "approvals_required".

Mark Chao requested to merge 11887-mr-approvals_required into master

What does this MR do?

Currently, the legacy PUT approvals API endpoint still allows user to change approvals_required setting. However this only updates the merge request model's approvals_before_merge column. This value, after the new approval rule system is in operation, would only be used when approval rules are absent. If approval rule is present, the rule's own approvals_required is used.

So when approval rules are present, the user will be surprised to see after update, the approvals_required field returned by the API has no changed.

To hide this quirk, the merge request would try to simulate the affect of updating approvals_required as much as we can. It would instead update the rule's approvals_required if a MR rule is present.

In the case when project rule is present but MR rule is absent, the project rule will be copied over as MR rule, then the MR rule's approvals_required would be updated.

Does this MR meet the acceptance criteria?

Conformity

Performance and testing

Closes #11887 (closed)

Edited by Mark Chao

Merge request reports