X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/9779c1a357d49654856ceb1b1f30d91cde8fa2fd..refs/pull/5488/head:/app/Activity/Notifications/NotificationManager.php diff --git a/app/Activity/Notifications/NotificationManager.php b/app/Activity/Notifications/NotificationManager.php index 01361c1ee..294f56ebb 100644 --- a/app/Activity/Notifications/NotificationManager.php +++ b/app/Activity/Notifications/NotificationManager.php @@ -3,6 +3,7 @@ namespace BookStack\Activity\Notifications; use BookStack\Activity\ActivityType; +use BookStack\Activity\Models\Activity; use BookStack\Activity\Models\Loggable; use BookStack\Activity\Notifications\Handlers\CommentCreationNotificationHandler; use BookStack\Activity\Notifications\Handlers\NotificationHandler; @@ -17,13 +18,14 @@ class NotificationManager */ protected array $handlers = []; - public function handle(string $activityType, string|Loggable $detail, User $user): void + public function handle(Activity $activity, string|Loggable $detail, User $user): void { + $activityType = $activity->type; $handlersToRun = $this->handlers[$activityType] ?? []; foreach ($handlersToRun as $handlerClass) { /** @var NotificationHandler $handler */ - $handler = app()->make($handlerClass); - $handler->handle($activityType, $detail, $user); + $handler = new $handlerClass(); + $handler->handle($activity, $detail, $user); } }