Remove unified code path in required count approval logic
Why
Since we've migrated the code unified approval rules there is no longer a need to include and test a code path like this:
in ee/app/models/ee/environment.rb
def required_approval_count
return 0 unless protected?
if has_approval_rules?
associated_approval_rules.sum(&:required_approvals)
else
associated_protected_environments.map(&:required_approval_count).max # we don't use this anymore
end
end
Deleting this supports the Epic to remove old code around this feature as well as make it simpler to improve the multi approval code.
Changes
Currently, if a protected environment
- has migrated unified approval rules
- those rules get deleted
- but the environment has a
required_approval_count
> 0
then the pending
logic falls back to that column even though we don't want to use it anymore. This prompts the users to approve, when if they 0 approval rules, it shouldn't be waiting for approval.
If we make the suggested change here, environments won't even consider the required_approval_count
Edited by Hunter Stewart