mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Update CommentPipeline, improve parent reply_count calculation - mysql only for now
This commit is contained in:
parent
618870add9
commit
ccc94802ec
1 changed files with 7 additions and 4 deletions
|
@ -59,10 +59,13 @@ class CommentPipeline implements ShouldQueue
|
||||||
$target = $status->profile;
|
$target = $status->profile;
|
||||||
$actor = $comment->profile;
|
$actor = $comment->profile;
|
||||||
|
|
||||||
|
if(config('database.default') === 'mysql') {
|
||||||
DB::transaction(function() use($status) {
|
DB::transaction(function() use($status) {
|
||||||
$status->reply_count = DB::table('statuses')->whereInReplyToId($status->id)->count();
|
$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();
|
$status->save();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if ($actor->id === $target->id || $status->comments_disabled == true) {
|
if ($actor->id === $target->id || $status->comments_disabled == true) {
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue