From d06622b7d4f51446efa54056234556bf4b013c8a Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 7 Oct 2019 03:30:53 -0600 Subject: [PATCH] Update tombstone handler --- app/Util/ActivityPub/Inbox.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/Util/ActivityPub/Inbox.php b/app/Util/ActivityPub/Inbox.php index fdd39d61..8cc001f0 100644 --- a/app/Util/ActivityPub/Inbox.php +++ b/app/Util/ActivityPub/Inbox.php @@ -307,11 +307,8 @@ class Inbox $id = $this->payload['object']['id']; switch ($type) { case 'Person': - $profile = Profile::whereNull('domain') - ->whereNull('private_key') - ->whereRemoteUrl($id) - ->first(); - if(!$profile) { + $profile = Helpers::fetchProfile($actor); + if(!$profile || $profile->private_key != null) { return; } Notification::whereActorId($profile->id)->delete(); @@ -326,11 +323,18 @@ class Inbox break; case 'Tombstone': - $status = Status::whereUri($id)->orWhere('object_url', $id)->first(); + $profile = Helpers::fetchProfile($actor); + $status = Status::whereProfileId($profile->id) + ->whereUri($id) + ->orWhereUrl($id) + ->orWhere('object_url', $id) + ->first(); if(!$status) { return; } - $status->media->delete(); + $status->media()->delete(); + $status->likes()->delete(); + $status->shares()->delete(); $status->delete(); return; break;