From 44ab0df02b1ab165373904c5ec75454fc76d54b4 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sun, 24 Jan 2016 00:05:05 +0100 Subject: [PATCH] fix suppress_annoying_errors closes #6653 --- Changelog.md | 1 + app/workers/base.rb | 6 +++--- .../federation/receive_federation_messages_spec.rb | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Changelog.md b/Changelog.md index 9dd531150..e3c35610c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,6 +5,7 @@ ## Bug fixes * Fix plural rules handling more than wanted as "one" [#6630](https://github.com/diaspora/diaspora/pull/6630) +* Fix `suppress_annoying_errors` eating too much errors [#6653](https://github.com/diaspora/diaspora/pull/6653) ## Features * Keyboard shortcuts now do work on profile pages as well [#6647](https://github.com/diaspora/diaspora/pull/6647/files) diff --git a/app/workers/base.rb b/app/workers/base.rb index d410a103d..b8a26d31e 100644 --- a/app/workers/base.rb +++ b/app/workers/base.rb @@ -24,10 +24,10 @@ module Workers logger.warn "error on receive: #{e.class}" rescue ActiveRecord::RecordInvalid => e logger.warn "failed to save received object: #{e.record.errors.full_messages}" - raise e unless %w( - "already been taken" + raise e unless [ + "already been taken", "is ignored by the post author" - ).any? {|reason| e.message.include? reason } + ].any? {|reason| e.message.include? reason } end end end diff --git a/spec/integration/federation/receive_federation_messages_spec.rb b/spec/integration/federation/receive_federation_messages_spec.rb index ab114e8e7..2c24a5aa2 100644 --- a/spec/integration/federation/receive_federation_messages_spec.rb +++ b/spec/integration/federation/receive_federation_messages_spec.rb @@ -46,7 +46,9 @@ describe "Receive federation messages feature" do post = FactoryGirl.create(:status_message, author: alice.person, public: false) reshare = FactoryGirl.build( :reshare_entity, root_diaspora_id: alice.diaspora_handle, root_guid: post.guid, diaspora_id: sender_id) - post_message(generate_xml(reshare, sender)) + expect { + post_message(generate_xml(reshare, sender)) + }.to raise_error ActiveRecord::RecordInvalid, "Validation failed: Only posts which are public may be reshared." expect(Reshare.exists?(root_guid: post.guid, diaspora_handle: sender_id)).to be_falsey end