diff --git a/components/Notification/Notification.php b/components/Notification/Notification.php index 9f19507efc..62ddce6658 100644 --- a/components/Notification/Notification.php +++ b/components/Notification/Notification.php @@ -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()) {