From 8a93ed38fa6b2d96a7a67fb4f2d5d84a45215ee1 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 24 Jun 2019 23:57:48 -0600 Subject: [PATCH] Update AP Inbox --- app/Util/ActivityPub/Inbox.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/Util/ActivityPub/Inbox.php b/app/Util/ActivityPub/Inbox.php index 48cb4b015..51b8c46c2 100644 --- a/app/Util/ActivityPub/Inbox.php +++ b/app/Util/ActivityPub/Inbox.php @@ -205,21 +205,27 @@ class Inbox { $actor = $this->actorFirstOrCreate($this->payload['actor']); $activity = $this->payload['object']; + if(!$actor || $actor->domain == null) { return; } + if(Helpers::validateLocalUrl($activity) == false) { return; } - $parent = Helpers::statusFirstOrFetch($activity, true); - if(!$parent) { + + $parent = Helpers::statusFetch($activity); + + if(empty($parent)) { return; } + $status = Status::firstOrCreate([ 'profile_id' => $actor->id, 'reblog_of_id' => $parent->id, - 'type' => 'reply' + 'type' => 'share' ]); + Notification::firstOrCreate([ 'profile_id' => $parent->profile->id, 'actor_id' => $actor->id, @@ -229,6 +235,7 @@ class Inbox 'item_id' => $parent->id, 'item_type' => 'App\Status' ]); + $parent->reblogs_count = $parent->shares()->count(); $parent->save(); }