about summary refs log tree commit diff
path: root/app/controllers/concerns
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2020-11-08 00:28:39 +0100
committerGitHub <noreply@github.com>2020-11-08 00:28:39 +0100
commit3134691948aeacb16b7386ed77bbea4581beec40 (patch)
tree45ecf62f19879f08bf4c35584c58a64ea09c0c27 /app/controllers/concerns
parentee8cf246cfe8e05914ad7dcf81596f8535b3e161 (diff)
Add support for reversible suspensions through ActivityPub (#14989)
Diffstat (limited to 'app/controllers/concerns')
-rw-r--r--app/controllers/concerns/account_owned_concern.rb20
1 files changed, 19 insertions, 1 deletions
diff --git a/app/controllers/concerns/account_owned_concern.rb b/app/controllers/concerns/account_owned_concern.rb
index 460f71f65..62e379846 100644
--- a/app/controllers/concerns/account_owned_concern.rb
+++ b/app/controllers/concerns/account_owned_concern.rb
@@ -29,6 +29,24 @@ module AccountOwnedConcern
   end
 
   def check_account_suspension
-    expires_in(3.minutes, public: true) && gone if @account.suspended?
+    if @account.suspended_permanently?
+      permanent_suspension_response
+    elsif @account.suspended? && !skip_temporary_suspension_response?
+      temporary_suspension_response
+    end
+  end
+
+  def skip_temporary_suspension_response?
+    false
+  end
+
+  def permanent_suspension_response
+    expires_in(3.minutes, public: true)
+    gone
+  end
+
+  def temporary_suspension_response
+    expires_in(3.minutes, public: true)
+    forbidden
   end
 end