From 766fa85c4ce13988cd665f43fe66fddfc74c351d Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 28 Jul 2023 11:49:25 +0200 Subject: [PATCH] fixes --- .../Livewire/Notifications/EmailSettings.php | 28 +++++++----- app/Models/Team.php | 2 - .../notifications/email-settings.blade.php | 44 ++++++++++--------- 3 files changed, 40 insertions(+), 34 deletions(-) diff --git a/app/Http/Livewire/Notifications/EmailSettings.php b/app/Http/Livewire/Notifications/EmailSettings.php index 1dd3746e8..aa72b5478 100644 --- a/app/Http/Livewire/Notifications/EmailSettings.php +++ b/app/Http/Livewire/Notifications/EmailSettings.php @@ -55,17 +55,23 @@ public function copyFromInstanceSettings() { $settings = InstanceSettings::get(); if ($settings->smtp_enabled) { - $this->model->smtp_enabled = true; - $this->model->smtp_from_address = $settings->smtp_from_address; - $this->model->smtp_from_name = $settings->smtp_from_name; - $this->model->smtp_recipients = $settings->smtp_recipients; - $this->model->smtp_host = $settings->smtp_host; - $this->model->smtp_port = $settings->smtp_port; - $this->model->smtp_encryption = $settings->smtp_encryption; - $this->model->smtp_username = $settings->smtp_username; - $this->model->smtp_password = $settings->smtp_password; - $this->model->smtp_timeout = $settings->smtp_timeout; - $this->saveModel(); + $team = auth()->user()->currentTeam(); + $team->smtp_enabled = true; + $team->smtp_from_address = $settings->smtp_from_address; + $team->smtp_from_name = $settings->smtp_from_name; + $team->smtp_recipients = $settings->smtp_recipients; + $team->smtp_host = $settings->smtp_host; + $team->smtp_port = $settings->smtp_port; + $team->smtp_encryption = $settings->smtp_encryption; + $team->smtp_username = $settings->smtp_username; + $team->smtp_password = $settings->smtp_password; + $team->smtp_timeout = $settings->smtp_timeout; + $team->save(); + $this->decrypt(); + if (is_a($team, Team::class)) { + session(['currentTeam' => $this->model]); + } + $this->emit('success', 'Settings saved.'); } else { $this->emit('error', 'Instance SMTP settings are not enabled.'); } diff --git a/app/Models/Team.php b/app/Models/Team.php index ccd7613a6..331c969d7 100644 --- a/app/Models/Team.php +++ b/app/Models/Team.php @@ -26,10 +26,8 @@ public function routeNotificationForDiscord() public function getRecepients($notification) { $recipients = data_get($notification,'emails',null); - ray($recipients); if (is_null($recipients)) { $recipients = $this->members()->pluck('email')->toArray(); - ray($recipients); return $recipients; } return explode(',', $recipients); diff --git a/resources/views/livewire/notifications/email-settings.blade.php b/resources/views/livewire/notifications/email-settings.blade.php index 436b09cf1..ae10dc95b 100644 --- a/resources/views/livewire/notifications/email-settings.blade.php +++ b/resources/views/livewire/notifications/email-settings.blade.php @@ -31,27 +31,29 @@ class="text-white normal-case btn btn-xs no-animation btn-primary">
- -
- -
-
- - - -
-
- - - -
-
- - +
+
+ +
+
+ + + +
+
+ + + +
+
+ + +
@if (data_get($model, 'smtp_enabled'))