Move existing feature methods into Projects::BranchRule under conditional
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Once we have a basic model configured we need to be able to fetch the correct setting for the rule type. This includes
approval_project_rules
squash_option
external_status_checks
This needs to be behind a feature flag e.g.
def approval_project_rules
Feature.enabled?(:persisted_branch_rules)
case rule_type
when :default then protected_branch.approval_project_rules_with_unique_policies
when :all_branches
project.approval_rules.for_all_branches
when :all_protected_branches
project.approval_rules.for_all_protected_branches
end
else
protected_branch.approval_project_rules_with_unique_policies
end
end
Where protected_branch.approval_project_rules_with_unique_policies
is the original method from Projects::BranchRule
. If no method existed for BranchRule before merging all rule types we return nil
.
Edited by 🤖 GitLab Bot 🤖