From 28bc7aa439125ba16b3e888e5300f7c92504089a Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 8 Jun 2024 03:02:18 -0600 Subject: [PATCH 1/2] Update ApiV1Controller, fix self relationship response --- app/Http/Controllers/Api/ApiV1Controller.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Api/ApiV1Controller.php b/app/Http/Controllers/Api/ApiV1Controller.php index 58a155e84..8c6b18202 100644 --- a/app/Http/Controllers/Api/ApiV1Controller.php +++ b/app/Http/Controllers/Api/ApiV1Controller.php @@ -972,10 +972,22 @@ class ApiV1Controller extends Controller $napi = $request->has(self::PF_API_ENTITY_KEY); $pid = $request->user()->profile_id ?? $request->user()->profile->id; $res = collect($ids) - ->filter(function ($id) use ($pid) { - return intval($id) !== intval($pid); - }) ->map(function ($id) use ($pid, $napi) { + if (intval($id) === intval($pid)) { + return [ + 'id' => $id, + 'following' => false, + 'followed_by' => false, + 'blocking' => false, + 'muting' => false, + 'muting_notifications' => false, + 'requested' => false, + 'domain_blocking' => false, + 'showing_reblogs' => false, + 'endorsed' => false, + ]; + } + return $napi ? RelationshipService::getWithDate($pid, $id) : RelationshipService::get($pid, $id); From 3c6b9e6641020c7df487faeccd80c95bb4df616b Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 8 Jun 2024 03:02:53 -0600 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 888728bce..40fb20909 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,8 @@ - Update ApiV1Controller, add settings to verify_credentials endpoint ([3f4e0b94](https://github.com/pixelfed/pixelfed/commit/3f4e0b94)) - Update ApiV1Controller, fix update_credentials boolean handling ([19c62aaa](https://github.com/pixelfed/pixelfed/commit/19c62aaa)) - Update ApiV1Controller, fix cache invalidation bug in update_credentials ([d56a4108](https://github.com/pixelfed/pixelfed/commit/d56a4108)) +- Update ApiV1Controller, fix self relationship response ([28bc7aa4](https://github.com/pixelfed/pixelfed/commit/28bc7aa4)) +- ([](https://github.com/pixelfed/pixelfed/commit/)) - ([](https://github.com/pixelfed/pixelfed/commit/)) - ([](https://github.com/pixelfed/pixelfed/commit/))