mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: don't allow blocked user to send emails in
This commit is contained in:
@@ -43,6 +43,11 @@ describe Email::Receiver do
|
||||
expect { process(:inactive_sender) }.to raise_error(Email::Receiver::InactiveUserError)
|
||||
end
|
||||
|
||||
it "raises a BlockedUserError when the sender has been blocked" do
|
||||
Fabricate(:user, email: "blocked@bar.com", blocked: true)
|
||||
expect { process(:blocked_sender) }.to raise_error(Email::Receiver::BlockedUserError)
|
||||
end
|
||||
|
||||
skip "doesn't raise an InactiveUserError when the sender is staged" do
|
||||
Fabricate(:user, email: "staged@bar.com", active: false, staged: true)
|
||||
expect { process(:staged_sender) }.not_to raise_error
|
||||
|
||||
9
spec/fixtures/emails/blocked_sender.eml
vendored
Normal file
9
spec/fixtures/emails/blocked_sender.eml
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
Return-Path: <blocked@bar.com>
|
||||
From: Foo Bar <blocked@bar.com>
|
||||
Date: Fri, 15 Jan 2016 00:12:43 +0100
|
||||
Message-ID: <8@foo.bar.mail>
|
||||
Mime-Version: 1.0
|
||||
Content-Type: text/plain
|
||||
Content-Transfer-Encoding: 7bit
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
2
spec/fixtures/emails/staged_sender.eml
vendored
2
spec/fixtures/emails/staged_sender.eml
vendored
@@ -1,7 +1,7 @@
|
||||
Return-Path: <staged@bar.com>
|
||||
From: Foo Bar <staged@bar.com>
|
||||
Date: Fri, 15 Jan 2016 00:12:43 +0100
|
||||
Message-ID: <9@foo.bar.mail>
|
||||
Message-ID: <39@foo.bar.mail>
|
||||
Mime-Version: 1.0
|
||||
Content-Type: text/plain
|
||||
Content-Transfer-Encoding: 7bit
|
||||
|
||||
Reference in New Issue
Block a user