Commit 6c5b8b73 authored by Benjamin Neff's avatar Benjamin Neff Committed by Dennis Schubert

Fix post_message for posts without text

fixes #7700
closes #7706
parent a32cac06
......@@ -4,13 +4,14 @@
* Work on the data downloads: Fixed general layout of buttons, added a timestamp and implemented auto-deletion of old exports [#7684](https://github.com/diaspora/diaspora/pull/7684)
* Increase Twitter character limit to 280 [#7694](https://github.com/diaspora/diaspora/pull/7694)
* Improve password autocomplete with password managers [#7642](https://github.com/diaspora/diaspora/pull/7642)
* Removed the limit of participants in private conversations [#7705](https://github.com/diaspora/diaspora/pull/7705)
* Remove the limit of participants in private conversations [#7705](https://github.com/diaspora/diaspora/pull/7705)
* Send blocks to the blocked persons pod for better UX [#7705](https://github.com/diaspora/diaspora/pull/7705)
## Bug fixes
* Fix invite link on the contacts page when the user has no contacts [#7690](https://github.com/diaspora/diaspora/pull/7690)
* Fixed the mobile bookmarklet when called without parameters [#7698](https://github.com/diaspora/diaspora/pull/7698)
* Fix the mobile bookmarklet when called without parameters [#7698](https://github.com/diaspora/diaspora/pull/7698)
* Properly build the #newhere message for people who got invited [#7702](https://github.com/diaspora/diaspora/pull/7702)
* Fix the admin report view for posts without text [#7706](https://github.com/diaspora/diaspora/pull/7706)
## Features
* Check if redis is running in script/server [#7685](https://github.com/diaspora/diaspora/pull/7685)
......
......@@ -7,7 +7,7 @@ module NotifierHelper
# @return [String] The formatted post.
def post_message(post, opts={})
if post.respond_to? :message
post.message.try(:plain_text_without_markdown) || post_page_title(post)
post.message.try(:plain_text_without_markdown).presence || post_page_title(post)
else
I18n.translate 'notifier.a_post_you_shared'
end
......
......@@ -17,6 +17,13 @@ describe NotifierHelper, :type => :helper do
expect(post_message(@markdown_post)).to eq(@striped_markdown_post)
end
it "falls back to the title if the post has no text" do
photo = FactoryGirl.build(:photo, public: true)
photo_post = FactoryGirl.build(:status_message, author: photo.author, text: "", photos: [photo], public: true)
expect(helper.post_message(photo_post))
.to eq(I18n.t("posts.show.photos_by", count: 1, author: photo_post.author_name))
end
it "falls back to the title, if the root post was deleted" do
reshare = FactoryGirl.create(:reshare)
reshare.root.destroy
......
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