mirror of
https://github.com/flarum/framework.git
synced 2024-11-23 06:01:56 +08:00
fix(approval): posts approved for deleted users error
In certain edge cases posts get approved through moderative action and throws an error when the user has already been deleted. Ref: DISCUSS-11K on sentry
This commit is contained in:
parent
368e08bb9b
commit
b5874a08e4
|
@ -13,7 +13,7 @@ use Flarum\Approval\Event\PostWasApproved;
|
||||||
use Flarum\Post\Event\Saving;
|
use Flarum\Post\Event\Saving;
|
||||||
use Illuminate\Contracts\Events\Dispatcher;
|
use Illuminate\Contracts\Events\Dispatcher;
|
||||||
|
|
||||||
class ApproveContent
|
class ApproveContent
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param Dispatcher $events
|
* @param Dispatcher $events
|
||||||
|
@ -69,7 +69,9 @@ class ApproveContent
|
||||||
|
|
||||||
$discussion->save();
|
$discussion->save();
|
||||||
|
|
||||||
$user->refreshCommentCount();
|
if ($discussion->user) {
|
||||||
$user->save();
|
$user->refreshCommentCount();
|
||||||
|
$user->save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user