about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-08-19 11:35:48 +0200
committermultiple creatures <dev@multiple-creature.party>2020-02-21 01:11:33 -0600
commit7709d95f00580301aa0c14071b7d57e58926172e (patch)
tree9bc985f95dd74cd7f12ae3db972704c061c521bc /app/models
parent38c7f794f1c9084be792d1b3e7e71a39b36ea090 (diff)
(lazily) port tootsuite#11298 to monsterfork: Add public blocks to /about/blocks
* Add automatic blocklist display in /about/blocks

Inspired by https://github.com/Gargron/mastodon.social-misc

* Add admin option to set who can see instance blocks

* Normalize locales files

* Rename “Sandbox” to “Silence” for consistency

* Disable /about/blocks when in whitelist mode

* Optionally display rationale for domain blocks

* Only display domain blocks that have user-facing limitations, and order them

* Redesign table of blocked domains to better handle long domain names and rationales

* Change domain blocks ordering now that rationales aren't displayed right away

* Only show explanation for block severities actually in use

* Reword instance block explanations and add disclaimer for public fetch mode
Diffstat (limited to 'app/models')
-rw-r--r--app/models/domain_block.rb1
-rw-r--r--app/models/form/admin_settings.rb8
2 files changed, 5 insertions, 4 deletions
diff --git a/app/models/domain_block.rb b/app/models/domain_block.rb
index 26cec6ae6..1d0b25772 100644
--- a/app/models/domain_block.rb
+++ b/app/models/domain_block.rb
@@ -29,6 +29,7 @@ class DomainBlock < ApplicationRecord
 
   scope :matches_domain, ->(value) { where(arel_table[:domain].matches("%#{value}%")) }
   scope :unprocessed, -> { where(processing: true) }
+  scope :with_user_facing_limitations, -> { where(severity: [:silence, :suspend]).or(where(reject_media: true)).or(where(reject_unknown: true).or(where(manual_only: true))) }
 
   before_save :set_processing
 
diff --git a/app/models/form/admin_settings.rb b/app/models/form/admin_settings.rb
index c9cd3a87f..08107ee68 100644
--- a/app/models/form/admin_settings.rb
+++ b/app/models/form/admin_settings.rb
@@ -41,10 +41,8 @@ class Form::AdminSettings
     always_mark_instance_actors_known
     werewolf_status
     spam_check_enabled
-    mark_known_from_follows
-    mark_known_from_mentions
-    mark_known_from_boosts
-    mark_known_from_favourites
+    show_domain_blocks
+    show_domain_blocks_rationale
   ).freeze
 
   BOOLEAN_KEYS = %i(
@@ -92,6 +90,8 @@ class Form::AdminSettings
   validates :site_contact_email, :site_contact_username, presence: true
   validates :site_contact_username, existing_username: true
   validates :bootstrap_timeline_accounts, existing_username: { multiple: true }
+  validates :show_domain_blocks, inclusion: { in: %w(disabled users all) }
+  validates :show_domain_blocks_rationale, inclusion: { in: %w(disabled users all) }
 
   def initialize(_attributes = {})
     super