Eliminate 500 errors on also_commented emails, the copy there is terrible

This commit is contained in:
Raphael Sofaer 2011-08-10 16:58:35 -07:00
parent 350a4b4f6d
commit 8086b9a9d4
2 changed files with 13 additions and 2 deletions

View file

@ -89,9 +89,10 @@ class Notifier < ActionMailer::Base
log_mail(recipient_id, sender_id, 'comment_on_post')
I18n.with_locale(@receiver.language) do
subject_message = post_message(@comment.parent, :length => TRUNCATION_LEN)
mail(:from => "\"#{@sender.name} (Diaspora)\" <#{AppConfig[:smtp_sender_address]}>",
:to => "\"#{@receiver.name}\" <#{@receiver.email}>",
:subject => "Re: #{truncate(@comment.parent.formatted_message(:plain_text => true).strip, :length => TRUNCATION_LEN)}")
:subject => "Re: #{subject_message}")
end
end

View file

@ -215,7 +215,7 @@ describe Notifier do
end
describe ".also_commented" do
let!(:comment_mail) {Notifier.also_commented(user.id, person.id, comment.id)}
let(:comment_mail) {Notifier.also_commented(user.id, person.id, comment.id)}
it 'TO: goes to the right person' do
comment_mail.to.should == [user.email]
@ -239,6 +239,16 @@ describe Notifier do
comment_mail.body.encoded.include?("#{comment.post.id.to_s}").should be true
end
end
[:reshare, :activity_streams_photo].each do |post_type|
context post_type.to_s do
let(:commented_post) { Factory(post_type, :author => user.person) }
it 'succeeds' do
proc {
comment_mail
}.should_not raise_error
end
end
end
end
describe ".confirm_email" do