From d85a7800faa7ac08b41911d28fd9bf34d0f652d2 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Thu, 10 Sep 2026 09:06:17 +0200 Subject: [PATCH] feat(notifications): allow toggling restart-limit email events Add restartLimitReached to the notification event toggle list so admins can disable restart-limit email notifications. Cover the toggle with an authorization test. --- .../Concerns/TogglesNotificationEvents.php | 1 + .../Authorization/NotificationAuthorizationTest.php | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/app/Livewire/Notifications/Concerns/TogglesNotificationEvents.php b/app/Livewire/Notifications/Concerns/TogglesNotificationEvents.php index decd4fe3a..4433de024 100644 --- a/app/Livewire/Notifications/Concerns/TogglesNotificationEvents.php +++ b/app/Livewire/Notifications/Concerns/TogglesNotificationEvents.php @@ -8,6 +8,7 @@ trait TogglesNotificationEvents 'deploymentSuccess', 'deploymentFailure', 'statusChange', + 'restartLimitReached', 'backupSuccess', 'backupFailure', 'scheduledTaskSuccess', diff --git a/tests/Feature/Authorization/NotificationAuthorizationTest.php b/tests/Feature/Authorization/NotificationAuthorizationTest.php index d4fa8dfc9..424696c17 100644 --- a/tests/Feature/Authorization/NotificationAuthorizationTest.php +++ b/tests/Feature/Authorization/NotificationAuthorizationTest.php @@ -288,6 +288,18 @@ expect($this->admin->can('update', $settings))->toBeTrue(); }); +test('admin can disable restart limit email notifications', function () { + $this->actingAs($this->admin); + session(['currentTeam' => $this->team]); + + Livewire::test(EmailNotification::class) + ->assertSet('restartLimitReachedEmailNotifications', true) + ->call('toggleEvent', 'restartLimitReachedEmailNotifications') + ->assertSet('restartLimitReachedEmailNotifications', false); + + expect($this->team->emailNotificationSettings->fresh()->restart_limit_reached_email_notifications)->toBeFalse(); +}); + test('admin can save team smtp settings without a resend api key when resend is disabled', function () { $this->actingAs($this->admin); session(['currentTeam' => $this->team]);