Make Notify#note_merge_request_email resque friendly
Update method to take ids and then perform #finds itself during mailer queue worker kick-off.
This commit is contained in:
parent
5fe75649b3
commit
bb22360d1a
4 changed files with 14 additions and 11 deletions
|
@ -35,13 +35,12 @@ class Notify < ActionMailer::Base
|
|||
@commit = @note.target
|
||||
mail(:to => @user['email'], :subject => "gitlab | note for commit | #{@note.project.name} ")
|
||||
end
|
||||
|
||||
def note_merge_request_email(user, note)
|
||||
@user = user
|
||||
@note = Note.find(note['id'])
|
||||
@project = @note.project
|
||||
|
||||
def note_merge_request_email(recipient_id, note_id)
|
||||
recipient = User.find(recipient_id)
|
||||
@note = Note.find(note_id)
|
||||
@merge_request = @note.noteable
|
||||
mail(:to => @user['email'], :subject => "gitlab | note for merge request | #{@note.project.name} ")
|
||||
mail(:to => recipient.email, :subject => "gitlab | note for merge request | #{@note.project.name} ")
|
||||
end
|
||||
|
||||
def note_issue_email(user, note)
|
||||
|
|
|
@ -36,7 +36,7 @@ class MailerObserver < ActiveRecord::Observer
|
|||
when "Issue" then
|
||||
Notify.note_issue_email(u, note).deliver
|
||||
when "MergeRequest" then
|
||||
Notify.note_merge_request_email(u, note).deliver
|
||||
Notify.note_merge_request_email(u.id, note.id).deliver
|
||||
when "Snippet"
|
||||
true
|
||||
else
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
%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 comment for Merge Request
|
||||
= link_to truncate(@merge_request.title, :length => 16), project_merge_request_url(@project, @merge_request, :anchor => "note_#{@note.id}")
|
||||
= link_to truncate(@merge_request.title, :length => 16), project_merge_request_url(@merge_request.project, @merge_request, :anchor => "note_#{@note.id}")
|
||||
%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; "}
|
||||
%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"}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue