From 9517168916797dd8988c76ba9f1c194e6fb68b93 Mon Sep 17 00:00:00 2001 From: Venelin Kochev Date: Fri, 24 Apr 2026 23:02:46 +0300 Subject: [PATCH] Use sendNow for test notifications; update label MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Send test notifications immediately with Notification::sendNow() to bypass the queue — queued tests attempted to rehydrate a transient Monitor (id=0) on a worker and could silently fail, confusing users. Also update the UI text from "Test queued" to "Test sent" to reflect the immediate delivery. --- app/Livewire/Settings/Notifications.php | 5 ++++- resources/views/livewire/settings/notifications.blade.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Livewire/Settings/Notifications.php b/app/Livewire/Settings/Notifications.php index 165d2f3..96c0b15 100644 --- a/app/Livewire/Settings/Notifications.php +++ b/app/Livewire/Settings/Notifications.php @@ -121,7 +121,10 @@ public function sendTest(int $channelId): void $monitor->id = 0; $monitor->last_checked_at = now(); - NotificationFacade::send([$channel], new MonitorRecovered($monitor)); + // sendNow() bypasses the queue — a queued test would try to + // re-hydrate this transient Monitor via findOrFail($id) on the worker + // and silently fail, leaving the user wondering why nothing arrived. + NotificationFacade::sendNow([$channel], new MonitorRecovered($monitor)); $this->dispatch('notifications-test-sent', channelId: $channel->id); } diff --git a/resources/views/livewire/settings/notifications.blade.php b/resources/views/livewire/settings/notifications.blade.php index 99eaf75..b5ff0d3 100644 --- a/resources/views/livewire/settings/notifications.blade.php +++ b/resources/views/livewire/settings/notifications.blade.php @@ -50,7 +50,7 @@ class="btn btn-ghost btn-sm"> x-on:notifications-test-sent.window="if ($event.detail.channelId === {{ $channel->id }}) { sent = true; setTimeout(() => sent = false, 2500); }" class="flex items-center gap-2">