diff --git a/app/Livewire/Notifications/Email.php b/app/Livewire/Notifications/Email.php index dc2a95e84..eac48cf77 100644 --- a/app/Livewire/Notifications/Email.php +++ b/app/Livewire/Notifications/Email.php @@ -14,8 +14,10 @@ class Email extends Component { protected $listeners = ['refresh' => '$refresh']; + #[Locked] public Team $team; + #[Locked] public EmailNotificationSettings $settings; #[Locked] diff --git a/app/Livewire/Notifications/Pushover.php b/app/Livewire/Notifications/Pushover.php index 2e8205f5e..f1e4c464d 100644 --- a/app/Livewire/Notifications/Pushover.php +++ b/app/Livewire/Notifications/Pushover.php @@ -5,22 +5,27 @@ namespace App\Livewire\Notifications; use App\Models\PushoverNotificationSettings; use App\Models\Team; use App\Notifications\Test; +use Livewire\Attributes\Locked; use Livewire\Attributes\Validate; use Livewire\Component; class Pushover extends Component { + protected $listeners = ['refresh' => '$refresh']; + + #[Locked] public Team $team; + #[Locked] public PushoverNotificationSettings $settings; #[Validate(['boolean'])] public bool $pushoverEnabled = false; - #[Validate(['string', 'nullable'])] + #[Validate(['nullable', 'string'])] public ?string $pushoverUserKey = null; - #[Validate(['string', 'nullable'])] + #[Validate(['nullable', 'string'])] public ?string $pushoverApiToken = null; #[Validate(['boolean'])] @@ -75,7 +80,7 @@ class Pushover extends Component if ($toModel) { $this->validate(); $this->settings->pushover_enabled = $this->pushoverEnabled; - $this->settings->pushover_user_key_key = $this->pushoverUserKey; + $this->settings->pushover_user_key = $this->pushoverUserKey; $this->settings->pushover_api_token = $this->pushoverApiToken; $this->settings->deployment_success_pushover_notifications = $this->deploymentSuccessPushoverNotifications; @@ -95,7 +100,7 @@ class Pushover extends Component refreshSession(); } else { $this->pushoverEnabled = $this->settings->pushover_enabled; - $this->pushoverUserKey = $this->settings->pushover_user_key_key; + $this->pushoverUserKey = $this->settings->pushover_user_key; $this->pushoverApiToken = $this->settings->pushover_api_token; $this->deploymentSuccessPushoverNotifications = $this->settings->deployment_success_pushover_notifications; @@ -128,6 +133,8 @@ class Pushover extends Component $this->pushoverEnabled = false; return handleError($e, $this); + } finally { + $this->dispatch('refresh'); } } @@ -137,6 +144,8 @@ class Pushover extends Component $this->syncData(true); } catch (\Throwable $e) { return handleError($e, $this); + } finally { + $this->dispatch('refresh'); } } diff --git a/app/Livewire/Notifications/Slack.php b/app/Livewire/Notifications/Slack.php index 97464fa1c..f47ad8a97 100644 --- a/app/Livewire/Notifications/Slack.php +++ b/app/Livewire/Notifications/Slack.php @@ -5,13 +5,18 @@ namespace App\Livewire\Notifications; use App\Models\SlackNotificationSettings; use App\Models\Team; use App\Notifications\Test; +use Livewire\Attributes\Locked; use Livewire\Attributes\Validate; use Livewire\Component; class Slack extends Component { + protected $listeners = ['refresh' => '$refresh']; + + #[Locked] public Team $team; + #[Locked] public SlackNotificationSettings $settings; #[Validate(['boolean'])] @@ -121,6 +126,8 @@ class Slack extends Component $this->slackEnabled = false; return handleError($e, $this); + } finally { + $this->dispatch('refresh'); } } @@ -130,6 +137,8 @@ class Slack extends Component $this->syncData(true); } catch (\Throwable $e) { return handleError($e, $this); + } finally { + $this->dispatch('refresh'); } } diff --git a/app/Livewire/Notifications/Telegram.php b/app/Livewire/Notifications/Telegram.php index de2fa9cdc..85c16b277 100644 --- a/app/Livewire/Notifications/Telegram.php +++ b/app/Livewire/Notifications/Telegram.php @@ -5,13 +5,18 @@ namespace App\Livewire\Notifications; use App\Models\Team; use App\Models\TelegramNotificationSettings; use App\Notifications\Test; +use Livewire\Attributes\Locked; use Livewire\Attributes\Validate; use Livewire\Component; class Telegram extends Component { + protected $listeners = ['refresh' => '$refresh']; + + #[Locked] public Team $team; + #[Locked] public TelegramNotificationSettings $settings; #[Validate(['boolean'])] @@ -141,7 +146,6 @@ class Telegram extends Component $this->settings->telegram_notifications_server_unreachable_topic_id = $this->telegramNotificationsServerUnreachableTopicId; $this->settings->save(); - refreshSession(); } else { $this->telegramEnabled = $this->settings->telegram_enabled; $this->telegramToken = $this->settings->telegram_token; @@ -181,6 +185,8 @@ class Telegram extends Component $this->syncData(true); } catch (\Throwable $e) { return handleError($e, $this); + } finally { + $this->dispatch('refresh'); } } @@ -210,6 +216,8 @@ class Telegram extends Component $this->telegramEnabled = false; return handleError($e, $this); + } finally { + $this->dispatch('refresh'); } }