From 1d52ad0b2726e9d4f3c5e3a89bfa83e6a54c3a5b Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 17 Nov 2022 18:59:51 -0700 Subject: [PATCH] Update ApiV1Controller, fix followAccountById with firstOrCreate() --- app/Http/Controllers/Api/ApiV1Controller.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Api/ApiV1Controller.php b/app/Http/Controllers/Api/ApiV1Controller.php index c2ab4ac1..ea555dfd 100644 --- a/app/Http/Controllers/Api/ApiV1Controller.php +++ b/app/Http/Controllers/Api/ApiV1Controller.php @@ -692,10 +692,10 @@ class ApiV1Controller extends Controller (new FollowerController())->sendFollow($user->profile, $target); } } else { - $follower = new Follower(); - $follower->profile_id = $user->profile_id; - $follower->following_id = $target->id; - $follower->save(); + $follower = Follower::firstOrCreate([ + 'profile_id' => $user->profile_id, + 'following_id' => $target->id + ]); if($remote == true && config('federation.activitypub.remoteFollow') == true) { (new FollowerController())->sendFollow($user->profile, $target);