From 96d183a041d6a9fe9b0956895c80e83021ecf725 Mon Sep 17 00:00:00 2001 From: Ilyaaaaaaaaaaaaa Zhitomirskiy Date: Fri, 19 Aug 2011 11:33:55 -0700 Subject: [PATCH] fixed private message emails not including the message --- app/models/message.rb | 4 ++++ spec/mailers/notifier_spec.rb | 20 ++++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/app/models/message.rb b/app/models/message.rb index 4d13d7807..a2a05b933 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -74,6 +74,10 @@ class Message < ActiveRecord::Base Notifications::PrivateMessage unless user.person == person end + def formatted_message(opts={}) + opts[:plain_text] ? self.text: ERB::Util.h(self.text) + end + private def participant_of_parent_conversation if self.parent && !self.parent.participants.include?(self.author) diff --git a/spec/mailers/notifier_spec.rb b/spec/mailers/notifier_spec.rb index 17326f582..c5ece598a 100644 --- a/spec/mailers/notifier_spec.rb +++ b/spec/mailers/notifier_spec.rb @@ -88,8 +88,8 @@ describe Notifier do @mail.body.encoded.should include(@sm.text) end - it 'should not include translation missing' do - @mail.body.encoded.should_not include("missing") + it 'should not include translation fallback' do + @mail.body.encoded.should_not include(I18n.translate 'notifier.a_post_you_shared') end end @@ -112,8 +112,8 @@ describe Notifier do @mail.body.encoded.should include(@like.author.name) end - it 'should not include translation missing' do - @mail.body.encoded.should_not include("missing") + it 'should not include translation fallback' do + @mail.body.encoded.should_not include(I18n.translate 'notifier.a_post_you_shared') end it 'can handle a reshare' do @@ -170,8 +170,8 @@ describe Notifier do @mail.body.encoded.should include(@cnv.messages.first.text) end - it 'should not include translation missing' do - @mail.body.encoded.should_not include("missing") + it 'should not include translation fallback' do + @mail.body.encoded.should_not include(I18n.translate 'notifier.a_post_you_shared') end end @@ -204,6 +204,10 @@ describe Notifier do it "contains the original post's link" do comment_mail.body.encoded.include?("#{comment.post.id.to_s}").should be true end + + it 'should not include translation fallback' do + comment_mail.body.encoded.should_not include(I18n.translate 'notifier.a_post_you_shared') + end end [:reshare, :activity_streams_photo].each do |post_type| @@ -242,6 +246,10 @@ describe Notifier do it "contains the original post's link" do comment_mail.body.encoded.include?("#{comment.post.id.to_s}").should be true end + + it 'should not include translation fallback' do + comment_mail.body.encoded.should_not include(I18n.translate 'notifier.a_post_you_shared') + end end [:reshare, :activity_streams_photo].each do |post_type| context post_type.to_s do