Add a warning when approval settings may be affected by policies

What does this MR do and why?

Add a warning icon under Settings -> Merge requests -> Approval settings when there are policies overriding approval settings.

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before / No policies One policy Multiple policies
CleanShot_2024-12-10_at_14.27.19_2x CleanShot_2024-12-10_at_14.24.27_2x CleanShot_2024-12-10_at_14.25.41_2x

How to set up and validate locally

  1. Create a project
  2. In the project, create a policy which overrides approval settings:
    approval_policy:
      - name: Unsigned commit approvals
        description: ''
        enabled: false
        rules:
          - type: any_merge_request
            branch_type: protected
            commits: unsigned
        actions:
          - type: require_approval
            approvals_required: 1
            role_approvers:
              - developer
          - type: send_bot_message
            enabled: true
        approval_settings:
          block_branch_modification: true
          prevent_pushing_and_force_pushing: true
          prevent_approval_by_author: false
          prevent_approval_by_commit_author: true
          remove_approvals_with_new_commit: false
          require_password_to_approve: false
        fallback_behavior:
          fail: closed
    
  3. Go to Settings -> Merge requests and verify there's a warning icon in the Approval settings section and the link in the popover goes to the policy edit page
  4. Add another policy
  5. Verify that both policies show up
  6. Remove the approval_settings block from the YAML and verify that there's no warning

Related to #478175 (closed)

Merge request reports

Loading