Skip to content

Implement EE extension for BranchRules::DestroyService

Joe Woodward requested to merge feat/branch_rule-ee-destroy_service into master

What does this MR do and why?

Implement EE extension for BranchRules::DestroyService

In EE we have 2 additional branch rule classes, Projects::AllBranchesRule and Projects::AllProtectedBranchesRule. This change adds an EE extension to handle destroying those rules.

We use the existing service classes to destroy the records and return a ServiceResponse.

This change also includes a BaseService extension to delegate approval_project_rules and external_status_checks to the branch_rule.

We have changed the logic in CE to check if the branch_rule.is_a?(Projects::BranchRule) as is_a? includes ancestors. Now using instance_of? to be more accurate. Without this change Projects::AllBranchesRule and Projects::AllProtectedBranchesRule would also return true as they are decendents of Projects::BranchRule.

Includes new trait for approval_project_rule factory :for_all_protected_branches.

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 After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Merge request reports