feat: new shared function name is_transactional_emails_enabled()

This commit is contained in:
peaklabs-dev
2024-12-09 15:34:24 +01:00
parent ee7a901a77
commit b13d77377c
7 changed files with 8 additions and 13 deletions

View File

@@ -48,7 +48,7 @@ class Controller extends BaseController
public function forgot_password(Request $request)
{
if (is_transactional_emails_active()) {
if (is_transactional_emails_enabled()) {
$arrayOfRequest = $request->only(Fortify::email());
$request->merge([
'email' => Str::lower($arrayOfRequest['email']),

View File

@@ -201,7 +201,7 @@ class SettingsEmail extends Component
} catch (\Throwable $e) {
$this->resendEnabled = false;
return handleError($e, $this);
return handleError($e);
}
}
@@ -229,12 +229,7 @@ class SettingsEmail extends Component
throw new \Exception('Too many messages sent!');
}
} catch (\Throwable $e) {
return handleError($e, $this);
return handleError($e);
}
}
public function isEmailEnabled(): bool
{
return $this->settings->smtp_enabled || $this->settings->resend_enabled;
}
}

View File

@@ -59,7 +59,7 @@ class S3Storage extends BaseModel
$this->is_usable = true;
} catch (\Throwable $e) {
$this->is_usable = false;
if ($this->unusable_email_sent === false && is_transactional_emails_active()) {
if ($this->unusable_email_sent === false && is_transactional_emails_enabled()) {
$mail = new MailMessage;
$mail->subject('Coolify: S3 Storage Connection Error');
$mail->view('emails.s3-connection-error', ['name' => $this->name, 'reason' => $e->getMessage(), 'url' => route('storage.show', ['storage_uuid' => $this->uuid])]);