2023-07-19 06:03:05 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace BookStack\Activity\Notifications\Handlers;
|
|
|
|
|
|
|
|
use BookStack\Activity\Models\Loggable;
|
2023-08-04 07:27:29 -04:00
|
|
|
use BookStack\Activity\Models\Watch;
|
|
|
|
use BookStack\Activity\Tools\EntityWatchers;
|
|
|
|
use BookStack\Activity\WatchLevels;
|
|
|
|
use BookStack\Users\Models\User;
|
2023-07-19 06:03:05 -04:00
|
|
|
|
|
|
|
class PageCreationNotificationHandler implements NotificationHandler
|
|
|
|
{
|
2023-08-04 07:27:29 -04:00
|
|
|
public function handle(string $activityType, Loggable|string $detail, User $user): void
|
2023-07-19 06:03:05 -04:00
|
|
|
{
|
|
|
|
// TODO
|
2023-08-04 07:27:29 -04:00
|
|
|
|
|
|
|
// No user-level preferences to care about here.
|
|
|
|
// Possible Scenarios:
|
|
|
|
// ✅ User watching parent chapter
|
|
|
|
// ✅ User watching parent book
|
|
|
|
// ❌ User ignoring parent book
|
|
|
|
// ❌ User ignoring parent chapter
|
|
|
|
// ❌ User watching parent book, ignoring chapter
|
|
|
|
// ✅ User watching parent book, watching chapter
|
|
|
|
// ❌ User ignoring parent book, ignoring chapter
|
|
|
|
// ✅ User ignoring parent book, watching chapter
|
|
|
|
|
|
|
|
// Get all relevant watchers
|
|
|
|
$watchers = new EntityWatchers($detail, WatchLevels::NEW);
|
|
|
|
|
|
|
|
// TODO - need to check entity visibility and receive-notifications permissions.
|
|
|
|
// Maybe abstract this to a generic late-stage filter?
|
2023-07-19 06:03:05 -04:00
|
|
|
}
|
|
|
|
}
|