Skip to content

Enable "inherit_approval_rules_on_creation" feature flag

Vasilii Iakliushin requested to merge 408218_enable_feature_flag into master

What does this MR do and why?

Contributes to #408218 (closed)

Enable "inherit_approval_rules_on_creation" feature flag

Previous MR: !118235 (merged)

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 expose of populate this attribute.

Solution

The code is complicated enough and requires a refactoring. The least invasive 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.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports