diff --git a/Changelog.md b/Changelog.md index 488b0ca9d5861878db0ee4f90e37e0e01484ab25..a0d4c81e453c9b0c3cbc6a0f21da850e623d95f6 100644 --- a/Changelog.md +++ b/Changelog.md @@ -142,6 +142,7 @@ diaspora.yml file**. The existing settings from 0.4.x and before will not work a * Allow to set unhosted button and currency for paypal donation [#5452](https://github.com/diaspora/diaspora/pull/5452) * Add followed tags in the mobile menu [#5468](https://github.com/diaspora/diaspora/pull/5468) * Replace Pagedown with markdown-it [#5526](https://github.com/diaspora/diaspora/pull/5526) +* Do not truncate notification emails anymore [#4342](https://github.com/diaspora/diaspora/issues/4342) # 0.4.1.2 diff --git a/app/helpers/notifier_helper.rb b/app/helpers/notifier_helper.rb index e8f28e0eb70414945f6c3f624a74992791cec1eb..ee62c5a44beb709e36149ddb6d51cfeb90d13ffe 100644 --- a/app/helpers/notifier_helper.rb +++ b/app/helpers/notifier_helper.rb @@ -2,23 +2,22 @@ module NotifierHelper # @param post [Post] The post object. # @param opts [Hash] Optional hash. Accepts :length parameters. - # @return [String] The truncated and formatted post. + # @return [String] The formatted post. def post_message(post, opts={}) if !post.public? I18n.translate 'notifier.a_private_message' elsif post.respond_to? :message - post.message.plain_text_without_markdown truncate: opts.fetch(:length, 200) + post.message.plain_text_without_markdown else I18n.translate 'notifier.a_post_you_shared' end end # @param comment [Comment] The comment to process. - # @param opts [Hash] Optional hash. Accepts :length parameters. - # @return [String] The truncated and formatted comment. + # @return [String] The formatted comment. def comment_message(comment, opts={}) if comment.post.public? - comment.message.plain_text_without_markdown truncate: opts.fetch(:length, 600) + comment.message.plain_text_without_markdown else I18n.translate 'notifier.a_limited_post_comment' end diff --git a/app/views/notifier/mentioned.markerb b/app/views/notifier/mentioned.markerb index 9be69b95af5df013a99c81c2000bd0b3d2f06656..43264d36599ecfb3640fb8750c06088431895442 100644 --- a/app/views/notifier/mentioned.markerb +++ b/app/views/notifier/mentioned.markerb @@ -1,4 +1,4 @@ -<%= post_message(@notification.post, :process_newlines => true, :length => 600) %> +<%= post_message(@notification.post, :process_newlines => true) %> [<%= t('notifier.comment_on_post.reply', :name => @notification.post_author_name) %>][1] diff --git a/app/views/notifier/private_message.markerb b/app/views/notifier/private_message.markerb index 0099546d46af0e3aa5ecaebc2f76fd01d2499d70..b9b6cbd81b5df2391947ebcd541601ac81cc3ac0 100644 --- a/app/views/notifier/private_message.markerb +++ b/app/views/notifier/private_message.markerb @@ -1,4 +1,4 @@ -<%= post_message(@notification.message, :process_newlines => true, :length => 2000) %> +<%= post_message(@notification.message, :process_newlines => true) %> [<%= t('.reply_to_or_view') %>][1] diff --git a/spec/helpers/notifier_helper_spec.rb b/spec/helpers/notifier_helper_spec.rb index 1116a18ea2f65a8eb057ff16b2119fe9f150763c..a5e1dc98b3ba4cb2561287fbf5948afa487acfe4 100644 --- a/spec/helpers/notifier_helper_spec.rb +++ b/spec/helpers/notifier_helper_spec.rb @@ -7,9 +7,6 @@ require 'spec_helper' describe NotifierHelper, :type => :helper do describe '#post_message' do before do - # post for truncate test - @post = FactoryGirl.create(:status_message, text: "hi dude! "*10, public: true) - @truncated_post = "hi dude! hi dude! hi dude! hi dude! hi dude! hi dude! hi dude! hi dude! hi du..." # post for markdown test @markdown_post = FactoryGirl.create(:status_message, text: "[link](http://diasporafoundation.org) **bold text** *other text*", public: true) @@ -17,15 +14,9 @@ describe NotifierHelper, :type => :helper do @limited_post = FactoryGirl.create(:status_message, text: "This is top secret post. Shhhhhhhh!!!", public: false) end - - it 'truncates in the post' do - opts = {:length => @post.text.length - 10} - expect(post_message(@post, opts)).to eq(@truncated_post) - end - + it 'strip markdown in the post' do - opts = {:length => @markdown_post.text.length} - expect(post_message(@markdown_post, opts)).to eq(@striped_markdown_post) + expect(post_message(@markdown_post)).to eq(@striped_markdown_post) end it 'hides the private content' do @@ -35,12 +26,6 @@ describe NotifierHelper, :type => :helper do describe '#comment_message' do before do - # comment for truncate test - @comment = FactoryGirl.create(:comment) - @comment.text = "hi dude! "*10 - @comment.post.public = true - @truncated_comment = "hi dude! hi dude! hi dude! hi dude! hi dude! hi dude! hi dude! hi dude! hi d..." - # comment for markdown test @markdown_comment = FactoryGirl.create(:comment) @markdown_comment.post.public = true @@ -52,15 +37,9 @@ describe NotifierHelper, :type => :helper do @limited_comment.post.public = false @limited_comment.text = "This is top secret comment. Shhhhhhhh!!!" end - - it 'truncates in the comment' do - opts = {:length => @comment.text.length - 10} - expect(comment_message(@comment, opts)).to eq(@truncated_comment) - end - + it 'strip markdown in the comment' do - opts = {:length => @markdown_comment.text.length} - expect(comment_message(@markdown_comment, opts)).to eq(@striped_markdown_comment) + expect(comment_message(@markdown_comment)).to eq(@striped_markdown_comment) end it 'hides the private content' do diff --git a/spec/mailers/notifier_spec.rb b/spec/mailers/notifier_spec.rb index baeb4e2baffff4de341cbeddc04ba2dad971f7f0..7678ca6f33ec11d3d484c2528739dba294f1a988 100644 --- a/spec/mailers/notifier_spec.rb +++ b/spec/mailers/notifier_spec.rb @@ -116,7 +116,7 @@ describe Notifier, :type => :mailer do expect(@mail.to).to eq([alice.email]) end - it 'BODY: contains the truncated original post' do + it 'BODY: contains the original post' do expect(@mail.body.encoded).to include(@post.message.plain_text) end