From 1515a9f11102f6174bea659ee68216435bac0592 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 8 Jan 2022 04:59:28 -0700 Subject: [PATCH 1/2] Update CommentPipeline --- app/Http/Controllers/PublicApiController.php | 2 +- app/Jobs/CommentPipeline/CommentPipeline.php | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/PublicApiController.php b/app/Http/Controllers/PublicApiController.php index 5c1921bea..a15c517df 100644 --- a/app/Http/Controllers/PublicApiController.php +++ b/app/Http/Controllers/PublicApiController.php @@ -691,7 +691,7 @@ class PublicApiController extends Controller public function accountFollowing(Request $request, $id) { - abort_if(!$request->user(), 403); + abort_if(!$request->user(), 403); $account = AccountService::get($id); abort_if(!$account, 404); $pid = $request->user()->profile_id; diff --git a/app/Jobs/CommentPipeline/CommentPipeline.php b/app/Jobs/CommentPipeline/CommentPipeline.php index 3afd825cc..e0ae491da 100644 --- a/app/Jobs/CommentPipeline/CommentPipeline.php +++ b/app/Jobs/CommentPipeline/CommentPipeline.php @@ -93,5 +93,14 @@ class CommentPipeline implements ShouldQueue NotificationService::set($notification->profile_id, $notification->id); StatusService::del($comment->id); }); + + if($exists = Cache::get('status:replies:all:' . $status->id)) { + if($exists && $exists->count() == 3) { + } else { + Cache::forget('status:replies:all:' . $status->id); + } + } else { + Cache::forget('status:replies:all:' . $status->id); + } } } From 4fe421a1662d3e094d11b53bbba2fc92d6bb7514 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 8 Jan 2022 05:01:26 -0700 Subject: [PATCH 2/2] Update ApiV1Controller --- app/Http/Controllers/Api/ApiV1Controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/ApiV1Controller.php b/app/Http/Controllers/Api/ApiV1Controller.php index 79c5a08fd..369a8996f 100644 --- a/app/Http/Controllers/Api/ApiV1Controller.php +++ b/app/Http/Controllers/Api/ApiV1Controller.php @@ -2516,7 +2516,7 @@ class ApiV1Controller extends Controller $sortBy = $request->input('sort', 'all'); if($sortBy == 'all' && !$request->has('cursor')) { - $ids = Cache::remember('status:replies:all:' . $id, 900, function() use($id) { + $ids = Cache::remember('status:replies:all:' . $id, 86400, function() use($id) { return DB::table('statuses') ->where('in_reply_to_id', $id) ->orderBy('id')