Inherit project approval rules for merge request creation
What does this MR do and why?
Contributes to #388140 (closed)
Problem
We don't create approval rules for merge request unless they are explicitly provided by the user.
It currently works for creating MR via UI, because frontend provides a
list of approval rules in approval_rules_attributes
param.
It doesn't work for merge_request API endpoint, because we don't populate this attribute when it's not provided.
Solution
The code is complicated enough and requires a refactoring. The least
invacive approach is to generate approval_rules_attributes
list if it
was not provided.
That should ensure that MergeRequest::CreateService
will inherit
project approval rules even if the user didn't provide them.
How to set up and validate locally
- See comment: #388140 (comment 1335979022)
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.