Commit 1bea16bd09961fd32e68557dceacb8d56beddbf2
1 parent
ec7def9f
Exists in
master
and in
28 other branches
Include comment title and body in notifications
(ActionItem1609)
Showing
3 changed files
with
24 additions
and
1 deletions
Show diff stats
app/models/comment.rb
... | ... | @@ -81,6 +81,8 @@ class Comment < ActiveRecord::Base |
81 | 81 | :sender_link => comment.author_link, |
82 | 82 | :article_title => comment.article.name, |
83 | 83 | :comment_url => comment.url, |
84 | + :comment_title => comment.title, | |
85 | + :comment_body => comment.body, | |
84 | 86 | :environment => profile.environment.name, |
85 | 87 | :url => profile.environment.top_url |
86 | 88 | end | ... | ... |
app/views/comment/notifier/mail.rhtml
... | ... | @@ -2,9 +2,18 @@ |
2 | 2 | |
3 | 3 | <%= word_wrap(_('%{sender} (%{sender_link}) created a new comment on your article "%{article_title}".') % { :sender => @sender, :sender_link => url_for(@sender_link), :article_title => @article_title }) %> |
4 | 4 | |
5 | +<%= word_wrap(_('Title: %s') % @comment_title) %> | |
6 | + | |
7 | +<%= _("Comment:") %> | |
8 | +------------------------------------------------------------------------------- | |
9 | +<%= word_wrap(@comment_body) %> | |
10 | +------------------------------------------------------------------------------- | |
11 | + | |
5 | 12 | <%= _('Access the address below to view this comment:') %> |
6 | 13 | <%= url_for @comment_url %> |
7 | 14 | |
15 | +<%= _("Greetings,") %> | |
16 | + | |
8 | 17 | -- |
9 | -<%= _('%s environment system') % @environment %> | |
18 | +<%= _('%s team.') % @environment %> | |
10 | 19 | <%= url_for @url %> | ... | ... |
test/unit/comment_notifier_test.rb
... | ... | @@ -44,6 +44,18 @@ class CommentNotifierTest < Test::Unit::TestCase |
44 | 44 | end |
45 | 45 | end |
46 | 46 | |
47 | + should 'include comment title in the e-mail' do | |
48 | + @article.comments << Comment.new(:author => @profile, :title => 'comment title', :body => 'comment title') | |
49 | + sent = ActionMailer::Base.deliveries.first | |
50 | + assert_match /comment title/, sent.body | |
51 | + end | |
52 | + | |
53 | + should 'include comment text in the e-mail' do | |
54 | + @article.comments << Comment.new(:author => @profile, :title => 'comment title', :body => 'comment body') | |
55 | + sent = ActionMailer::Base.deliveries.first | |
56 | + assert_match /comment body/, sent.body | |
57 | + end | |
58 | + | |
47 | 59 | private |
48 | 60 | |
49 | 61 | def read_fixture(action) | ... | ... |