From dec061f5ae546ec118dfb12b230304723123ffa7 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 5 Dec 2023 00:55:41 -0700 Subject: [PATCH] Update FederationController, add proper statuses counts --- app/Http/Controllers/FederationController.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/FederationController.php b/app/Http/Controllers/FederationController.php index 0cf33d43e..6faea7050 100644 --- a/app/Http/Controllers/FederationController.php +++ b/app/Http/Controllers/FederationController.php @@ -124,12 +124,15 @@ class FederationController extends Controller return redirect('/' . $username); } + $id = AccountService::usernameToId($username); + abort_if(!$id, 404); + $account = AccountService::get($id); + abort_if(!$account || !isset($account['statuses_count']), 404); $res = [ '@context' => 'https://www.w3.org/ns/activitystreams', 'id' => 'https://' . config('pixelfed.domain.app') . '/users/' . $username . '/outbox', 'type' => 'OrderedCollection', - 'totalItems' => 0, - 'orderedItems' => [] + 'totalItems' => $account['statuses_count'] ?? 0, ]; return response(json_encode($res, JSON_UNESCAPED_SLASHES))->header('Content-Type', 'application/activity+json');