Use max of approvals_before_merge between project and MR at runtime
What does this MR do?
The original intention is for MR to always take the stricter approval_required count setting. So if project requires 2 approval, but MR sets 1, it should always require 2 approvals.
This MR uses max of approvals_before_merge
between project and MR at runtime.
Previously, MR#approvals_before_merge
is nil when it is <= project's value.
(from clamp_approvals_before_merge
). Then it would default to project setting if it is nil.
This changed in f480d145,
which would always persist a min value.
This caused regression that updating MR would fail if project's value is increased later on.
The relationship between value being nil and validation can be easily overlooked.
Removing validation and taking the max of the two makes logic clearer.
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation created/updated or follow-up review issue created -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Performance and testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- [-] Label as security and @ mention
@gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods - [-] Security reports checked/validated by a reviewer from the AppSec team
Closes #10055 (closed) Closes #10909 (closed)