Commit 6b0c3a59 authored by Patrick Bajao's avatar Patrick Bajao

Merge branch 'remove_update_target_approvers_feature_flag' into 'master'

Remove update_target_approvers feature flag

See merge request gitlab-org/gitlab!45290
parents cca8ad43 760538a7
......@@ -37,17 +37,13 @@ module EE
end
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|
::MergeRequests::SyncCodeOwnerApprovalRules.new(merge_request).execute unless merge_request.on_train?
end
end
end
def update_target_approvers_features_enabled?
::Feature.enabled?(:update_target_approvers, project) && project.feature_available?(:code_owners)
end
def branch_protected?
project.branch_requires_code_owner_approval?(push.branch_name)
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
subject { service.execute(oldrev, newrev, "refs/heads/master") }
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(:newrev) { TestEnv::BRANCH_SHA['with-codeowners'] }
before do
stub_feature_flags(update_target_approvers: enable_target_approvers, code_owners: enable_code_owner)
stub_licensed_features(code_owner_approval_required: true)
stub_licensed_features(code_owner_approval_required: true, code_owners: enable_code_owner)
end
context 'when the feature flags are enabled' do
......@@ -133,14 +131,8 @@ RSpec.describe MergeRequests::RefreshService do
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
let(:enable_target_approvers) { false }
let(:enable_code_owner) { false }
it_behaves_like 'does not refresh the code owner rules'
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