fix for 500s in liked emails for reshares and activity streams photos
This commit is contained in:
parent
685165d133
commit
2d6a69cdc8
5 changed files with 19 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
class Notifier < ActionMailer::Base
|
class Notifier < ActionMailer::Base
|
||||||
helper :application
|
helper :application
|
||||||
helper :markdownify
|
helper :markdownify
|
||||||
|
helper :notifier
|
||||||
|
|
||||||
default :from => AppConfig[:smtp_sender_address]
|
default :from => AppConfig[:smtp_sender_address]
|
||||||
|
|
||||||
|
|
@ -80,6 +81,7 @@ class Notifier < ActionMailer::Base
|
||||||
@receiver = User.find_by_id(recipient_id)
|
@receiver = User.find_by_id(recipient_id)
|
||||||
@sender = Person.find_by_id(sender_id)
|
@sender = Person.find_by_id(sender_id)
|
||||||
@comment = Comment.find_by_id(comment_id)
|
@comment = Comment.find_by_id(comment_id)
|
||||||
|
|
||||||
@post_author_name = @comment.post.author.name
|
@post_author_name = @comment.post.author.name
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -123,6 +125,7 @@ class Notifier < ActionMailer::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
def log_mail recipient_id, sender_id, type
|
def log_mail recipient_id, sender_id, type
|
||||||
log_string = "event=mail mail_type=#{type} recipient_id=#{recipient_id} sender_id=#{sender_id}"
|
log_string = "event=mail mail_type=#{type} recipient_id=#{recipient_id} sender_id=#{sender_id}"
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
= "#{t('.liked', :name => "#{@sender.name}")}:"
|
= "#{t('.liked', :name => "#{@sender.name}")}:"
|
||||||
|
|
||||||
%p{:style => "font-style:italic;color:#666"}
|
%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
|
%p
|
||||||
= link_to t('.view_post'), post_url(@like.target)
|
= link_to t('.view_post'), post_url(@like.target)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
!= "#{t('notifier.liked.liked', :name => "#{@sender.name}")}:"
|
!= "#{t('notifier.liked.liked', :name => "#{@sender.name}")}:"
|
||||||
!= truncate(@like.target.formatted_message(:plain_text => true), :length => 200)
|
!=post_message(@like.target)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -421,6 +421,7 @@ en:
|
||||||
other: "%{count} new notifications"
|
other: "%{count} new notifications"
|
||||||
|
|
||||||
notifier:
|
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,"
|
email_sent_by_diaspora: "This email was sent by Diaspora. If you'd like to stop getting emails like this,"
|
||||||
click_here: "click here"
|
click_here: "click here"
|
||||||
hello: "Hello %{name}!"
|
hello: "Hello %{name}!"
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,19 @@ describe Notifier do
|
||||||
it 'should not include translation missing' do
|
it 'should not include translation missing' do
|
||||||
@mail.body.encoded.should_not include("missing")
|
@mail.body.encoded.should_not include("missing")
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
describe ".private_message" do
|
describe ".private_message" do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue