Skip to content

Show the merge_request approval_rules when merge request is merged

What does this MR do and why?

In this MR, we want to use the ApprovalMergeRequestRules when the merge request is merged, and not project rules. Once merged, these rules are 'finalized', where either they are created to match the project rules, or the users/users in groups are aligned. Therefore we want to use these when merged as they represent the state at time of merge.

The original problem is that sometimes we used the project rules, which would give the incorrect approval rules state on the MR page, but compounding this, we have older merge requests in very different states, which we can not backfill, as we do not have that data any more. Therefore, if the rule is invalid, we remove it from the list to fix these historical cases.

To test:

  1. For a project [ddd an approval rule])[https://docs.gitlab.com/ee/user/project/merge_requests/approvals/rules.html#add-an-approval-rule] specifying a group of users
  2. Create a MR and approve using a user from the specified group
  3. Merge the MR
  4. Remove the approving user from the group
  5. Browse to the MR
  6. You should see the rule there - even though it is invalid
  7. Turn on feature flag use_merge_approval_rules_when_merged - Reload and the rule should not be invalid

Related to #420638 (closed)

Edited by Marc Shaw

Merge request reports

Loading