mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-28 17:02:04 +03:00
Notifications: Started core user notification logic
Put together an initial notification. Started logic to query and identify watchers.
This commit is contained in:
@ -8,6 +8,7 @@ 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 +17,13 @@ class NotificationManager
|
||||
*/
|
||||
protected array $handlers = [];
|
||||
|
||||
public function handle(string $activityType, string|Loggable $detail): void
|
||||
public function handle(string $activityType, string|Loggable $detail, User $user): void
|
||||
{
|
||||
$handlersToRun = $this->handlers[$activityType] ?? [];
|
||||
foreach ($handlersToRun as $handlerClass) {
|
||||
/** @var NotificationHandler $handler */
|
||||
$handler = app()->make($handlerClass);
|
||||
$handler->handle($activityType, $detail);
|
||||
$handler->handle($activityType, $detail, $user);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user