From 8444d2dc5007b8876ed10c496c0c50416c3d0f96 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 18 Nov 2020 15:23:11 -0700 Subject: [PATCH] Update AP Inbox --- app/Util/ActivityPub/Inbox.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/app/Util/ActivityPub/Inbox.php b/app/Util/ActivityPub/Inbox.php index 2053b7cc..80e83e91 100644 --- a/app/Util/ActivityPub/Inbox.php +++ b/app/Util/ActivityPub/Inbox.php @@ -139,6 +139,19 @@ class Inbox public function handleCreateActivity() { $activity = $this->payload['object']; + $actor = $this->actorFirstOrCreate($this->payload['actor']); + if(!$actor || $actor->domain == null) { + return; + } + $to = $activity['to']; + $cc = $activity['cc']; + if(count($to) == 1 && + count($cc) == 0 && + parse_url($to[0], PHP_URL_HOST) == config('pixelfed.domain.app') + ) { + $this->handleDirectMessage(); + return; + } if(!$this->verifyNoteAttachment()) { return; } @@ -172,15 +185,6 @@ class Inbox if(!$actor || $actor->domain == null) { return; } - $to = $activity['to']; - $cc = $activity['cc']; - if(count($to) == 1 && - count($cc) == 0 && - parse_url($to[0], PHP_URL_HOST) == config('pixelfed.domain.app') - ) { - $this->handleDirectMessage(); - return; - } if($actor->followers()->count() == 0) { return;