Commit 77e76971 authored by Marc Shaw's avatar Marc Shaw

Reintroduce the feature flag for superseding code owner rule

Merge Request: gitlab.com/gitlab-org/gitlab/-/merge_requests/47897
Rollout Issue: gitlab.com/gitlab-org/gitlab/-/issues/262019
parent 871933eb
---
name: push_rules_supersede_code_owners
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/44126
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/262019
type: development
group: group::source code
default_enabled: true
...@@ -20,7 +20,8 @@ module EE ...@@ -20,7 +20,8 @@ module EE
end end
def validate_code_owners? def validate_code_owners?
return false if updated_from_web? || user_access.can_push_to_branch?(branch_name) return false if updated_from_web?
return false if ::Feature.enabled?(:push_rules_supersede_code_owners, project, default_enabled: true) && user_access.can_push_to_branch?(branch_name)
project.branch_requires_code_owner_approval?(branch_name) project.branch_requires_code_owner_approval?(branch_name)
end end
......
...@@ -60,6 +60,18 @@ RSpec.describe Gitlab::Checks::DiffCheck do ...@@ -60,6 +60,18 @@ RSpec.describe Gitlab::Checks::DiffCheck do
it 'returns false' do it 'returns false' do
expect(validate_code_owners).to eq(false) expect(validate_code_owners).to eq(false)
end end
context 'when push_rules_supersede_code_owners is disabled' do
before do
stub_feature_flags(push_rules_supersede_code_owners: false)
end
it 'returns branch_requires_code_owner_approval?' do
expect(project).to receive(:branch_requires_code_owner_approval?).and_return(true)
expect(validate_code_owners).to eq(true)
end
end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment