diff --git a/components/Notification/Notification.php b/components/Notification/Notification.php index daff732ebe..07b0bf74dc 100644 --- a/components/Notification/Notification.php +++ b/components/Notification/Notification.php @@ -85,14 +85,6 @@ class Notification extends Component continue; } // TODO: use https://symfony.com/doc/current/notifier.html - // XXX: Unideal as in failures the rollback will leave behind a false notification, - // but most notifications (all) require flushing the objects first - // Should be okay as long as implementors bear this in mind - DB::wrapInTransaction(fn () => 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 @@ -100,6 +92,14 @@ class Notification extends Component $remote_targets[] = $target; } } + // XXX: Unideal as in failures the rollback will leave behind a false notification, + // but most notifications (all) require flushing the objects first + // Should be okay as long as implementors bear this in mind + DB::wrapInTransaction(fn () => DB::persist(Entity\Notification::create([ + 'activity_id' => $activity->getId(), + 'target_id' => $target->getId(), + 'reason' => $reason, + ]))); } FreeNetwork::notify($sender, $activity, $remote_targets, $reason);