Fix body of email when commits are pushed to an MR
This was sending the current user, which is the recipient! It should be the user who pushed the commits.
This commit is contained in:
parent
98278abd59
commit
682eb75834
4 changed files with 34 additions and 3 deletions
|
@ -15,6 +15,7 @@ module Emails
|
|||
setup_merge_request_mail(merge_request_id, recipient_id)
|
||||
@new_commits = new_commits
|
||||
@existing_commits = existing_commits
|
||||
@updated_by_user = User.find(updated_by_user_id)
|
||||
|
||||
mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, recipient_id, reason))
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
%h3
|
||||
New commits were pushed to the merge request
|
||||
= @updated_by_user.name
|
||||
pushed new commits to merge request
|
||||
= link_to(@merge_request.to_reference, project_merge_request_url(@merge_request.target_project, @merge_request))
|
||||
by #{@current_user.name}
|
||||
|
||||
- if @existing_commits.any?
|
||||
- count = @existing_commits.size
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
New commits were pushed to the merge request #{@merge_request.to_reference} by #{@current_user.name}
|
||||
#{@updated_by_user.name} pushed new commits to merge request #{@merge_request.to_reference}
|
||||
\
|
||||
#{url_for(project_merge_request_url(@merge_request.target_project, @merge_request))}
|
||||
\
|
||||
|
|
|
@ -389,6 +389,36 @@ describe Notify do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'that have new commits' do
|
||||
let(:push_user) { create(:user) }
|
||||
|
||||
subject do
|
||||
described_class.push_to_merge_request_email(recipient.id, merge_request.id, push_user.id, new_commits: merge_request.commits)
|
||||
end
|
||||
|
||||
it_behaves_like 'a multiple recipients email'
|
||||
it_behaves_like 'an answer to an existing thread with reply-by-email enabled' do
|
||||
let(:model) { merge_request }
|
||||
end
|
||||
it_behaves_like 'it should show Gmail Actions View Merge request link'
|
||||
it_behaves_like 'an unsubscribeable thread'
|
||||
|
||||
it 'is sent as the push user' do
|
||||
sender = subject.header[:from].addrs[0]
|
||||
|
||||
expect(sender.display_name).to eq(push_user.name)
|
||||
expect(sender.address).to eq(gitlab_sender)
|
||||
end
|
||||
|
||||
it 'has the correct subject and body' do
|
||||
aggregate_failures do
|
||||
is_expected.to have_referable_subject(merge_request, reply: true)
|
||||
is_expected.to have_body_text("#{push_user.name} pushed new commits")
|
||||
is_expected.to have_body_text(project_merge_request_path(project, merge_request))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'for issue notes' do
|
||||
|
|
Loading…
Reference in a new issue