Commit 39061af9f8f19d114b48f79a66c22116a52e57be

Authored by Robb Kidd
1 parent 2d124d94

Make Notify#new_issue_email resque friendly.

app/mailers/notify.rb
@@ -13,12 +13,9 @@ class Notify < ActionMailer::Base @@ -13,12 +13,9 @@ class Notify < ActionMailer::Base
13 mail(:to => @user.email, :subject => "gitlab | Account was created for you") 13 mail(:to => @user.email, :subject => "gitlab | Account was created for you")
14 end 14 end
15 15
16 - def new_issue_email(issue)  
17 - @issue = Issue.find(issue['id'])  
18 - @user = @issue.assignee  
19 - @project = @issue.project  
20 -  
21 - mail(:to => @user.email, :subject => "gitlab | New Issue was created") 16 + def new_issue_email(issue_id)
  17 + @issue = Issue.find(issue_id)
  18 + mail(:to => @issue.assignee_email, :subject => "gitlab | New Issue was created")
22 end 19 end
23 20
24 def note_wall_email(recipient_id, note_id) 21 def note_wall_email(recipient_id, note_id)
app/views/notify/new_issue_email.html.haml
@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} 10 %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"}
11 %td{:align => "left", :style => "padding: 20px 0 0;"} 11 %td{:align => "left", :style => "padding: 20px 0 0;"}
12 %h2{:style => "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} 12 %h2{:style => "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "}
13 - = link_to project_issue_url(@project, @issue), :title => @issue.title do 13 + = link_to project_issue_url(@issue.project, @issue), :title => @issue.title do
14 = "Issue ##{@issue.id.to_s}" 14 = "Issue ##{@issue.id.to_s}"
15 = truncate(@issue.title, :length => 45) 15 = truncate(@issue.title, :length => 45)
16 %br 16 %br
spec/mailers/notify_spec.rb
@@ -59,7 +59,7 @@ describe Notify do @@ -59,7 +59,7 @@ describe Notify do
59 let(:issue) { Factory.create(:issue, :assignee => assignee, :project => project ) } 59 let(:issue) { Factory.create(:issue, :assignee => assignee, :project => project ) }
60 60
61 describe 'that are new' do 61 describe 'that are new' do
62 - subject { Notify.new_issue_email(issue) } 62 + subject { Notify.new_issue_email(issue.id) }
63 63
64 it_behaves_like 'an assignee email' 64 it_behaves_like 'an assignee email'
65 65