Fix deleting posts/discussions by deleted user (#2521)

Making the $user argument nullable prevents this unnecessary exception, and doesn't introduce any issues since we check that $user exists as part of the method.
This commit is contained in:
Alexander Skvortsov 2021-01-07 17:46:14 -05:00 committed by GitHub
parent 403ee77c6c
commit a1a2598c03

View File

@ -65,7 +65,7 @@ class UserMetadataUpdater
/**
* @param \Flarum\User\User $user
*/
private function updateCommentsCount(User $user)
private function updateCommentsCount(?User $user)
{
if ($user && $user->exists) {
$user->refreshCommentCount()->save();