1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-30 04:23:11 +03:00

Notifications: Cleaned up mails, added debounce for updates

- Updated mail notification design to be a bit prettier, and extracted
  text to new lang file for translation.
- Added debounce logic for page update notifications.
- Fixed watch options not being filtered to current user.
This commit is contained in:
Dan Brown
2023-08-15 14:39:39 +01:00
parent 371779205a
commit 615741af9d
17 changed files with 152 additions and 70 deletions

View File

@ -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->handle($activity, $detail, $user);
}
}