Commit 2b538728 authored by Igor's avatar Igor Committed by Stan Hu

Hide All members rule from approvers list

parent ea6aa216
......@@ -78,7 +78,7 @@ class ApprovalMergeRequestRule < ApplicationRecord
# Temporary override to handle legacy records that have not yet been migrated
# To be removed with https://gitlab.com/gitlab-org/gitlab/issues/11834
def regular?
read_attribute(:rule_type) == 'regular' || (!report_approver? && !code_owner)
read_attribute(:rule_type) == 'regular' || (!report_approver? && !code_owner && !any_approver?)
end
alias_method :regular, :regular?
......
......@@ -8,9 +8,9 @@ module DeprecatedApprovalsBeforeMerge
included do
after_save do
next unless saved_changes['approvals_before_merge']
run_after_commit do
next unless saved_changes['approvals_before_merge']
update_any_approver_rule
end
end
......
......@@ -191,6 +191,13 @@ describe ApprovalMergeRequestRule do
expect(subject.regular).to eq(false)
expect(subject.regular?).to eq(false)
end
it 'returns false for any approver records' do
subject = create(:approval_merge_request_rule, merge_request: merge_request, rule_type: :any_approver)
expect(subject.regular).to eq(false)
expect(subject.regular?).to eq(false)
end
end
describe '#code_owner?' do
......
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