From f086d28b3096b9500526b2d836e95cd9676a8699 Mon Sep 17 00:00:00 2001 From: Gerhard Schlager Date: Thu, 4 Jan 2018 13:39:29 +0100 Subject: [PATCH] FIX: Do not validate messages sent to mailing list mirror --- spec/components/email/receiver_spec.rb | 10 ++++++++++ spec/fixtures/emails/mailinglist_short_message.eml | 12 ++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 spec/fixtures/emails/mailinglist_short_message.eml diff --git a/spec/components/email/receiver_spec.rb b/spec/components/email/receiver_spec.rb index 96c81c656e2..1ae5e656b36 100644 --- a/spec/components/email/receiver_spec.rb +++ b/spec/components/email/receiver_spec.rb @@ -818,6 +818,16 @@ describe Email::Receiver do expect { process(:mailinglist_reply) }.to change { topic.posts.count } end + it "should skip validations for staged users" do + Fabricate(:user, email: "alice@foo.com", staged: true) + expect { process(:mailinglist_short_message) }.to change { Topic.count } + end + + it "should skip validations for regular users" do + Fabricate(:user, email: "alice@foo.com") + expect { process(:mailinglist_short_message) }.to change { Topic.count } + end + context "read-only category" do before do category.set_permissions(everyone: :readonly) diff --git a/spec/fixtures/emails/mailinglist_short_message.eml b/spec/fixtures/emails/mailinglist_short_message.eml new file mode 100644 index 00000000000..b14209fce97 --- /dev/null +++ b/spec/fixtures/emails/mailinglist_short_message.eml @@ -0,0 +1,12 @@ +From: alice@foo.com +To: list@example.com +Subject: test +Date: Mon, 16 Oct 2017 09:18:32 +0100 +Message-ID: +Precedence: list +List-Id: Example List +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset="us-ascii" +Sender: list-bounces@example.com + +Hello world!