From 0722244bd736ce00eba02da67576206a884d5d22 Mon Sep 17 00:00:00 2001 From: Shlee Date: Thu, 13 Nov 2025 11:24:24 +1030 Subject: [PATCH] Update PublicApiController.php --- app/Http/Controllers/PublicApiController.php | 35 +++++++++----------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/app/Http/Controllers/PublicApiController.php b/app/Http/Controllers/PublicApiController.php index 7466dad42..0b3e238f3 100644 --- a/app/Http/Controllers/PublicApiController.php +++ b/app/Http/Controllers/PublicApiController.php @@ -141,25 +141,22 @@ class PublicApiController extends Controller $scope = ['public', 'unlisted']; } - if ($request->filled('min_id') || $request->filled('max_id')) { - if ($request->filled('min_id')) { - $replies = $status->comments() - ->whereNull('reblog_of_id') - ->whereIn('scope', $scope) - ->select('id', 'caption', 'local', 'visibility', 'scope', 'is_nsfw', 'profile_id', 'in_reply_to_id', 'type', 'reply_count', 'created_at') - ->where('id', '>=', $request->min_id) - ->orderBy('id', 'desc') - ->paginate($limit); - } - if ($request->filled('max_id')) { - $replies = $status->comments() - ->whereNull('reblog_of_id') - ->whereIn('scope', $scope) - ->select('id', 'caption', 'local', 'visibility', 'scope', 'is_nsfw', 'profile_id', 'in_reply_to_id', 'type', 'reply_count', 'created_at') - ->where('id', '<=', $request->max_id) - ->orderBy('id', 'desc') - ->paginate($limit); - } + if ($request->filled('min_id')) { + $replies = $status->comments() + ->whereNull('reblog_of_id') + ->whereIn('scope', $scope) + ->select('id', 'caption', 'local', 'visibility', 'scope', 'is_nsfw', 'profile_id', 'in_reply_to_id', 'type', 'reply_count', 'created_at') + ->where('id', '>=', $request->min_id) + ->orderBy('id', 'desc') + ->paginate($limit); + } elseif ($request->filled('max_id')) { + $replies = $status->comments() + ->whereNull('reblog_of_id') + ->whereIn('scope', $scope) + ->select('id', 'caption', 'local', 'visibility', 'scope', 'is_nsfw', 'profile_id', 'in_reply_to_id', 'type', 'reply_count', 'created_at') + ->where('id', '<=', $request->max_id) + ->orderBy('id', 'desc') + ->paginate($limit); } else { $replies = Status::whereInReplyToId($status->id) ->whereNull('reblog_of_id')