Commit 6192775c authored by Stan Hu's avatar Stan Hu

Merge branch 'hide-all-member-from-approver-list' into 'master'

Hide All members rule from approvers list

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