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 d4b2d89da0
commit aae83c4fbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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();