mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 12:02:05 +08:00
FIX: use allowlist and blocklist terminology (#10209)
This is a PR of the renaming whitelist to allowlist and blacklist to the blocklist.
This commit is contained in:

committed by
GitHub

parent
5077cf52fd
commit
e0d9232259
@ -25,16 +25,16 @@ describe Email::Receiver do
|
||||
expect { process(:screened_email) }.to raise_error(Email::Receiver::ScreenedEmailError)
|
||||
end
|
||||
|
||||
it "raises EmailNotAllowed when email address is not on whitelist" do
|
||||
SiteSetting.email_domains_whitelist = "example.com|bar.com"
|
||||
it "raises EmailNotAllowed when email address is not on allowlist" do
|
||||
SiteSetting.allowed_email_domains = "example.com|bar.com"
|
||||
Fabricate(:group, incoming_email: "some_group@bar.com")
|
||||
expect { process(:blacklist_whitelist_email) }.to raise_error(Email::Receiver::EmailNotAllowed)
|
||||
expect { process(:blocklist_allowlist_email) }.to raise_error(Email::Receiver::EmailNotAllowed)
|
||||
end
|
||||
|
||||
it "raises EmailNotAllowed when email address is on blacklist" do
|
||||
SiteSetting.email_domains_blacklist = "email.com|mail.com"
|
||||
it "raises EmailNotAllowed when email address is on blocklist" do
|
||||
SiteSetting.blocked_email_domains = "email.com|mail.com"
|
||||
Fabricate(:group, incoming_email: "some_group@bar.com")
|
||||
expect { process(:blacklist_whitelist_email) }.to raise_error(Email::Receiver::EmailNotAllowed)
|
||||
expect { process(:blocklist_allowlist_email) }.to raise_error(Email::Receiver::EmailNotAllowed)
|
||||
end
|
||||
|
||||
it "raises an UserNotFoundError when staged users are disabled" do
|
||||
@ -419,9 +419,9 @@ describe Email::Receiver do
|
||||
expect { process(:invalid_from_2) }.to raise_error(Email::Receiver::NoSenderDetectedError)
|
||||
end
|
||||
|
||||
it "doesn't raise an AutoGeneratedEmailError when the mail is auto generated but is whitelisted" do
|
||||
SiteSetting.auto_generated_whitelist = "foo@bar.com|discourse@bar.com"
|
||||
expect { process(:auto_generated_whitelisted) }.to change { topic.posts.count }
|
||||
it "doesn't raise an AutoGeneratedEmailError when the mail is auto generated but is allowlisted" do
|
||||
SiteSetting.auto_generated_allowlist = "foo@bar.com|discourse@bar.com"
|
||||
expect { process(:auto_generated_allowlisted) }.to change { topic.posts.count }
|
||||
end
|
||||
|
||||
it "doesn't raise an AutoGeneratedEmailError when block_auto_generated_emails is disabled" do
|
||||
@ -1211,41 +1211,41 @@ describe Email::Receiver do
|
||||
include_examples "does not create staged users", :unsubscribe_new_user, Email::Receiver::UnsubscribeNotAllowed
|
||||
end
|
||||
|
||||
context "when From email address is not on whitelist" do
|
||||
context "when From email address is not on allowlist" do
|
||||
before do
|
||||
SiteSetting.email_domains_whitelist = "example.com|bar.com"
|
||||
SiteSetting.allowed_email_domains = "example.com|bar.com"
|
||||
Fabricate(:group, incoming_email: "some_group@bar.com")
|
||||
end
|
||||
|
||||
include_examples "does not create staged users", :blacklist_whitelist_email, Email::Receiver::EmailNotAllowed
|
||||
include_examples "does not create staged users", :blocklist_allowlist_email, Email::Receiver::EmailNotAllowed
|
||||
end
|
||||
|
||||
context "when From email address is on blacklist" do
|
||||
context "when From email address is on blocklist" do
|
||||
before do
|
||||
SiteSetting.email_domains_blacklist = "email.com|mail.com"
|
||||
SiteSetting.blocked_email_domains = "email.com|mail.com"
|
||||
Fabricate(:group, incoming_email: "some_group@bar.com")
|
||||
end
|
||||
|
||||
include_examples "does not create staged users", :blacklist_whitelist_email, Email::Receiver::EmailNotAllowed
|
||||
include_examples "does not create staged users", :blocklist_allowlist_email, Email::Receiver::EmailNotAllowed
|
||||
end
|
||||
|
||||
context "blacklist and whitelist for To and Cc" do
|
||||
context "blocklist and allowlist for To and Cc" do
|
||||
before do
|
||||
Fabricate(:group, incoming_email: "some_group@bar.com")
|
||||
end
|
||||
|
||||
it "does not create staged users for email addresses not on whitelist" do
|
||||
SiteSetting.email_domains_whitelist = "mail.com|example.com"
|
||||
process(:blacklist_whitelist_email)
|
||||
it "does not create staged users for email addresses not on allowlist" do
|
||||
SiteSetting.allowed_email_domains = "mail.com|example.com"
|
||||
process(:blocklist_allowlist_email)
|
||||
|
||||
expect(User.find_by_email("alice@foo.com")).to be_nil
|
||||
expect(User.find_by_email("bob@foo.com")).to be_nil
|
||||
expect(User.find_by_email("carol@example.com")).to be_present
|
||||
end
|
||||
|
||||
it "does not create staged users for email addresses on blacklist" do
|
||||
SiteSetting.email_domains_blacklist = "email.com|foo.com"
|
||||
process(:blacklist_whitelist_email)
|
||||
it "does not create staged users for email addresses on blocklist" do
|
||||
SiteSetting.blocked_email_domains = "email.com|foo.com"
|
||||
process(:blocklist_allowlist_email)
|
||||
|
||||
expect(User.find_by_email("alice@foo.com")).to be_nil
|
||||
expect(User.find_by_email("bob@foo.com")).to be_nil
|
||||
|
Reference in New Issue
Block a user