Commit 760538a7 authored by Marc Shaw's avatar Marc Shaw

Remove update_target_approvers feature flag

Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/238977
parent d9cba039
...@@ -37,17 +37,13 @@ module EE ...@@ -37,17 +37,13 @@ module EE
end end
def update_approvers_for_target_branch_merge_requests def update_approvers_for_target_branch_merge_requests
if update_target_approvers_features_enabled? && branch_protected? && code_owners_updated? if project.feature_available?(:code_owners) && branch_protected? && code_owners_updated?
merge_requests_for_target_branch.each do |merge_request| merge_requests_for_target_branch.each do |merge_request|
::MergeRequests::SyncCodeOwnerApprovalRules.new(merge_request).execute unless merge_request.on_train? ::MergeRequests::SyncCodeOwnerApprovalRules.new(merge_request).execute unless merge_request.on_train?
end end
end end
end end
def update_target_approvers_features_enabled?
::Feature.enabled?(:update_target_approvers, project) && project.feature_available?(:code_owners)
end
def branch_protected? def branch_protected?
project.branch_requires_code_owner_approval?(push.branch_name) project.branch_requires_code_owner_approval?(push.branch_name)
end end
......
---
title: Update merge requests approvers when code owners is updated
merge_request: 45290
author:
type: added
---
name: update_target_approvers
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/38575
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/238977
group: group::source code
type: development
default_enabled: false
...@@ -75,13 +75,11 @@ RSpec.describe MergeRequests::RefreshService do ...@@ -75,13 +75,11 @@ RSpec.describe MergeRequests::RefreshService do
subject { service.execute(oldrev, newrev, "refs/heads/master") } subject { service.execute(oldrev, newrev, "refs/heads/master") }
let(:enable_code_owner) { true } let(:enable_code_owner) { true }
let(:enable_target_approvers) { true }
let!(:protected_branch) { create(:protected_branch, name: 'master', project: project, code_owner_approval_required: true) } let!(:protected_branch) { create(:protected_branch, name: 'master', project: project, code_owner_approval_required: true) }
let(:newrev) { TestEnv::BRANCH_SHA['with-codeowners'] } let(:newrev) { TestEnv::BRANCH_SHA['with-codeowners'] }
before do before do
stub_feature_flags(update_target_approvers: enable_target_approvers, code_owners: enable_code_owner) stub_licensed_features(code_owner_approval_required: true, code_owners: enable_code_owner)
stub_licensed_features(code_owner_approval_required: true)
end end
context 'when the feature flags are enabled' do context 'when the feature flags are enabled' do
...@@ -133,14 +131,8 @@ RSpec.describe MergeRequests::RefreshService do ...@@ -133,14 +131,8 @@ RSpec.describe MergeRequests::RefreshService do
end end
end end
context 'when update_target_approvers is disabled' do
let(:enable_code_owner) { false }
it_behaves_like 'does not refresh the code owner rules'
end
context 'when code_owners is disabled' do context 'when code_owners is disabled' do
let(:enable_target_approvers) { false } let(:enable_code_owner) { false }
it_behaves_like 'does not refresh the code owner rules' it_behaves_like 'does not refresh the code owner rules'
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