This commit is contained in:
Andras Bacsai 2023-06-01 13:54:38 +02:00
parent 4a96b4b622
commit ea5c1b9e12
4 changed files with 18 additions and 14 deletions

View File

@ -23,17 +23,18 @@ class EmailSettings extends Component
'model.extra_attributes.smtp_username' => 'nullable', 'model.extra_attributes.smtp_username' => 'nullable',
'model.extra_attributes.smtp_password' => 'nullable', 'model.extra_attributes.smtp_password' => 'nullable',
'model.extra_attributes.smtp_timeout' => 'nullable', 'model.extra_attributes.smtp_timeout' => 'nullable',
'model.extra_attributes.test_notification_email' => 'nullable|email', 'model.extra_attributes.test_notification_recipients' => 'nullable',
]; ];
protected $validationAttributes = [ protected $validationAttributes = [
'model.extra_attributes.from_address' => 'From Address', 'model.extra_attributes.from_address' => '',
'model.extra_attributes.from_name' => 'From Name', 'model.extra_attributes.from_name' => '',
'model.extra_attributes.recipients' => 'Recipients', 'model.extra_attributes.recipients' => '',
'model.extra_attributes.smtp_host' => 'Host', 'model.extra_attributes.smtp_host' => '',
'model.extra_attributes.smtp_port' => 'Port', 'model.extra_attributes.smtp_port' => '',
'model.extra_attributes.smtp_encryption' => 'Encryption', 'model.extra_attributes.smtp_encryption' => '',
'model.extra_attributes.smtp_username' => 'Username', 'model.extra_attributes.smtp_username' => '',
'model.extra_attributes.smtp_password' => 'Password', 'model.extra_attributes.smtp_password' => '',
'model.extra_attributes.test_notification_recipients' => '',
]; ];
public function mount($model) public function mount($model)
{ {
@ -43,6 +44,8 @@ class EmailSettings extends Component
{ {
$this->resetErrorBag(); $this->resetErrorBag();
$this->validate(); $this->validate();
$this->model->extra_attributes->recipients = str_replace(' ', '', $this->model->extra_attributes->recipients);
$this->model->extra_attributes->test_notification_recipients = str_replace(' ', '', $this->model->extra_attributes->test_notification_recipients);
$this->saveModel(); $this->saveModel();
} }
private function saveModel() private function saveModel()

View File

@ -15,7 +15,7 @@ class EmailChannel
{ {
$this->bootConfigs($notifiable); $this->bootConfigs($notifiable);
if ($notification instanceof \App\Notifications\TestNotification) { if ($notification instanceof \App\Notifications\TestNotification) {
$bcc = $notifiable->routeNotificationForEmail('test_notification_email'); $bcc = $notifiable->routeNotificationForEmail('test_notification_recipients');
if (count($bcc) === 0) { if (count($bcc) === 0) {
$bcc = $notifiable->routeNotificationForEmail(); $bcc = $notifiable->routeNotificationForEmail();
} }

View File

@ -91,7 +91,7 @@ function instant_remote_process(array $command, Server $server, $throwError = tr
ray('executing again'); ray('executing again');
return instant_remote_process($command, $server, $throwError, $repeat - 1); return instant_remote_process($command, $server, $throwError, $repeat - 1);
} }
ray($process->errorOutput()); ray('ERROR OCCURED: ' . $process->errorOutput());
if (!$throwError) { if (!$throwError) {
return null; return null;
} }

View File

@ -9,11 +9,12 @@
<div class="flex flex-col w-96"> <div class="flex flex-col w-96">
<x-forms.checkbox instantSave id="model.extra_attributes.smtp_active" label="Notification Enabled" /> <x-forms.checkbox instantSave id="model.extra_attributes.smtp_active" label="Notification Enabled" />
</div> </div>
<x-forms.input id="model.extra_attributes.test_notification_email" label="Test Notification Email" /> <x-forms.input id="model.extra_attributes.test_notification_recipients" label="Test Notification Recipient(s)"
helper="Emails separated by comma." />
<div class="flex flex-col gap-2 xl:flex-row"> <div class="flex flex-col gap-2 xl:flex-row">
<div class="flex flex-col w-96"> <div class="flex flex-col w-96">
<x-forms.input required id="model.extra_attributes.recipients" helper="Emails separated by comma" <x-forms.input required id="model.extra_attributes.recipients" helper="Emails separated by comma."
label="Recipients" /> label="Recipient(s)" />
</div> </div>
</div> </div>
<div class="flex flex-col gap-2 xl:flex-row"> <div class="flex flex-col gap-2 xl:flex-row">