From e660043d22bd686f6799a46b506a4c2ad53e46fa Mon Sep 17 00:00:00 2001 From: Robb Kidd Date: Tue, 15 May 2012 19:41:37 -0400 Subject: [PATCH] Make Notify#new_merge_request_email resque friendly. --- app/mailers/notify.rb | 8 +++----- app/views/notify/new_merge_request_email.html.haml | 6 ++---- spec/mailers/notify_spec.rb | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb index b776878b..05fd17b5 100644 --- a/app/mailers/notify.rb +++ b/app/mailers/notify.rb @@ -45,11 +45,9 @@ class Notify < ActionMailer::Base mail(:to => recipient.email, :subject => "gitlab | note for issue #{@issue.id} | #{@note.project_name} ") end - def new_merge_request_email(merge_request) - @merge_request = MergeRequest.find(merge_request['id']) - @user = @merge_request.assignee - @project = @merge_request.project - mail(:to => @user.email, :subject => "gitlab | new merge request | #{@merge_request.title} ") + def new_merge_request_email(merge_request_id) + @merge_request = MergeRequest.find(merge_request_id) + mail(:to => @merge_request.assignee_email, :subject => "gitlab | new merge request | #{@merge_request.title} ") end def reassigned_merge_request_email(recipient_id, merge_request_id, previous_assignee_id) diff --git a/app/views/notify/new_merge_request_email.html.haml b/app/views/notify/new_merge_request_email.html.haml index 57c35db5..f7ec01e8 100644 --- a/app/views/notify/new_merge_request_email.html.haml +++ b/app/views/notify/new_merge_request_email.html.haml @@ -5,16 +5,14 @@ %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; "} 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"} %tr %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} %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; "} Branches: #{@merge_request.source_branch} → #{@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; "} - Asignee: #{@merge_request.author.name} → #{@merge_request.assignee.name} - + Asignee: #{@merge_request.author_name} → #{@merge_request.assignee_name} %td diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index 40a51437..065094e9 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -101,7 +101,7 @@ describe Notify do let(:merge_request) { Factory.create(:merge_request, :assignee => assignee, :project => project) } 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'