about summary refs log tree commit diff
path: root/app/lib
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-09-01 21:54:42 +0200
committerGitHub <noreply@github.com>2017-09-01 21:54:42 +0200
commite482595a5dfd69efacffeddbd48f48c5b92deaea (patch)
treede7085e5f79d9f302263e321b786528958d26d87 /app/lib
parent9c04fadec9d7b98d8c3ce942418fcd15455eda76 (diff)
Add ActivityPub handler for Delete->Actor activities (#4761)
Diffstat (limited to 'app/lib')
-rw-r--r--app/lib/activitypub/activity/delete.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/app/lib/activitypub/activity/delete.rb b/app/lib/activitypub/activity/delete.rb
index 767909fb1..9d804c86d 100644
--- a/app/lib/activitypub/activity/delete.rb
+++ b/app/lib/activitypub/activity/delete.rb
@@ -2,6 +2,20 @@
 
 class ActivityPub::Activity::Delete < ActivityPub::Activity
   def perform
+    if @account.uri == object_uri
+      delete_person
+    else
+      delete_note
+    end
+  end
+
+  private
+
+  def delete_person
+    SuspendAccountService.new.call(@account)
+  end
+
+  def delete_note
     status   = Status.find_by(uri: object_uri, account: @account)
     status ||= Status.find_by(uri: @object['_:atomUri'], account: @account) if @object.is_a?(Hash) && @object['_:atomUri'].present?
 
@@ -13,8 +27,6 @@ class ActivityPub::Activity::Delete < ActivityPub::Activity
     delete_now!(status)
   end
 
-  private
-
   def forward_for_reblogs(status)
     return if @json['signature'].blank?