forked from mirror/pixelfed
Update reply pipelines, restore reply_count logic
This commit is contained in:
parent
e10985e631
commit
0d780ffbda
2 changed files with 12 additions and 0 deletions
|
@ -59,6 +59,12 @@ class CommentPipeline implements ShouldQueue
|
|||
$target = $status->profile;
|
||||
$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 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();
|
||||
}
|
||||
|
||||
if ($actor->id === $target->id || $status->comments_disabled == true) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -68,6 +68,12 @@ class StatusReplyPipeline implements ShouldQueue
|
|||
return 1;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
DB::transaction(function() use($target, $actor, $status) {
|
||||
$notification = new Notification();
|
||||
$notification->profile_id = $target->id;
|
||||
|
|
Loading…
Reference in a new issue