From 8c230b27939dd53879b161be5d7ff22e3908c23e Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 4 Apr 2019 23:19:56 -0600 Subject: [PATCH] Update Inbox --- app/Util/ActivityPub/Inbox.php | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/app/Util/ActivityPub/Inbox.php b/app/Util/ActivityPub/Inbox.php index 40b06be0a..46ba878fa 100644 --- a/app/Util/ActivityPub/Inbox.php +++ b/app/Util/ActivityPub/Inbox.php @@ -122,12 +122,15 @@ class Inbox { $activity = $this->payload['object']; $actor = $this->actorFirstOrCreate($this->payload['actor']); + if(!$actor || $actor->domain == null) { + return; + } + $inReplyTo = $activity['inReplyTo']; $url = $activity['id']; - if(!Helpers::statusFirstOrFetch($url, true)) { - return; - } + Helpers::statusFirstOrFetch($url, true); + return; } public function handleNoteCreate() @@ -139,7 +142,6 @@ class Inbox } if(Helpers::userInAudience($this->profile, $this->payload) == false) { - //Log::error('AP:inbox:userInAudience:false - Activity#'.$this->logger->id); return; } @@ -147,21 +149,8 @@ class Inbox if(Status::whereUrl($url)->exists()) { return; } - - $status = DB::transaction(function() use($activity, $actor, $url) { - $caption = str_limit(strip_tags($activity['content']), config('pixelfed.max_caption_length')); - $status = new Status; - $status->profile_id = $actor->id; - $status->caption = strip_tags($caption); - $status->rendered = Purify::clean($caption); - $status->visibility = $status->scope = 'public'; - $status->uri = $url; - $status->url = $url; - $status->save(); - return $status; - }); - - Helpers::importNoteAttachment($activity, $status); + Helpers::statusFirstOrFetch($url, false); + return; } public function handleFollowActivity()