diff --git a/app/mailers/notifier.rb b/app/mailers/notifier.rb index a1b58452a..717eccecb 100644 --- a/app/mailers/notifier.rb +++ b/app/mailers/notifier.rb @@ -1,6 +1,7 @@ class Notifier < ActionMailer::Base helper :application helper :markdownify + helper :notifier default :from => AppConfig[:smtp_sender_address] @@ -80,6 +81,7 @@ class Notifier < ActionMailer::Base @receiver = User.find_by_id(recipient_id) @sender = Person.find_by_id(sender_id) @comment = Comment.find_by_id(comment_id) + @post_author_name = @comment.post.author.name @@ -123,6 +125,7 @@ class Notifier < ActionMailer::Base end end + private def log_mail recipient_id, sender_id, type log_string = "event=mail mail_type=#{type} recipient_id=#{recipient_id} sender_id=#{sender_id}" diff --git a/app/views/notifier/liked.html.haml b/app/views/notifier/liked.html.haml index af6988fdd..608412db1 100644 --- a/app/views/notifier/liked.html.haml +++ b/app/views/notifier/liked.html.haml @@ -2,7 +2,7 @@ = "#{t('.liked', :name => "#{@sender.name}")}:" %p{:style => "font-style:italic;color:#666"} - = process_newlines(truncate(@like.target.formatted_message(:plain_text => true), :length => 200)) + = post_message(@like.target, :process_newlines => true) %p = link_to t('.view_post'), post_url(@like.target) diff --git a/app/views/notifier/liked.text.haml b/app/views/notifier/liked.text.haml index c2a05ba40..861305e6e 100644 --- a/app/views/notifier/liked.text.haml +++ b/app/views/notifier/liked.text.haml @@ -1,3 +1,3 @@ != "#{t('notifier.liked.liked', :name => "#{@sender.name}")}:" -!= truncate(@like.target.formatted_message(:plain_text => true), :length => 200) +!=post_message(@like.target) diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 764474601..50c5c43dd 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -421,6 +421,7 @@ en: other: "%{count} new notifications" notifier: + a_post_you_shared: "a post." email_sent_by_diaspora: "This email was sent by Diaspora. If you'd like to stop getting emails like this," click_here: "click here" hello: "Hello %{name}!" diff --git a/spec/mailers/notifier_spec.rb b/spec/mailers/notifier_spec.rb index f11b67ea1..249ceb993 100644 --- a/spec/mailers/notifier_spec.rb +++ b/spec/mailers/notifier_spec.rb @@ -115,6 +115,19 @@ describe Notifier do it 'should not include translation missing' do @mail.body.encoded.should_not include("missing") end + + it 'can handle a reshare' do + reshare = Factory(:reshare) + like = reshare.likes.create!(:author => bob.person) + mail = Notifier.liked(alice.id, like.author.id, like.id) + end + + it 'can handle a activity streams photo' do + puts "boner" + reshare = Factory(:activity_streams_photo) + like = reshare.likes.create!(:author => bob.person) + mail = Notifier.liked(alice.id, like.author.id, like.id) + end end describe ".private_message" do