about summary refs log tree commit diff
path: root/app/models/admin
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-05-10 03:48:11 -0500
committermultiple creatures <dev@multiple-creature.party>2019-05-21 03:16:23 -0500
commit3b06175e8f5cb9d688e8ec376dbfd88abf5f3278 (patch)
tree160a6f6c97777ca022326bb93701f358fe689c99 /app/models/admin
parent5c59d1837f2d3152342ef45bf7827495183e62dd (diff)
Moderation: add `force sensitive` and `force unlisted` actions. Accounts: add federatable `adult content` tag. Handle from remote accounts as well.
Diffstat (limited to 'app/models/admin')
-rw-r--r--app/models/admin/account_action.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/models/admin/account_action.rb b/app/models/admin/account_action.rb
index 84c3f880d..1ed464423 100644
--- a/app/models/admin/account_action.rb
+++ b/app/models/admin/account_action.rb
@@ -8,6 +8,8 @@ class Admin::AccountAction
   TYPES = %w(
     none
     disable
+    force_sensitive
+    force_unlisted
     silence
     suspend
   ).freeze
@@ -56,6 +58,10 @@ class Admin::AccountAction
     case type
     when 'disable'
       handle_disable!
+    when 'force_sensitive'
+      handle_force_sensitive!
+    when 'force_unlisted'
+      handle_force_unlisted!
     when 'silence'
       handle_silence!
     when 'suspend'
@@ -97,6 +103,18 @@ class Admin::AccountAction
     target_account.user&.disable!
   end
 
+  def handle_force_sensitive!
+    authorize(target_account, :force_sensitive?)
+    log_action(:force_sensitive, target_account.user)
+    target_account.force_sensitive!
+  end
+
+  def handle_force_unlisted!
+    authorize(target_account, :force_unlisted?)
+    log_action(:force_unlisted, target_account.user)
+    target_account.force_unlisted!
+  end
+
   def handle_silence!
     authorize(target_account, :silence?)
     log_action(:silence, target_account)