From 049ce7370c2291fa8711a12503ef618ae5cc0452 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 29 Jan 2023 06:57:50 -0700 Subject: [PATCH] Update StatusReplyPipeline, fix comment counts --- app/Jobs/CommentPipeline/CommentPipeline.php | 8 -------- app/Jobs/StatusPipeline/StatusReplyPipeline.php | 8 -------- 2 files changed, 16 deletions(-) diff --git a/app/Jobs/CommentPipeline/CommentPipeline.php b/app/Jobs/CommentPipeline/CommentPipeline.php index befeee35b..b8139afbf 100644 --- a/app/Jobs/CommentPipeline/CommentPipeline.php +++ b/app/Jobs/CommentPipeline/CommentPipeline.php @@ -60,14 +60,6 @@ class CommentPipeline implements ShouldQueue $actor = $comment->profile; if(config('database.default') === 'mysql') { - $count = DB::select(DB::raw("select id, in_reply_to_id from statuses, (select @pv := :kid) initialisation where deleted_at IS NULL and reblog_of_id IS NULL and id > @pv and find_in_set(in_reply_to_id, @pv) > 0 and @pv := concat(@pv, ',', id)"), [ 'kid' => $status->id]); - $status->reply_count = count($count); - $status->save(); - - $count = DB::select(DB::raw("select id, in_reply_to_id from statuses, (select @pv := :kid) initialisation where deleted_at IS NULL and reblog_of_id IS NULL and id > @pv and find_in_set(in_reply_to_id, @pv) > 0 and @pv := concat(@pv, ',', id)"), [ 'kid' => $comment->id]); - $comment->reply_count = count($count); - $comment->save(); - } else { $status->reply_count = $status->reply_count + 1; $status->save(); } diff --git a/app/Jobs/StatusPipeline/StatusReplyPipeline.php b/app/Jobs/StatusPipeline/StatusReplyPipeline.php index 820e22d93..b5a542003 100644 --- a/app/Jobs/StatusPipeline/StatusReplyPipeline.php +++ b/app/Jobs/StatusPipeline/StatusReplyPipeline.php @@ -70,14 +70,6 @@ class StatusReplyPipeline implements ShouldQueue } if(config('database.default') === 'mysql') { - $count = DB::select( DB::raw("select id, in_reply_to_id from statuses, (select @pv := :kid) initialisation where deleted_at IS NULL and reblog_of_id IS NULL and id > @pv and find_in_set(in_reply_to_id, @pv) > 0 and @pv := concat(@pv, ',', id)"), [ 'kid' => $reply->id]); - $reply->reply_count = count($count); - $reply->save(); - - $count = DB::select( DB::raw("select id, in_reply_to_id from statuses, (select @pv := :kid) initialisation where deleted_at IS NULL and reblog_of_id IS NULL and id > @pv and find_in_set(in_reply_to_id, @pv) > 0 and @pv := concat(@pv, ',', id)"), [ 'kid' => $status->id]); - $status->reply_count = count($count); - $status->save(); - } else { $reply->reply_count = $reply->reply_count + 1; $reply->save(); }