Make Notify#new_merge_request_email resque friendly.

This commit is contained in:
Robb Kidd 2012-05-15 19:41:37 -04:00
parent 39061af9f8
commit e660043d22
3 changed files with 6 additions and 10 deletions

View file

@ -45,11 +45,9 @@ class Notify < ActionMailer::Base
mail(:to => recipient.email, :subject => "gitlab | note for issue #{@issue.id} | #{@note.project_name} ") mail(:to => recipient.email, :subject => "gitlab | note for issue #{@issue.id} | #{@note.project_name} ")
end end
def new_merge_request_email(merge_request) def new_merge_request_email(merge_request_id)
@merge_request = MergeRequest.find(merge_request['id']) @merge_request = MergeRequest.find(merge_request_id)
@user = @merge_request.assignee mail(:to => @merge_request.assignee_email, :subject => "gitlab | new merge request | #{@merge_request.title} ")
@project = @merge_request.project
mail(:to => @user.email, :subject => "gitlab | new merge request | #{@merge_request.title} ")
end end
def reassigned_merge_request_email(recipient_id, merge_request_id, previous_assignee_id) def reassigned_merge_request_email(recipient_id, merge_request_id, previous_assignee_id)

View file

@ -5,16 +5,14 @@
%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; "}
New Merge Request New 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; "}
Branches: #{@merge_request.source_branch} &rarr; #{@merge_request.target_branch} Branches: #{@merge_request.source_branch} &rarr; #{@merge_request.target_branch}
%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; "}
Asignee: #{@merge_request.author.name} &rarr; #{@merge_request.assignee.name} Asignee: #{@merge_request.author_name} &rarr; #{@merge_request.assignee_name}
%td %td

View file

@ -101,7 +101,7 @@ describe Notify do
let(:merge_request) { Factory.create(:merge_request, :assignee => assignee, :project => project) } let(:merge_request) { Factory.create(:merge_request, :assignee => assignee, :project => project) }
describe 'that are new' do describe 'that are new' do
subject { Notify.new_merge_request_email(merge_request) } subject { Notify.new_merge_request_email(merge_request.id) }
it_behaves_like 'an assignee email' it_behaves_like 'an assignee email'