Commit 6a0defc3ca2edf40fc58db4662a40f22514c88f6
1 parent
a66d9b4c
Exists in
master
and in
4 other branches
notification for note for merge request
Showing
3 changed files
with
33 additions
and
2 deletions
Show diff stats
app/mailers/notify.rb
| @@ -30,6 +30,14 @@ class Notify < ActionMailer::Base | @@ -30,6 +30,14 @@ class Notify < ActionMailer::Base | ||
| 30 | @commit = @project.repo.commits(note.noteable_id).first | 30 | @commit = @project.repo.commits(note.noteable_id).first |
| 31 | mail(:to => @user.email, :subject => "gitlab | #{@note.project.name} ") | 31 | mail(:to => @user.email, :subject => "gitlab | #{@note.project.name} ") |
| 32 | end | 32 | end |
| 33 | + | ||
| 34 | + def note_merge_request_email(user, note) | ||
| 35 | + @user = user | ||
| 36 | + @note = note | ||
| 37 | + @project = note.project | ||
| 38 | + @merge_request = note.noteable | ||
| 39 | + mail(:to => @user.email, :subject => "gitlab | #{@note.project.name} ") | ||
| 40 | + end | ||
| 33 | 41 | ||
| 34 | def note_issue_email(user, note) | 42 | def note_issue_email(user, note) |
| 35 | @user = user | 43 | @user = user |
app/models/mailer_observer.rb
| @@ -34,8 +34,8 @@ class MailerObserver < ActiveRecord::Observer | @@ -34,8 +34,8 @@ class MailerObserver < ActiveRecord::Observer | ||
| 34 | Notify.note_commit_email(u, note).deliver | 34 | Notify.note_commit_email(u, note).deliver |
| 35 | when "Issue" then | 35 | when "Issue" then |
| 36 | Notify.note_issue_email(u, note).deliver | 36 | Notify.note_issue_email(u, note).deliver |
| 37 | - when "MergeRequest" | ||
| 38 | - true # someone should write email notification | 37 | + when "MergeRequest" then |
| 38 | + Notify.note_merge_request_email(u, note).deliver | ||
| 39 | when "Snippet" | 39 | when "Snippet" |
| 40 | true | 40 | true |
| 41 | else | 41 | else |
| @@ -0,0 +1,23 @@ | @@ -0,0 +1,23 @@ | ||
| 1 | +%td.content{:align => "left", :style => "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", :valign => "top", :width => "600"} | ||
| 2 | + %table{:border => "0", :cellpadding => "0", :cellspacing => "0", :style => "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", :width => "600"} | ||
| 3 | + %tr | ||
| 4 | + %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | ||
| 5 | + %td{:align => "left", :style => "padding: 20px 0 0;"} | ||
| 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 | + New comment for Merge Request | ||
| 8 | + = link_to truncate(@merge_request.title, :length => 16), project_merge_request_url(@project, @merge_request, :anchor => "note_#{@note.id}") | ||
| 9 | + %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | ||
| 10 | + %tr | ||
| 11 | + %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | ||
| 12 | + %td{:style => "padding: 15px 0 15px;", :valign => "top"} | ||
| 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} | ||
| 15 | + left next message: | ||
| 16 | + %br | ||
| 17 | + %table{:border => "0", :cellpadding => "0", :cellspacing => "0", :width => "558"} | ||
| 18 | + %tr | ||
| 19 | + %td{:valign => "top"} | ||
| 20 | + %cite{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} | ||
| 21 | + = @note.note | ||
| 22 | + %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | ||
| 23 | + |