Commit 404eee31 authored by Thong Kuah's avatar Thong Kuah 🌴

Merge branch 'sh-fix-dupe-approvals-failing' into 'master'

Fix error when duplicate users are merged in approvers list

Closes #13488

See merge request !17406
parents ebb9f2ce 6e4a4465
---
title: Fix error when duplicate users are merged in approvers list
merge_request: 17406
author:
type: fixed
......@@ -26,7 +26,7 @@ module ApprovalRules
def merge_group_members_into_users
merge_request.approval_rules.each do |rule|
rule.users += rule.group_users
rule.users |= rule.group_users
end
end
......
......@@ -94,6 +94,20 @@ describe ApprovalRules::FinalizeService do
expect(rule.approved_approvers).to contain_exactly(user3, group2_user)
expect(subject).not_to have_received(:copy_project_approval_rules)
end
# Test for https://gitlab.com/gitlab-org/gitlab/issues/13488
it 'gracefully merges duplicate users' do
group2.add_developer(user2)
expect do
subject.execute
end.not_to change { ApprovalMergeRequestRule.count }
rule = merge_request.approval_rules.regular.first
expect(rule.name).to eq('bar')
expect(rule.users).to contain_exactly(user2, user3, group2_user)
end
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