Commit 435fd8f0 authored by Robb Kidd's avatar Robb Kidd

Make Notify#note_issue_email resque friendly

Update method to take ids and then perform #finds itself during mailer
queue worker kick-off.
parent bb22360d
......@@ -43,14 +43,13 @@ class Notify < ActionMailer::Base
mail(:to => recipient.email, :subject => "gitlab | note for merge request | #{@note.project.name} ")
end
def note_issue_email(user, note)
@user = user
@note = Note.find(note['id'])
@project = @note.project
def note_issue_email(recipient_id, note_id)
recipient = User.find(recipient_id)
@note = Note.find(note_id)
@issue = @note.noteable
mail(:to => @user['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
def new_merge_request_email(merge_request)
@merge_request = MergeRequest.find(merge_request['id'])
@user = @merge_request.assignee
......
......@@ -5,7 +5,7 @@
%td{:align => "left", :style => "padding: 20px 0 0;"}
%h2{:style => "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "}
New comment -
= link_to project_issue_url(@project, @issue, :anchor => "note_#{@note.id}") do
= link_to project_issue_url(@issue.project, @issue, :anchor => "note_#{@note.id}") do
= "Issue ##{@issue.id.to_s}"
= truncate(@issue.title, :length => 35)
%td{:style => "font-size: 1px; line-height: 1px;", :width => "21"}
......@@ -13,7 +13,7 @@
%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; "}
%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:
%br
%table{:border => "0", :cellpadding => "0", :cellspacing => "0", :width => "558"}
......
......@@ -230,7 +230,8 @@ describe Notify do
let(:issue) { Factory.create(:issue, :project => project) }
let(:note_on_issue_url) { project_issue_url(project, issue, :anchor => "note_#{note.id}") }
before(:each) { note.stub(:noteable).and_return(issue) }
subject { Notify.note_issue_email(recipient, note) }
subject { Notify.note_issue_email(recipient.id, note.id) }
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