[COMPONENT][Notification] Add event to decide whether local actors should be bothered

This commit is contained in:
Diogo Peralta Cordeiro 2021-12-28 18:45:18 +00:00
parent 4d8e39bf69
commit 846ec37cd9
Signed by: diogo
GPG Key ID: 18D2D35001FBFAB0
1 changed files with 8 additions and 6 deletions

View File

@ -82,12 +82,14 @@ class Notification extends Component
continue;
}
}
// TODO: use https://symfony.com/doc/current/notifier.html
DB::persist(Entity\Notification::create([
'activity_id' => $activity->getId(),
'target_id' => $target->getId(),
'reason' => $reason,
]));
if (Event::handle('NewNotificationShould', [$activity, $target]) === Event::next) {
// TODO: use https://symfony.com/doc/current/notifier.html
DB::persist(Entity\Notification::create([
'activity_id' => $activity->getId(),
'target_id' => $target->getId(),
'reason' => $reason,
]));
}
} else {
// We have no authority nor responsibility of notifying remote actors of a remote actor's doing
if ($sender->getIsLocal()) {