From d645d6ca26e63f9495337f5d98b474ea027ad084 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 10 May 2024 23:54:47 -0600 Subject: [PATCH 1/2] Update ApiV1Controller, add pe (pixelfed entity) support to /api/v1/statuses/{id}/context endpoint --- app/Http/Controllers/Api/ApiV1Controller.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Api/ApiV1Controller.php b/app/Http/Controllers/Api/ApiV1Controller.php index d449923ae..bea98b9de 100644 --- a/app/Http/Controllers/Api/ApiV1Controller.php +++ b/app/Http/Controllers/Api/ApiV1Controller.php @@ -3020,9 +3020,9 @@ class ApiV1Controller extends Controller abort_unless($request->user()->tokenCan('read'), 403); $user = $request->user(); - AccountService::setLastActive($user->id); $pid = $user->profile_id; $status = StatusService::getMastodon($id, false); + $pe = $request->has(self::PF_API_ENTITY_KEY); if (! $status || ! isset($status['account'])) { return response('', 404); @@ -3049,7 +3049,9 @@ class ApiV1Controller extends Controller $descendants = []; if ($status['in_reply_to_id']) { - $ancestors[] = StatusService::getMastodon($status['in_reply_to_id'], false); + $ancestors[] = $pe ? + StatusService::get($status['in_reply_to_id'], false) : + StatusService::getMastodon($status['in_reply_to_id'], false); } if ($status['replies_count']) { @@ -3059,8 +3061,10 @@ class ApiV1Controller extends Controller ->where('in_reply_to_id', $id) ->limit(20) ->pluck('id') - ->map(function ($sid) { - return StatusService::getMastodon($sid, false); + ->map(function ($sid) use ($pe) { + return $pe ? + StatusService::get($sid, false) : + StatusService::getMastodon($sid, false); }) ->filter(function ($post) use ($filters) { return $post && isset($post['account'], $post['account']['id']) && ! in_array($post['account']['id'], $filters); From 66f7dbcff2f6d920bbc5d0fdd6acd376ea0a068c Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 10 May 2024 23:55:13 -0600 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b532a454f..7d6ac4aa2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,9 @@ ### Updates - Update DirectMessageController, add 72 hour delay for new accounts before they can send a DM ([61d105fd](https://github.com/pixelfed/pixelfed/commit/61d105fd)) -- Update AdminCuratedRegisterController, increase message length from 1000 to 3000 ([9a5e3471](https://github.com/pixelfed/pixelfed/commit/)) -- ([](https://github.com/pixelfed/pixelfed/commit/9a5e3471)) +- Update AdminCuratedRegisterController, increase message length from 1000 to 3000 ([9a5e3471](https://github.com/pixelfed/pixelfed/commit/9a5e3471)) +- Update ApiV1Controller, add pe (pixelfed entity) support to /api/v1/statuses/{id}/context endpoint ([d645d6ca](https://github.com/pixelfed/pixelfed/commit/d645d6ca)) +- ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.12.1 (2024-05-07)](https://github.com/pixelfed/pixelfed/compare/v0.12.0...v0.12.1)