From b8819fbbfeccfbef9a27927e34911b29bd6c1b3d Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 24 May 2020 03:21:40 -0600 Subject: [PATCH] Update AP Inbox, add follow notifications --- app/Util/ActivityPub/Inbox.php | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/app/Util/ActivityPub/Inbox.php b/app/Util/ActivityPub/Inbox.php index 0a190409a..0d19d97ca 100644 --- a/app/Util/ActivityPub/Inbox.php +++ b/app/Util/ActivityPub/Inbox.php @@ -197,18 +197,9 @@ class Inbox $follower->profile_id = $actor->id; $follower->following_id = $target->id; $follower->local_profile = empty($actor->domain); + $follower->save(); - if($target->domain == null) { - Notification::firstOrCreate([ - 'profile_id' => $target->id, - 'actor_id' => $actor->id, - 'action' => 'follow', - 'message' => $follower->toText(), - 'rendered' => $follower->toHtml(), - 'item_id' => $target->id, - 'item_type' => 'App\Profile' - ]); - } + FollowPipeline::dispatch($follower); // send Accept to remote profile $accept = [ @@ -446,6 +437,12 @@ class Inbox Follower::whereProfileId($profile->id) ->whereFollowingId($following->id) ->delete(); + Notification::whereProfileId($following->id) + ->whereActorId($profile->id) + ->whereAction('follow') + ->whereItemId($following->id) + ->whereItemType('App\Profile') + ->forceDelete(); break; case 'Like':