Commit 689874c4 authored by Michael Kozono's avatar Michael Kozono

Merge branch 'id-fix-approve-button-visibility' into 'master'

Fix preventing approval of merge requests by an author

See merge request gitlab-org/gitlab-ee!11263
parents d7933637 480b6f8d
...@@ -140,8 +140,8 @@ class ApprovalState ...@@ -140,8 +140,8 @@ class ApprovalState
return false if approvals.where(user: user).any? return false if approvals.where(user: user).any?
# At this point, follow self-approval rules. Otherwise authors must # At this point, follow self-approval rules. Otherwise authors must
# have been in the list of unactioned_approvers to have been approved. # have been in the list of unactioned_approvers to have been approved.
return committers_can_approve? if merge_request.committers.include?(user) return false if !authors_can_approve? && merge_request.author == user
return authors_can_approve? if merge_request.author == user return false if !committers_can_approve? && merge_request.committers.include?(user)
true true
end end
......
---
title: Fix preventing approval of merge requests by an author
merge_request: 11263
author:
type: fixed
...@@ -608,10 +608,10 @@ describe ApprovalState do ...@@ -608,10 +608,10 @@ describe ApprovalState do
expect(subject.can_approve?(user)).to be_truthy expect(subject.can_approve?(user)).to be_truthy
end end
it 'allows the user to approve the MR if not within the approvers list' do it 'does not allow the user to approve the MR if not within the approvers list' do
allow(subject).to receive(:approvers).and_return([]) allow(subject).to receive(:approvers).and_return([])
expect(subject.can_approve?(user)).to be_truthy expect(subject.can_approve?(user)).to be_falsey
end end
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