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;
*/
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);
}
}