Commit 871381cd authored by Sean McGivern's avatar Sean McGivern

fixup! Prevent author from approving their own MR

parent f8908e68
...@@ -658,7 +658,7 @@ class MergeRequest < ActiveRecord::Base ...@@ -658,7 +658,7 @@ class MergeRequest < ActiveRecord::Base
def approver_ids=(value) def approver_ids=(value)
value.split(",").map(&:strip).each do |user_id| value.split(",").map(&:strip).each do |user_id|
next if user_id == author.id next if author && user_id == author.id
approvers.find_or_initialize_by(user_id: user_id, target_id: id) approvers.find_or_initialize_by(user_id: user_id, target_id: id)
end end
......
...@@ -327,7 +327,7 @@ Feature: Project Merge Requests ...@@ -327,7 +327,7 @@ Feature: Project Merge Requests
And I click link "Bug NS-04" And I click link "Bug NS-04"
And I should not see merge button And I should not see merge button
When I click link "Approve" When I click link "Approve"
Then I should see message that merge request can be merged Then I should see approved merge request "Bug NS-04"
Scenario: I can not approve merge request if I am not an approver Scenario: I can not approve merge request if I am not an approver
Given merge request 'Bug NS-04' must be approved by some user Given merge request 'Bug NS-04' must be approved by some user
......
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