Commit 65a2b8da authored by Dennis Schubert's avatar Dennis Schubert Committed by Benjamin Neff

Include PostsHelper in NotifierHelper

Fixes #7852

closes #7853
parent f130ec41
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
## Bug fixes ## Bug fixes
* Add compatibility with macOS to `script/configure_bundler` [#7830](https://github.com/diaspora/diaspora/pull/7830) * Add compatibility with macOS to `script/configure_bundler` [#7830](https://github.com/diaspora/diaspora/pull/7830)
* Fix comment notifications for comments on posts without text [#7857](https://github.com/diaspora/diaspora/pull/7857) * Fix comment and like notifications on posts without text [#7857](https://github.com/diaspora/diaspora/pull/7857) [#7853](https://github.com/diaspora/diaspora/pull/7853)
## Features ## Features
* Add `web+diaspora://` link handler [#7826](https://github.com/diaspora/diaspora/pull/7826) * Add `web+diaspora://` link handler [#7826](https://github.com/diaspora/diaspora/pull/7826)
......
# frozen_string_literal: true # frozen_string_literal: true
module NotifierHelper module NotifierHelper
include PostsHelper
# @param post [Post] The post object. # @param post [Post] The post object.
# @param opts [Hash] Optional hash. Accepts :length parameters. # @param opts [Hash] Optional hash. Accepts :length parameters.
...@@ -9,7 +10,7 @@ module NotifierHelper ...@@ -9,7 +10,7 @@ module NotifierHelper
if post.respond_to? :message if post.respond_to? :message
post.message.try(:plain_text_without_markdown).presence || post_page_title(post) post.message.try(:plain_text_without_markdown).presence || post_page_title(post)
else else
I18n.translate 'notifier.a_post_you_shared' I18n.translate "notifier.a_post_you_shared"
end end
end end
...@@ -19,7 +20,7 @@ module NotifierHelper ...@@ -19,7 +20,7 @@ module NotifierHelper
if comment.post.public? if comment.post.public?
comment.message.plain_text_without_markdown comment.message.plain_text_without_markdown
else else
I18n.translate 'notifier.a_limited_post_comment' I18n.translate "notifier.a_limited_post_comment"
end end
end end
end end
...@@ -214,6 +214,14 @@ describe Notifier, type: :mailer do ...@@ -214,6 +214,14 @@ describe Notifier, type: :mailer do
like = reshare.likes.create!(author: bob.person) like = reshare.likes.create!(author: bob.person)
Notifier.send_notification("liked", alice.id, like.author.id, like.id) Notifier.send_notification("liked", alice.id, like.author.id, like.id)
end end
it "can handle status_messages without text" do
photo = FactoryGirl.create(:photo, public: true)
status = FactoryGirl.create(:status_message, author: alice.person, text: nil, photos: [photo], public: true)
like = status.likes.create!(author: bob.person)
mail = Notifier.send_notification("liked", alice.id, like.author.id, like.id)
expect(mail.body.encoded).to include(I18n.t("posts.show.photos_by", count: 1, author: alice.name))
end
end end
describe ".reshared" do describe ".reshared" do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment