From 1fa077fc8af0e3aca81373f1a6bec63569fa651a Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 7 Jun 2023 17:24:37 +0200 Subject: [PATCH] update --- .../Notifications/DiscordSettings.php | 2 +- .../Livewire/Notifications/EmailSettings.php | 23 +++++++++++++++++++ app/Http/Livewire/Notifications/Test.php | 19 --------------- .../views/components/team/navbar.blade.php | 3 ++- .../views/components/use-magic-bar.blade.php | 2 +- .../notifications/discord-settings.blade.php | 4 ++++ .../notifications/email-settings.blade.php | 9 ++++++++ .../livewire/notifications/test.blade.php | 6 ----- resources/views/projects.blade.php | 4 ---- resources/views/server/all.blade.php | 7 +++--- resources/views/team/notifications.blade.php | 1 - 11 files changed, 43 insertions(+), 37 deletions(-) delete mode 100644 app/Http/Livewire/Notifications/Test.php delete mode 100644 resources/views/livewire/notifications/test.blade.php diff --git a/app/Http/Livewire/Notifications/DiscordSettings.php b/app/Http/Livewire/Notifications/DiscordSettings.php index 4e68cff66..504b60ac5 100644 --- a/app/Http/Livewire/Notifications/DiscordSettings.php +++ b/app/Http/Livewire/Notifications/DiscordSettings.php @@ -17,7 +17,7 @@ class DiscordSettings extends Component 'model.extra_attributes.discord_webhook' => 'required|url', ]; protected $validationAttributes = [ - 'model.extra_attributes.discord_webhook' => '', + 'model.extra_attributes.discord_webhook' => 'Discord Webhook', ]; public function instantSave() diff --git a/app/Http/Livewire/Notifications/EmailSettings.php b/app/Http/Livewire/Notifications/EmailSettings.php index a8240ac70..ae2b9a815 100644 --- a/app/Http/Livewire/Notifications/EmailSettings.php +++ b/app/Http/Livewire/Notifications/EmailSettings.php @@ -2,7 +2,10 @@ namespace App\Http\Livewire\Notifications; +use App\Models\InstanceSettings; use App\Models\Team; +use App\Notifications\TestNotification; +use Illuminate\Support\Facades\Notification; use Livewire\Component; class EmailSettings extends Component @@ -33,6 +36,22 @@ class EmailSettings extends Component 'model.extra_attributes.smtp_password' => '', 'model.extra_attributes.smtp_test_recipients' => '', ]; + public function copySMTP() + { + $settings = InstanceSettings::get(); + $this->model->extra_attributes->smtp_active = true; + $this->model->extra_attributes->smtp_from_address = $settings->extra_attributes->smtp_from_address; + $this->model->extra_attributes->smtp_from_name = $settings->extra_attributes->smtp_from_name; + $this->model->extra_attributes->smtp_recipients = $settings->extra_attributes->smtp_recipients; + $this->model->extra_attributes->smtp_host = $settings->extra_attributes->smtp_host; + $this->model->extra_attributes->smtp_port = $settings->extra_attributes->smtp_port; + $this->model->extra_attributes->smtp_encryption = $settings->extra_attributes->smtp_encryption; + $this->model->extra_attributes->smtp_username = $settings->extra_attributes->smtp_username; + $this->model->extra_attributes->smtp_password = $settings->extra_attributes->smtp_password; + $this->model->extra_attributes->smtp_timeout = $settings->extra_attributes->smtp_timeout; + $this->model->extra_attributes->smtp_test_recipients = $settings->extra_attributes->smtp_test_recipients; + $this->saveModel(); + } public function submit() { $this->resetErrorBag(); @@ -48,6 +67,10 @@ private function saveModel() session(['currentTeam' => $this->model]); } } + public function sendTestNotification() + { + Notification::send($this->model, new TestNotification); + } public function instantSave() { try { diff --git a/app/Http/Livewire/Notifications/Test.php b/app/Http/Livewire/Notifications/Test.php deleted file mode 100644 index dadb165f0..000000000 --- a/app/Http/Livewire/Notifications/Test.php +++ /dev/null @@ -1,19 +0,0 @@ -model, new TestNotification); - $this->emit('saved', 'Test notification sent.'); - } -} diff --git a/resources/views/components/team/navbar.blade.php b/resources/views/components/team/navbar.blade.php index 9d84d60f3..7bb1bf35d 100644 --- a/resources/views/components/team/navbar.blade.php +++ b/resources/views/components/team/navbar.blade.php @@ -2,7 +2,8 @@

Team