Commit 41c00a20 authored by Robb Kidd's avatar Robb Kidd

Make Notify#note_wall_email resque friendly

Update method to take ids and then perform #finds itself during mailer
queue worker kick-off.
parent 0a9a2c2a
...@@ -21,11 +21,10 @@ class Notify < ActionMailer::Base ...@@ -21,11 +21,10 @@ class Notify < ActionMailer::Base
mail(:to => @user.email, :subject => "gitlab | New Issue was created") mail(:to => @user.email, :subject => "gitlab | New Issue was created")
end end
def note_wall_email(user, note) def note_wall_email(recipient_id, note_id)
@user = user recipient = User.find(recipient_id)
@note = Note.find(note['id']) @note = Note.find(note_id)
@project = @note.project mail(:to => recipient.email, :subject => "gitlab | #{@note.project.name} ")
mail(:to => @user['email'], :subject => "gitlab | #{@note.project.name} ")
end end
def note_commit_email(recipient_id, note_id) def note_commit_email(recipient_id, note_id)
......
...@@ -5,13 +5,13 @@ ...@@ -5,13 +5,13 @@
%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 message on New message on
= link_to "Project Wall", wall_project_url(@project, :anchor => "note_#{@note.id}") = link_to "Project Wall", wall_project_url(@note.project, :anchor => "note_#{@note.id}")
%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; "}
%a{:href => "#", :style => "color: #0eb6ce; text-decoration: none;"} #{@note.author.name} %a{:href => "#", :style => "color: #0eb6ce; text-decoration: none;"} #{@note.author_name}
left next message: left next message:
%br %br
%table{:border => "0", :cellpadding => "0", :cellspacing => "0", :width => "558"} %table{:border => "0", :cellpadding => "0", :cellspacing => "0", :width => "558"}
......
...@@ -174,7 +174,7 @@ describe Notify do ...@@ -174,7 +174,7 @@ describe Notify do
describe 'on a project wall' do describe 'on a project wall' do
let(:note_on_the_wall_url) { wall_project_url(project, :anchor => "note_#{note.id}") } let(:note_on_the_wall_url) { wall_project_url(project, :anchor => "note_#{note.id}") }
subject { Notify.note_wall_email(recipient, note) } subject { Notify.note_wall_email(recipient.id, note.id) }
it_behaves_like 'a note email' it_behaves_like 'a note email'
......
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