mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 12:24:38 +08:00
FIX: ignore_by_title should match case-insensitive
This commit is contained in:
parent
4af7881cb7
commit
4dc4bc70c8
|
@ -66,7 +66,7 @@ module Email
|
|||
|
||||
def is_blacklisted?
|
||||
return false if SiteSetting.ignore_by_title.blank?
|
||||
Regexp.new(SiteSetting.ignore_by_title) =~ @mail.subject
|
||||
Regexp.new(SiteSetting.ignore_by_title, Regexp::IGNORECASE) =~ @mail.subject
|
||||
end
|
||||
|
||||
def create_incoming_email
|
||||
|
|
|
@ -568,11 +568,10 @@ describe Email::Receiver do
|
|||
expect { process(:tl4_user) }.to change(Topic, :count)
|
||||
end
|
||||
|
||||
it "ignores by title" do
|
||||
it "ignores by case-insensitive title" do
|
||||
SiteSetting.ignore_by_title = "foo"
|
||||
expect { process(:ignored) }.to_not change(Topic, :count)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "new topic in a category that allows strangers" do
|
||||
|
|
|
@ -21,11 +21,13 @@ describe EmailValidator do
|
|||
it "adds an error when email matches a blocked email" do
|
||||
ScreenedEmail.create!(email: 'sam@sam.com', action_type: ScreenedEmail.actions[:block])
|
||||
expect(blocks?('sam@sam.com')).to eq(true)
|
||||
expect(blocks?('SAM@sam.com')).to eq(true)
|
||||
end
|
||||
|
||||
it "blocks based on email_domains_blacklist" do
|
||||
SiteSetting.email_domains_blacklist = "email.com|mail.com|e-mail.com"
|
||||
expect(blocks?('sam@email.com')).to eq(true)
|
||||
expect(blocks?('sam@EMAIL.com')).to eq(true)
|
||||
expect(blocks?('sam@bob.email.com')).to eq(true)
|
||||
expect(blocks?('sam@e-mail.com')).to eq(true)
|
||||
expect(blocks?('sam@googlemail.com')).to eq(false)
|
||||
|
@ -34,6 +36,7 @@ describe EmailValidator do
|
|||
it "blocks based on email_domains_whitelist" do
|
||||
SiteSetting.email_domains_whitelist = "googlemail.com|email.com"
|
||||
expect(blocks?('sam@email.com')).to eq(false)
|
||||
expect(blocks?('sam@EMAIL.com')).to eq(false)
|
||||
expect(blocks?('sam@bob.email.com')).to eq(false)
|
||||
expect(blocks?('sam@e-mail.com')).to eq(true)
|
||||
expect(blocks?('sam@googlemail.com')).to eq(false)
|
||||
|
|
2
spec/fixtures/emails/ignored.eml
vendored
2
spec/fixtures/emails/ignored.eml
vendored
|
@ -1,7 +1,7 @@
|
|||
Return-Path: <foo@bar.com>
|
||||
From: Foo Bar <foo@bar.com>
|
||||
To: category@foo.com
|
||||
Subject: This is a foo topic
|
||||
Subject: This is a FoO topic
|
||||
Date: Fri, 15 Jan 2016 00:12:43 +0100
|
||||
Message-ID: <53@foo.bar.mail>
|
||||
Mime-Version: 1.0
|
||||
|
|
Loading…
Reference in New Issue
Block a user