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:
Krzysztof Kotlarek
2020-07-27 10:23:54 +10:00
committed by GitHub
parent 5077cf52fd
commit e0d9232259
130 changed files with 676 additions and 570 deletions

View File

@ -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

View File

@ -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

View File

@ -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] || ""