mirror of
https://github.com/kikobar/mastodon.git
synced 2024-12-26 07:44:23 +00:00
Add ActivityPub handler for Delete->Actor activities (#4761)
This commit is contained in:
parent
9c04fadec9
commit
e482595a5d
|
@ -2,6 +2,20 @@
|
||||||
|
|
||||||
class ActivityPub::Activity::Delete < ActivityPub::Activity
|
class ActivityPub::Activity::Delete < ActivityPub::Activity
|
||||||
def perform
|
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_uri, account: @account)
|
||||||
status ||= Status.find_by(uri: @object['_:atomUri'], account: @account) if @object.is_a?(Hash) && @object['_:atomUri'].present?
|
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)
|
delete_now!(status)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def forward_for_reblogs(status)
|
def forward_for_reblogs(status)
|
||||||
return if @json['signature'].blank?
|
return if @json['signature'].blank?
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue