Skip to content

Commit

Permalink
Remove the terms blacklist and whitelist from UX (mastodon#14149)
Browse files Browse the repository at this point in the history
Localization strings:

- "Whitelist mode" -> "Limited federation mode"
- "Blacklist e-mail domain" -> "Block e-mail domain"
- "Whitelist domain" -> "Allow domain for federation"

...And so on

Environment variables (backwards-compatible):

- `WHITELIST_MODE` -> `LIMITED_FEDERATION_MODE`
- `EMAIL_DOMAIN_BLACKLIST` -> `EMAIL_DOMAIN_DENYLIST`
- `EMAIL_DOMAIN_WHITELIST` -> `EMAIL_DOMAIN_ALLOWLIST`

tootctl:

- `tootctl domains purge --whitelist-mode` -> `tootctl domains purge --limited-federation-mode`

Removed badly maintained and no longer relevant .env.production.sample file
  • Loading branch information
Gargron authored and umonaca committed Jun 28, 2020
1 parent b3b592b commit 4b18382
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 286 deletions.
262 changes: 0 additions & 262 deletions .env.production.sample

This file was deleted.

2 changes: 1 addition & 1 deletion config/initializers/2_whitelist_mode.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true

Rails.application.configure do
config.x.whitelist_mode = ENV['WHITELIST_MODE'] == 'true'
config.x.whitelist_mode = (ENV['LIMITED_FEDERATION_MODE'] || ENV['WHITELIST_MODE']) == 'true'
end
4 changes: 2 additions & 2 deletions config/initializers/blacklists.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true

Rails.application.configure do
config.x.email_domains_blacklist = ENV.fetch('EMAIL_DOMAIN_BLACKLIST') { 'mvrht.com' }
config.x.email_domains_whitelist = ENV.fetch('EMAIL_DOMAIN_WHITELIST') { '' }
config.x.email_domains_blacklist = (ENV['EMAIL_DOMAIN_DENYLIST'] || ENV['EMAIL_DOMAIN_BLACKLIST']) || ''
config.x.email_domains_whitelist = (ENV['EMAIL_DOMAIN_ALLOWLIST'] || ENV['EMAIL_DOMAIN_WHITELIST']) || ''
end
34 changes: 17 additions & 17 deletions config/locales/en.yml
Expand Up @@ -102,7 +102,7 @@ en:
delete: Delete
destroyed_msg: Moderation note successfully destroyed!
accounts:
add_email_domain_block: Blacklist e-mail domain
add_email_domain_block: Block e-mail domain
approve: Approve
approve_all: Approve all
are_you_sure: Are you sure?
Expand Down Expand Up @@ -203,7 +203,7 @@ en:
username: Username
warn: Warn
web: Web
whitelisted: Whitelisted
whitelisted: Allowed for federation
action_logs:
action_types:
assigned_to_self_report: Assign Report
Expand Down Expand Up @@ -248,15 +248,15 @@ en:
create_account_warning: "%{name} sent a warning to %{target}"
create_announcement: "%{name} created new announcement %{target}"
create_custom_emoji: "%{name} uploaded new emoji %{target}"
create_domain_allow: "%{name} whitelisted domain %{target}"
create_domain_allow: "%{name} allowed federation with domain %{target}"
create_domain_block: "%{name} blocked domain %{target}"
create_email_domain_block: "%{name} blacklisted e-mail domain %{target}"
create_email_domain_block: "%{name} blocked e-mail domain %{target}"
demote_user: "%{name} demoted user %{target}"
destroy_announcement: "%{name} deleted announcement %{target}"
destroy_custom_emoji: "%{name} destroyed emoji %{target}"
destroy_domain_allow: "%{name} removed domain %{target} from whitelist"
destroy_domain_allow: "%{name} disallowed federation with domain %{target}"
destroy_domain_block: "%{name} unblocked domain %{target}"
destroy_email_domain_block: "%{name} whitelisted e-mail domain %{target}"
destroy_email_domain_block: "%{name} unblocked e-mail domain %{target}"
destroy_status: "%{name} removed status by %{target}"
disable_2fa_user: "%{name} disabled two factor requirement for user %{target}"
disable_custom_emoji: "%{name} disabled emoji %{target}"
Expand Down Expand Up @@ -357,12 +357,12 @@ en:
week_interactions: interactions this week
week_users_active: active this week
week_users_new: users this week
whitelist_mode: Whitelist mode
whitelist_mode: Limited federation mode
domain_allows:
add_new: Whitelist domain
created_msg: Domain has been successfully whitelisted
destroyed_msg: Domain has been removed from the whitelist
undo: Remove from whitelist
add_new: Allow federation with domain
created_msg: Domain has been successfully allowed for federation
destroyed_msg: Domain has been disallowed from federation
undo: Disallow federation with domain
domain_blocks:
add_new: Add new domain block
created_msg: Domain block is now being processed
Expand Down Expand Up @@ -405,16 +405,16 @@ en:
view: View domain block
email_domain_blocks:
add_new: Add new
created_msg: Successfully added e-mail domain to blacklist
created_msg: Successfully blocked e-mail domain
delete: Delete
destroyed_msg: Successfully deleted e-mail domain from blacklist
destroyed_msg: Successfully unblocked e-mail domain
domain: Domain
empty: No e-mail domains currently blacklisted.
empty: No e-mail domains currently blocked.
from_html: from %{domain}
new:
create: Add domain
title: New e-mail blacklist entry
title: E-mail blacklist
title: Block new e-mail domain
title: Blocked e-mail domains
instances:
by_domain: Domain
delivery_available: Delivery is available
Expand Down Expand Up @@ -458,7 +458,7 @@ en:
pending: Waiting for relay's approval
save_and_enable: Save and enable
setup: Setup a relay connection
signatures_not_enabled: Relays will not work correctly while secure mode or whitelist mode is enabled
signatures_not_enabled: Relays will not work correctly while secure mode or limited federation mode is enabled
status: Status
title: Relays
report_notes:
Expand Down
8 changes: 4 additions & 4 deletions lib/mastodon/domains_cli.rb
Expand Up @@ -16,22 +16,22 @@ def self.exit_on_failure?
option :concurrency, type: :numeric, default: 5, aliases: [:c]
option :verbose, type: :boolean, aliases: [:v]
option :dry_run, type: :boolean
option :whitelist_mode, type: :boolean
option :limited_federation_mode, type: :boolean
desc 'purge [DOMAIN...]', 'Remove accounts from a DOMAIN without a trace'
long_desc <<-LONG_DESC
Remove all accounts from a given DOMAIN without leaving behind any
records. Unlike a suspension, if the DOMAIN still exists in the wild,
it means the accounts could return if they are resolved again.
When the --whitelist-mode option is given, instead of purging accounts
from a single domain, all accounts from domains that are not whitelisted
When the --limited-federation-mode option is given, instead of purging accounts
from a single domain, all accounts from domains that have not been explicitly allowed
are removed from the database.
LONG_DESC
def purge(*domains)
dry_run = options[:dry_run] ? ' (DRY RUN)' : ''

scope = begin
if options[:whitelist_mode]
if options[:limited_federation_mode]
Account.remote.where.not(domain: DomainAllow.pluck(:domain))
elsif !domains.empty?
Account.remote.where(domain: domains)
Expand Down

0 comments on commit 4b18382

Please sign in to comment.