X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/100b28707cbda87a57d5f1d31c6e33f88642caa6..refs/pull/5591/head:/app/Activity/Notifications/NotificationManager.php diff --git a/app/Activity/Notifications/NotificationManager.php b/app/Activity/Notifications/NotificationManager.php index 5864b8456..294f56ebb 100644 --- a/app/Activity/Notifications/NotificationManager.php +++ b/app/Activity/Notifications/NotificationManager.php @@ -3,11 +3,13 @@ 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; use BookStack\Activity\Notifications\Handlers\PageCreationNotificationHandler; use BookStack\Activity\Notifications\Handlers\PageUpdateNotificationHandler; +use BookStack\Users\Models\User; class NotificationManager { @@ -16,13 +18,14 @@ class NotificationManager */ protected array $handlers = []; - public function handle(string $activityType, string|Loggable $detail): 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); + $handler = new $handlerClass(); + $handler->handle($activity, $detail, $user); } }