mirror of
https://github.com/discourse/discourse.git
synced 2025-03-09 14:34:35 +00: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?
|
def is_blacklisted?
|
||||||
return false if SiteSetting.ignore_by_title.blank?
|
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
|
end
|
||||||
|
|
||||||
def create_incoming_email
|
def create_incoming_email
|
||||||
|
@ -568,11 +568,10 @@ describe Email::Receiver do
|
|||||||
expect { process(:tl4_user) }.to change(Topic, :count)
|
expect { process(:tl4_user) }.to change(Topic, :count)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "ignores by title" do
|
it "ignores by case-insensitive title" do
|
||||||
SiteSetting.ignore_by_title = "foo"
|
SiteSetting.ignore_by_title = "foo"
|
||||||
expect { process(:ignored) }.to_not change(Topic, :count)
|
expect { process(:ignored) }.to_not change(Topic, :count)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "new topic in a category that allows strangers" do
|
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
|
it "adds an error when email matches a blocked email" do
|
||||||
ScreenedEmail.create!(email: 'sam@sam.com', action_type: ScreenedEmail.actions[:block])
|
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)
|
||||||
|
expect(blocks?('SAM@sam.com')).to eq(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "blocks based on email_domains_blacklist" do
|
it "blocks based on email_domains_blacklist" do
|
||||||
SiteSetting.email_domains_blacklist = "email.com|mail.com|e-mail.com"
|
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@EMAIL.com')).to eq(true)
|
||||||
expect(blocks?('sam@bob.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@e-mail.com')).to eq(true)
|
||||||
expect(blocks?('sam@googlemail.com')).to eq(false)
|
expect(blocks?('sam@googlemail.com')).to eq(false)
|
||||||
@ -34,6 +36,7 @@ describe EmailValidator do
|
|||||||
it "blocks based on email_domains_whitelist" do
|
it "blocks based on email_domains_whitelist" do
|
||||||
SiteSetting.email_domains_whitelist = "googlemail.com|email.com"
|
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@EMAIL.com')).to eq(false)
|
||||||
expect(blocks?('sam@bob.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@e-mail.com')).to eq(true)
|
||||||
expect(blocks?('sam@googlemail.com')).to eq(false)
|
expect(blocks?('sam@googlemail.com')).to eq(false)
|
||||||
|
BIN
spec/fixtures/emails/ignored.eml
vendored
BIN
spec/fixtures/emails/ignored.eml
vendored
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user