mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-29 17:53:16 +00:00
Update CommentPipeline, move reply_count calculation to comment pipeline job and improve count calculation
This commit is contained in:
parent
945a7e49f5
commit
b6b0837f49
2 changed files with 13 additions and 9 deletions
|
@ -73,14 +73,11 @@ class CommentController extends Controller
|
||||||
$reply->visibility = $scope;
|
$reply->visibility = $scope;
|
||||||
$reply->save();
|
$reply->save();
|
||||||
|
|
||||||
$status->reply_count++;
|
|
||||||
$status->save();
|
|
||||||
|
|
||||||
return $reply;
|
return $reply;
|
||||||
});
|
});
|
||||||
|
|
||||||
StatusService::del($status->id);
|
StatusService::del($status->id);
|
||||||
NewStatusPipeline::dispatch($reply, false);
|
NewStatusPipeline::dispatch($reply);
|
||||||
CommentPipeline::dispatch($status, $reply);
|
CommentPipeline::dispatch($status, $reply);
|
||||||
|
|
||||||
if ($request->ajax()) {
|
if ($request->ajax()) {
|
||||||
|
|
|
@ -8,6 +8,7 @@ use App\{
|
||||||
UserFilter
|
UserFilter
|
||||||
};
|
};
|
||||||
use App\Services\NotificationService;
|
use App\Services\NotificationService;
|
||||||
|
use App\Services\StatusService;
|
||||||
use DB, Cache, Log;
|
use DB, Cache, Log;
|
||||||
use Illuminate\Support\Facades\Redis;
|
use Illuminate\Support\Facades\Redis;
|
||||||
|
|
||||||
|
@ -58,6 +59,11 @@ class CommentPipeline implements ShouldQueue
|
||||||
$target = $status->profile;
|
$target = $status->profile;
|
||||||
$actor = $comment->profile;
|
$actor = $comment->profile;
|
||||||
|
|
||||||
|
DB::transaction(function() use($status) {
|
||||||
|
$status->reply_count = DB::table('statuses')->whereInReplyToId($status->id)->count();
|
||||||
|
$status->save();
|
||||||
|
});
|
||||||
|
|
||||||
if ($actor->id === $target->id || $status->comments_disabled == true) {
|
if ($actor->id === $target->id || $status->comments_disabled == true) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -85,6 +91,7 @@ class CommentPipeline implements ShouldQueue
|
||||||
|
|
||||||
NotificationService::setNotification($notification);
|
NotificationService::setNotification($notification);
|
||||||
NotificationService::set($notification->profile_id, $notification->id);
|
NotificationService::set($notification->profile_id, $notification->id);
|
||||||
|
StatusService::del($status->id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue