Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Neff <benjamin@coding4coffee.ch>2018-01-27 21:00:41 +0300
committerDennis Schubert <mail@dennis-schubert.de>2018-02-02 01:39:18 +0300
commit6c5b8b73afa76b545dcbe125743bdf06624969f2 (patch)
tree86a6d821c078e0f5e20c68b2d09077d5459edfba
parenta32cac06ab5bbaa124246d0c5c85e544713f94b3 (diff)
Fix post_message for posts without text
fixes #7700 closes #7706
-rw-r--r--Changelog.md5
-rw-r--r--app/helpers/notifier_helper.rb2
-rw-r--r--spec/helpers/notifier_helper_spec.rb7
3 files changed, 11 insertions, 3 deletions
diff --git a/Changelog.md b/Changelog.md
index d38b1809b..7655de013 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -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)
diff --git a/app/helpers/notifier_helper.rb b/app/helpers/notifier_helper.rb
index eaf1ff597..70e780709 100644
--- a/app/helpers/notifier_helper.rb
+++ b/app/helpers/notifier_helper.rb
@@ -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
diff --git a/spec/helpers/notifier_helper_spec.rb b/spec/helpers/notifier_helper_spec.rb
index 5e2499001..946753aa8 100644
--- a/spec/helpers/notifier_helper_spec.rb
+++ b/spec/helpers/notifier_helper_spec.rb
@@ -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