Skip to content

Create Projects::BranchRules::MergeRequestApprovalSetting model

Part of Allow setting approval settings per protected b... (#503805 - closed)

To enable adding approval settings for a protected branch we need to build out the models to store the settings.

The scope for this is limited to protected branches and All branches. We will not support All protected branches in the first iteration.

image

Currently these settings are stored in 2 places, the project and the project settings. This can be seen in the update service

https://gitlab.com/gitlab-org/gitlab/-/blob/19215ebf7ec2be965582afcace84f25b10efef69/ee/app/services/merge_request_approval_settings/update_service.rb#L41-49

Currently the attributes are named:

  merge_requests_author_approval
  merge_requests_disable_committers_approval
  disable_overriding_approvers_per_merge_request
  reset_approvals_on_push
  require_reauthentication_to_approve
  selective_code_owner_removals

However, given we are moving them into a dedicated table we should rename these

  1. prevent_author_approval boolean, default false, null false
  2. prevent_committer_approval boolean, deafult false, null false
  3. prevent_editing_approval_rules boolean, default false, null false
  4. require_reauthentication_to_approve boolean, default false, null false
  5. approval_removals -> enum { none: 0, all: 1, code_owners: 2 } default all, null false code owners is default false so we are currently defaulting to all approvals removed on push.

The model should optionally belong to a protected_branch

Edited by Joe Woodward