Update AP Inbox

This commit is contained in:
Daniel Supernault 2018-12-24 21:42:31 -07:00
parent 919a6d6fd9
commit d11c71cdec
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -271,7 +271,19 @@ class Inbox
public function handleDeleteActivity()
{
$actor = $this->payload['actor'];
$obj = $this->payload['object'];
if(is_string($obj) && Helpers::validateUrl($obj)) {
// actor object detected
} else if (is_array($obj) && isset($obj['type']) && $obj['type'] == 'Tombstone') {
// tombstone detected
$status = Status::whereUri($obj['id'])->first();
if($status == null) {
return;
}
$status->forceDelete();
}
}
public function handleLikeActivity()
@ -311,7 +323,21 @@ class Inbox
$status = Helpers::statusFirstOrFetch($obj['object']);
Like::whereProfileId($profile->id)
->whereStatusId($status->id)
->delete();
->forceDelete();
break;
case 'Announce':
$parent = Helpers::statusFirstOrFetch($obj['object']);
$status = Status::whereProfileId($profile->id)
->whereReblogOfId($parent->id)
->first();
Notification::whereProfileId($parent->profile->id)
->whereActorId($profile->id)
->whereAction('share')
->whereItemId($status->id)
->whereItemType('App\Status')
->forceDelete();
$status->forceDelete();
break;
}