Commit 41c00a20a97e7ee3764822249d4bedc538c515aa

Authored by Robb Kidd
1 parent 0a9a2c2a

Make Notify#note_wall_email resque friendly

Update method to take ids and then perform #finds itself during mailer
queue worker kick-off.
app/mailers/notify.rb
... ... @@ -21,11 +21,10 @@ class Notify < ActionMailer::Base
21 21 mail(:to => @user.email, :subject => "gitlab | New Issue was created")
22 22 end
23 23  
24   - def note_wall_email(user, note)
25   - @user = user
26   - @note = Note.find(note['id'])
27   - @project = @note.project
28   - mail(:to => @user['email'], :subject => "gitlab | #{@note.project.name} ")
  24 + def note_wall_email(recipient_id, note_id)
  25 + recipient = User.find(recipient_id)
  26 + @note = Note.find(note_id)
  27 + mail(:to => recipient.email, :subject => "gitlab | #{@note.project.name} ")
29 28 end
30 29  
31 30 def note_commit_email(recipient_id, note_id)
... ...
app/views/notify/note_wall_email.html.haml
... ... @@ -5,13 +5,13 @@
5 5 %td{:align => "left", :style => "padding: 20px 0 0;"}
6 6 %h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "}
7 7 New message on
8   - = link_to "Project Wall", wall_project_url(@project, :anchor => "note_#{@note.id}")
  8 + = link_to "Project Wall", wall_project_url(@note.project, :anchor => "note_#{@note.id}")
9 9 %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"}
10 10 %tr
11 11 %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"}
12 12 %td{:style => "padding: 15px 0 15px;", :valign => "top"}
13 13 %p{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "}
14   - %a{:href => "#", :style => "color: #0eb6ce; text-decoration: none;"} #{@note.author.name}
  14 + %a{:href => "#", :style => "color: #0eb6ce; text-decoration: none;"} #{@note.author_name}
15 15 left next message:
16 16 %br
17 17 %table{:border => "0", :cellpadding => "0", :cellspacing => "0", :width => "558"}
... ...
spec/mailers/notify_spec.rb
... ... @@ -174,7 +174,7 @@ describe Notify do
174 174 describe 'on a project wall' do
175 175 let(:note_on_the_wall_url) { wall_project_url(project, :anchor => "note_#{note.id}") }
176 176  
177   - subject { Notify.note_wall_email(recipient, note) }
  177 + subject { Notify.note_wall_email(recipient.id, note.id) }
178 178  
179 179 it_behaves_like 'a note email'
180 180  
... ...