about summary refs log tree commit diff
path: root/app/models/admin/account_action.rb
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-08-08 09:59:14 -0500
committermultiple creatures <dev@multiple-creature.party>2019-08-08 12:46:17 -0500
commit4dfc40324b1f3b20550982621501e162d2ed3bed (patch)
tree1578cba8809b7db27dc82f4d439471194d5fad31 /app/models/admin/account_action.rb
parentd019e55b7bc496d3c4d942fb4ffe65bb7e149249 (diff)
add new `reject unknown` policy option to prevent spam & harassment from large/undermoderated servers
Diffstat (limited to 'app/models/admin/account_action.rb')
-rw-r--r--app/models/admin/account_action.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/admin/account_action.rb b/app/models/admin/account_action.rb
index 1ed464423..2195dc6a9 100644
--- a/app/models/admin/account_action.rb
+++ b/app/models/admin/account_action.rb
@@ -12,6 +12,7 @@ class Admin::AccountAction
     force_unlisted
     silence
     suspend
+    mark_unknown
   ).freeze
 
   attr_accessor :target_account,
@@ -66,6 +67,8 @@ class Admin::AccountAction
       handle_silence!
     when 'suspend'
       handle_suspend!
+    when 'mark_unknown'
+      handle_mark_unknown!
     end
   end
 
@@ -128,6 +131,12 @@ class Admin::AccountAction
     queue_suspension_worker!
   end
 
+  def handle_mark_unknown!
+    authorize(target_account, :mark_unknown?)
+    log_action(:mark_unknown, target_account.user)
+    target_account.mark_unknown!
+  end
+
   def text_for_warning
     [warning_preset&.text, text].compact.join("\n\n")
   end