mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:53:49 +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
@ -17,9 +17,9 @@ class EmailValidator < ActiveModel::EachValidator
|
||||
end
|
||||
|
||||
def self.allowed?(email)
|
||||
if (setting = SiteSetting.email_domains_whitelist).present?
|
||||
if (setting = SiteSetting.allowed_email_domains).present?
|
||||
return email_in_restriction_setting?(setting, email) || is_developer?(email)
|
||||
elsif (setting = SiteSetting.email_domains_blacklist).present?
|
||||
elsif (setting = SiteSetting.blocked_email_domains).present?
|
||||
return !(email_in_restriction_setting?(setting, email) && !is_developer?(email))
|
||||
end
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class UnicodeUsernameWhitelistValidator
|
||||
class UnicodeUsernameAllowlistValidator
|
||||
def initialize(opts = {})
|
||||
@opts = opts
|
||||
end
|
||||
@ -10,12 +10,12 @@ class UnicodeUsernameWhitelistValidator
|
||||
return true if value.blank?
|
||||
|
||||
if value.match?(/^\/.*\/[imxo]*$/)
|
||||
@error_message = I18n.t("site_settings.errors.unicode_username_whitelist.leading_trailing_slash")
|
||||
@error_message = I18n.t("site_settings.errors.allowed_unicode_usernames.leading_trailing_slash")
|
||||
else
|
||||
begin
|
||||
Regexp.new(value)
|
||||
rescue RegexpError => e
|
||||
@error_message = I18n.t("site_settings.errors.unicode_username_whitelist.regex_invalid", error: e.message)
|
||||
@error_message = I18n.t("site_settings.errors.allowed_unicode_usernames.regex_invalid", error: e.message)
|
||||
end
|
||||
end
|
||||
|
@ -12,9 +12,9 @@ class UploadValidator < ActiveModel::Validator
|
||||
return true if upload.user&.staff?
|
||||
end
|
||||
|
||||
# check the attachment blacklist
|
||||
# check the attachment blocklist
|
||||
if upload.for_group_message && SiteSetting.allow_all_attachments_for_group_messages
|
||||
return upload.original_filename =~ SiteSetting.attachment_filename_blacklist_regex
|
||||
return upload.original_filename =~ SiteSetting.blocked_attachment_filenames_regex
|
||||
end
|
||||
|
||||
extension = File.extname(upload.original_filename)[1..-1] || ""
|
||||
|
Reference in New Issue
Block a user