From 788f76cf35dbd6c232067183518963d01e1eeac9 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 6 Oct 2019 21:36:02 -0600 Subject: [PATCH] Update ApiControllers, fix missing share/like counts --- app/Http/Controllers/Api/ApiV1Controller.php | 12 ++++++++++++ app/Http/Controllers/PublicApiController.php | 9 ++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/ApiV1Controller.php b/app/Http/Controllers/Api/ApiV1Controller.php index c95b7e477..e99d45c77 100644 --- a/app/Http/Controllers/Api/ApiV1Controller.php +++ b/app/Http/Controllers/Api/ApiV1Controller.php @@ -312,6 +312,8 @@ class ApiV1Controller extends Controller 'scope', 'local', 'place_id', + 'likes_count', + 'reblogs_count', 'created_at', 'updated_at' )->whereProfileId($profile->id) @@ -335,6 +337,8 @@ class ApiV1Controller extends Controller 'scope', 'local', 'place_id', + 'likes_count', + 'reblogs_count', 'created_at', 'updated_at' )->whereProfileId($profile->id) @@ -1224,6 +1228,8 @@ class ApiV1Controller extends Controller 'scope', 'local', 'reply_count', + 'likes_count', + 'reblogs_count', 'comments_disabled', 'place_id', 'created_at', @@ -1251,6 +1257,8 @@ class ApiV1Controller extends Controller 'local', 'reply_count', 'comments_disabled', + 'likes_count', + 'reblogs_count', 'place_id', 'created_at', 'updated_at' @@ -1319,6 +1327,8 @@ class ApiV1Controller extends Controller 'reply_count', 'comments_disabled', 'place_id', + 'likes_count', + 'reblogs_count', 'created_at', 'updated_at' )->whereNull('uri') @@ -1345,6 +1355,8 @@ class ApiV1Controller extends Controller 'reply_count', 'comments_disabled', 'place_id', + 'likes_count', + 'reblogs_count', 'created_at', 'updated_at' )->whereNull('uri') diff --git a/app/Http/Controllers/PublicApiController.php b/app/Http/Controllers/PublicApiController.php index dee909acf..ac8bfea60 100644 --- a/app/Http/Controllers/PublicApiController.php +++ b/app/Http/Controllers/PublicApiController.php @@ -275,6 +275,8 @@ class PublicApiController extends Controller 'reply_count', 'comments_disabled', 'place_id', + 'likes_count', + 'reblogs_count', 'created_at', 'updated_at' )->where('id', $dir, $id) @@ -304,6 +306,8 @@ class PublicApiController extends Controller 'comments_disabled', 'created_at', 'place_id', + 'likes_count', + 'reblogs_count', 'updated_at' )->whereIn('type', ['photo', 'photo:album', 'video', 'video:album']) ->with('profile', 'hashtags', 'mentions') @@ -384,6 +388,8 @@ class PublicApiController extends Controller 'reply_count', 'comments_disabled', 'place_id', + 'likes_count', + 'reblogs_count', 'created_at', 'updated_at' )->whereIn('type', ['photo', 'photo:album', 'video', 'video:album']) @@ -411,6 +417,8 @@ class PublicApiController extends Controller 'reply_count', 'comments_disabled', 'place_id', + 'likes_count', + 'reblogs_count', 'created_at', 'updated_at' )->whereIn('type', ['photo', 'photo:album', 'video', 'video:album']) @@ -626,7 +634,6 @@ class PublicApiController extends Controller } } - $dir = $min_id ? '>' : '<'; $id = $min_id ?? $max_id; $timeline = Status::select(