From 8e71e0c03e9cb0a54b0453dae00fcad7687259eb Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 28 Mar 2023 20:21:54 -0600 Subject: [PATCH] Update ApiV1Controller, fix blocking remote accounts. Closes #4256 --- app/Http/Controllers/Api/ApiV1Controller.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Api/ApiV1Controller.php b/app/Http/Controllers/Api/ApiV1Controller.php index 77df9770..9b79ab86 100644 --- a/app/Http/Controllers/Api/ApiV1Controller.php +++ b/app/Http/Controllers/Api/ApiV1Controller.php @@ -1012,7 +1012,7 @@ class ApiV1Controller extends Controller $profile = Profile::findOrFail($id); - if($profile->user->is_admin == true) { + if($profile->user && $profile->user->is_admin == true) { abort(400, 'You cannot block an admin'); } @@ -1047,7 +1047,7 @@ class ApiV1Controller extends Controller ]); RelationshipService::refresh($pid, $id); - + UserFilterService::block($pid, $id); $resource = new Fractal\Resource\Item($profile, new RelationshipTransformer()); $res = $this->fractal->createData($resource)->toArray();