FEATURE: add SES spam header to recognised spam headers (#8254)
This commit is contained in:
parent
5776251cdd
commit
e7ff6809a3
|
@ -969,6 +969,7 @@ email:
|
|||
- none
|
||||
- X-Spam-Flag
|
||||
- X-Spam-Status
|
||||
- X-SES-Spam-Verdict
|
||||
email_prefix: ""
|
||||
email_site_title: ""
|
||||
disable_emails:
|
||||
|
|
|
@ -301,6 +301,8 @@ module Email
|
|||
@mail[:x_spam_flag].to_s[/YES/i]
|
||||
when 'X-Spam-Status'
|
||||
@mail[:x_spam_status].to_s[/^Yes, /i]
|
||||
when 'X-SES-Spam-Verdict'
|
||||
@mail[:x_ses_spam_verdict].to_s[/FAIL/i]
|
||||
else
|
||||
false
|
||||
end
|
||||
|
|
|
@ -1006,6 +1006,21 @@ describe Email::Receiver do
|
|||
expect(post.hidden_reason_id).to eq(Post.hidden_reasons[:email_spam_header_found])
|
||||
end
|
||||
|
||||
it "creates hidden topic for X-SES-Spam-Verdict" do
|
||||
SiteSetting.email_in_spam_header = 'X-SES-Spam-Verdict'
|
||||
|
||||
Fabricate(:user, email: "existing@bar.com", trust_level: SiteSetting.email_in_min_trust)
|
||||
expect { process(:spam_x_ses_spam_verdict) }.to change { Topic.count }.by(1) # Topic created
|
||||
|
||||
topic = Topic.last
|
||||
expect(topic.visible).to eq(false)
|
||||
|
||||
post = Post.last
|
||||
expect(post.hidden).to eq(true)
|
||||
expect(post.hidden_at).not_to eq(nil)
|
||||
expect(post.hidden_reason_id).to eq(Post.hidden_reasons[:email_spam_header_found])
|
||||
end
|
||||
|
||||
it "adds the 'elided' part of the original message when always_show_trimmed_content is enabled" do
|
||||
SiteSetting.always_show_trimmed_content = true
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
Return-Path: <existing@bar.com>
|
||||
From: Foo Bar <existing@bar.com>
|
||||
To: category@bar.com
|
||||
Subject: This is a topic from an existing user
|
||||
Date: Fri, 15 Jan 2016 00:12:43 +0100
|
||||
Message-ID: <32@foo.bar.mail>
|
||||
Mime-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: quoted-printable
|
||||
X-SES-Spam-Verdict: FAIL
|
||||
|
||||
Hey, this is a topic from an existing user ;)
|
Loading…
Reference in New Issue