Update tombstone handler

This commit is contained in:
Daniel Supernault 2019-10-07 03:30:53 -06:00
parent d3eaccf706
commit d06622b7d4
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
1 changed files with 11 additions and 7 deletions

View File

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