Add ActivityPub handler for Delete->Actor activities (#4761)

lolsob-rspec
Eugen Rochko 2017-09-01 21:54:42 +02:00 committed by GitHub
parent 9ed764519b
commit 23c149c5b9
1 changed files with 14 additions and 2 deletions

View File

@ -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?