Rename changed_mr_email to reassigned_mr_email & make resque friendly
#changed_merge_request_email was really sending emails about merge request reassignments. Updated method name to reflect that. Update method to take ids and then perform #finds itself during mailer queue worker kick-off.
This commit is contained in:
parent
dd921053c8
commit
5fe75649b3
|
@ -58,13 +58,12 @@ class Notify < ActionMailer::Base
|
||||||
@project = @merge_request.project
|
@project = @merge_request.project
|
||||||
mail(:to => @user.email, :subject => "gitlab | new merge request | #{@merge_request.title} ")
|
mail(:to => @user.email, :subject => "gitlab | new merge request | #{@merge_request.title} ")
|
||||||
end
|
end
|
||||||
|
|
||||||
def changed_merge_request_email(user, merge_request)
|
def reassigned_merge_request_email(recipient_id, merge_request_id, previous_assignee_id)
|
||||||
@user = user
|
recipient = User.find(recipient_id)
|
||||||
@merge_request = MergeRequest.find(merge_request.id)
|
@merge_request = MergeRequest.find(merge_request_id)
|
||||||
@assignee_was ||= User.find(@merge_request.assignee_id_was)
|
@previous_assignee ||= User.find(previous_assignee_id)
|
||||||
@project = @merge_request.project
|
mail(:to => recipient.email, :subject => "gitlab | merge request changed | #{@merge_request.title} ")
|
||||||
mail(:to => @user['email'], :subject => "gitlab | merge request changed | #{@merge_request.title} ")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def reassigned_issue_email(recipient_id, issue_id, previous_assignee_id)
|
def reassigned_issue_email(recipient_id, issue_id, previous_assignee_id)
|
||||||
|
|
|
@ -5,12 +5,12 @@
|
||||||
%td{:align => "left", :style => "padding: 20px 0 0;"}
|
%td{:align => "left", :style => "padding: 20px 0 0;"}
|
||||||
%h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "}
|
%h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "}
|
||||||
Reassigned Merge Request
|
Reassigned Merge Request
|
||||||
= link_to truncate(@merge_request.title, :length => 16), project_merge_request_url(@project, @merge_request)
|
= link_to truncate(@merge_request.title, :length => 16), project_merge_request_url(@merge_request.project, @merge_request)
|
||||||
%td{:style => "font-size: 1px; line-height: 1px;", :width => "21"}
|
%td{:style => "font-size: 1px; line-height: 1px;", :width => "21"}
|
||||||
%tr
|
%tr
|
||||||
%td{:style => "font-size: 1px; line-height: 1px;", :width => "21"}
|
%td{:style => "font-size: 1px; line-height: 1px;", :width => "21"}
|
||||||
%td{:style => "padding: 15px 0 15px;", :valign => "top"}
|
%td{:style => "padding: 15px 0 15px;", :valign => "top"}
|
||||||
%p{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "}
|
%p{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "}
|
||||||
Assignee changed from #{@assignee_was.name} to #{@merge_request.assignee.name}
|
Assignee changed from #{@previous_assignee.name} to #{@merge_request.assignee_name}
|
||||||
%td
|
%td
|
||||||
|
|
|
@ -123,9 +123,9 @@ describe Notify do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'that are reassigned' do
|
describe 'that are reassigned' do
|
||||||
before(:each) { merge_request.stub(:assignee_id_was).and_return(old_assignee.id) }
|
before(:each) { merge_request.stub(:assignee_id_was).and_return(previous_assignee.id) }
|
||||||
|
|
||||||
subject { Notify.changed_merge_request_email(recipient, merge_request) }
|
subject { Notify.reassigned_merge_request_email(recipient.id, merge_request.id, previous_assignee.id) }
|
||||||
|
|
||||||
it_behaves_like 'a multiple recipients email'
|
it_behaves_like 'a multiple recipients email'
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ describe Notify do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'contains the name of the previous assignee' do
|
it 'contains the name of the previous assignee' do
|
||||||
should have_body_text /#{old_assignee.name}/
|
should have_body_text /#{previous_assignee.name}/
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'contains the name of the new assignee' do
|
it 'contains the name of the new assignee' do
|
||||||
|
|
Loading…
Reference in a new issue