Commit 83a59912 authored by Kerri Miller's avatar Kerri Miller

Remove skip_web_ui_code_owner_validations feature flag

parent c8d4dfba
...@@ -20,22 +20,11 @@ module EE ...@@ -20,22 +20,11 @@ module EE
end end
def validate_code_owners? def validate_code_owners?
return false if updated_from_web? && skip_web_ui_code_owner_validations? return false if updated_from_web?
project.branch_requires_code_owner_approval?(branch_name) project.branch_requires_code_owner_approval?(branch_name)
end end
# To allow self-hosted installations to ignore CODEOWNERS rules when
# clicking Merge in the UI. By default, these rules are not skipped.
#
# Issue to remove this feature flag:
# https://gitlab.com/gitlab-org/gitlab/-/issues/217427
def skip_web_ui_code_owner_validations?
return true unless ::Feature.enabled?(:use_legacy_codeowner_validations)
::Feature.enabled?(:skip_web_ui_code_owner_validations, project)
end
def validate_code_owners def validate_code_owners
lambda do |paths| lambda do |paths|
validator = ::Gitlab::CodeOwners::Validator.new(project, branch_name, paths) validator = ::Gitlab::CodeOwners::Validator.new(project, branch_name, paths)
......
...@@ -125,52 +125,12 @@ RSpec.describe Gitlab::Checks::DiffCheck do ...@@ -125,52 +125,12 @@ RSpec.describe Gitlab::Checks::DiffCheck do
expect(subject).to receive(:updated_from_web?).and_return(true) expect(subject).to receive(:updated_from_web?).and_return(true)
end end
context "when use_legacy_codeowner_validations is enabled" do
before do
stub_feature_flags(use_legacy_codeowner_validations: true)
end
context "when skip_web_ui_code_owner_validations is disabled" do
before do
stub_feature_flags(skip_web_ui_code_owner_validations: false)
allow(project).to receive(:branch_requires_code_owner_approval?)
.once.and_return(true)
end
it "returns an array of Proc(s)" do
validations = subject.send(:path_validations)
expect(validations.any?).to be_truthy
expect(validations.any? { |v| !v.is_a? Proc }).to be_falsy
end
context "when skip_web_ui_code_owner_validations is enabled" do
before do
stub_feature_flags(skip_web_ui_code_owner_validations: true)
expect(project).not_to receive(:branch_requires_code_owner_approval?)
end
it "returns an empty array" do
expect(subject.send(:path_validations)).to eq([])
end
end
end
end
context "when use_legacy_codeowner_validations is disabled" do
before do
stub_feature_flags(use_legacy_codeowner_validations: false)
expect(project).not_to receive(:branch_requires_code_owner_approval?)
end
it "returns an empty array" do it "returns an empty array" do
expect(subject.send(:path_validations)).to eq([]) expect(subject.send(:path_validations)).to eq([])
end end
end end
end end
end end
end
context 'file name rules' do context 'file name rules' do
# Notice that the commit used creates a file named 'README' # Notice that the commit used creates a file named 'README'
......
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