Merge pull request #4131 from pixelfed/staging

Update StatusReplyPipeline
This commit is contained in:
daniel 2023-01-30 21:46:54 -07:00 committed by GitHub
commit c56ce9906e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View file

@ -60,6 +60,10 @@ class CommentPipeline implements ShouldQueue
$actor = $comment->profile; $actor = $comment->profile;
if(config('database.default') === 'mysql') { if(config('database.default') === 'mysql') {
$count = DB::select(DB::raw("select id, in_reply_to_id from statuses, (select @pv := :kid) initialisation where 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 {
$status->reply_count = $status->reply_count + 1; $status->reply_count = $status->reply_count + 1;
$status->save(); $status->save();
} }

View file

@ -70,6 +70,10 @@ class StatusReplyPipeline implements ShouldQueue
} }
if(config('database.default') === 'mysql') { if(config('database.default') === 'mysql') {
$count = DB::select(DB::raw("select id, in_reply_to_id from statuses, (select @pv := :kid) initialisation where 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();
} else {
$reply->reply_count = $reply->reply_count + 1; $reply->reply_count = $reply->reply_count + 1;
$reply->save(); $reply->save();
} }