Commit e7683932 authored by James Fargher's avatar James Fargher

Merge branch '227853-remove-2-code-owner-feature-flags' into 'master'

Remove :skip_web_ui_code_owner_validations feature flag

See merge request gitlab-org/gitlab!37367
parents 6ac2167a f04c8734
---
title: Remove :skip_web_ui_code_owner_validations feature flag
merge_request: 37367
author:
type: other
......@@ -20,22 +20,11 @@ module EE
end
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)
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
lambda do |paths|
validator = ::Gitlab::CodeOwners::Validator.new(project, branch_name, paths)
......
......@@ -125,48 +125,8 @@ RSpec.describe Gitlab::Checks::DiffCheck do
expect(subject).to receive(:updated_from_web?).and_return(true)
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
expect(subject.send(:path_validations)).to eq([])
end
it "returns an empty array" do
expect(subject.send(:path_validations)).to eq([])
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