summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValery Sizov <vsv2711@gmail.com>2011-12-18 16:29:58 +0200
committerValery Sizov <vsv2711@gmail.com>2011-12-18 16:29:58 +0200
commit6a0defc3ca2edf40fc58db4662a40f22514c88f6 (patch)
tree8905491140b24a1621f7132ee3acf6f0ccb94bfd
parenta66d9b4c768d9ed2e0096645fb2b4f61c222283d (diff)
downloadgitlab-ce-6a0defc3ca2edf40fc58db4662a40f22514c88f6.tar.gz
notification for note for merge request
-rw-r--r--app/mailers/notify.rb8
-rw-r--r--app/models/mailer_observer.rb4
-rw-r--r--app/views/notify/note_merge_request_email.html.haml23
3 files changed, 33 insertions, 2 deletions
diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb
index 02ea1101683..64f17232a20 100644
--- a/app/mailers/notify.rb
+++ b/app/mailers/notify.rb
@@ -30,6 +30,14 @@ class Notify < ActionMailer::Base
@commit = @project.repo.commits(note.noteable_id).first
mail(:to => @user.email, :subject => "gitlab | #{@note.project.name} ")
end
+
+ def note_merge_request_email(user, note)
+ @user = user
+ @note = note
+ @project = note.project
+ @merge_request = note.noteable
+ mail(:to => @user.email, :subject => "gitlab | #{@note.project.name} ")
+ end
def note_issue_email(user, note)
@user = user
diff --git a/app/models/mailer_observer.rb b/app/models/mailer_observer.rb
index 19ecb4f3b54..2106e9c4810 100644
--- a/app/models/mailer_observer.rb
+++ b/app/models/mailer_observer.rb
@@ -34,8 +34,8 @@ class MailerObserver < ActiveRecord::Observer
Notify.note_commit_email(u, note).deliver
when "Issue" then
Notify.note_issue_email(u, note).deliver
- when "MergeRequest"
- true # someone should write email notification
+ when "MergeRequest" then
+ Notify.note_merge_request_email(u, note).deliver
when "Snippet"
true
else
diff --git a/app/views/notify/note_merge_request_email.html.haml b/app/views/notify/note_merge_request_email.html.haml
new file mode 100644
index 00000000000..27854e23a3b
--- /dev/null
+++ b/app/views/notify/note_merge_request_email.html.haml
@@ -0,0 +1,23 @@
+%td.content{:align => "left", :style => "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", :valign => "top", :width => "600"}
+ %table{:border => "0", :cellpadding => "0", :cellspacing => "0", :style => "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", :width => "600"}
+ %tr
+ %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"}
+ %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}")
+ %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}
+ left next message:
+ %br
+ %table{:border => "0", :cellpadding => "0", :cellspacing => "0", :width => "558"}
+ %tr
+ %td{:valign => "top"}
+ %cite{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "}
+ = @note.note
+ %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"}
+