Fix styling

This commit is contained in:
Thijmen
2024-06-10 20:43:34 +00:00
committed by github-actions[bot]
parent 41fb6a1fc9
commit d86274cc37
429 changed files with 5307 additions and 2831 deletions

View File

@@ -2,15 +2,17 @@
namespace App\Livewire\Notifications;
use Livewire\Component;
use App\Models\InstanceSettings;
use App\Models\Team;
use App\Notifications\Test;
use Livewire\Component;
class Email extends Component
{
public Team $team;
public string $emails;
public bool $sharedEmailEnabled = false;
protected $rules = [
@@ -33,6 +35,7 @@ class Email extends Component
'team.resend_enabled' => 'nullable|boolean',
'team.resend_api_key' => 'nullable',
];
protected $validationAttributes = [
'team.smtp_from_address' => 'From Address',
'team.smtp_from_name' => 'From Name',
@@ -53,6 +56,7 @@ class Email extends Component
['sharedEmailEnabled' => $this->sharedEmailEnabled] = $this->team->limits;
$this->emails = auth()->user()->email;
}
public function submitFromFields()
{
try {
@@ -68,15 +72,17 @@ class Email extends Component
return handleError($e, $this);
}
}
public function sendTestNotification()
{
$this->team?->notify(new Test($this->emails));
$this->dispatch('success', 'Test Email sent.');
}
public function instantSaveInstance()
{
try {
if (!$this->sharedEmailEnabled) {
if (! $this->sharedEmailEnabled) {
throw new \Exception('Not allowed to change settings. Please upgrade your subscription.');
}
$this->team->smtp_enabled = false;
@@ -96,9 +102,11 @@ class Email extends Component
$this->submitResend();
} catch (\Throwable $e) {
$this->team->smtp_enabled = false;
return handleError($e, $this);
}
}
public function instantSave()
{
try {
@@ -106,20 +114,23 @@ class Email extends Component
$this->submit();
} catch (\Throwable $e) {
$this->team->smtp_enabled = false;
return handleError($e, $this);
}
}
public function saveModel()
{
$this->team->save();
refreshSession();
$this->dispatch('success', 'Settings saved.');
}
public function submit()
{
try {
$this->resetErrorBag();
if (!$this->team->use_instance_email_settings) {
if (! $this->team->use_instance_email_settings) {
$this->validate([
'team.smtp_from_address' => 'required|email',
'team.smtp_from_name' => 'required',
@@ -136,9 +147,11 @@ class Email extends Component
$this->dispatch('success', 'Settings saved.');
} catch (\Throwable $e) {
$this->team->smtp_enabled = false;
return handleError($e, $this);
}
}
public function submitResend()
{
try {
@@ -146,16 +159,18 @@ class Email extends Component
$this->validate([
'team.smtp_from_address' => 'required|email',
'team.smtp_from_name' => 'required',
'team.resend_api_key' => 'required'
'team.resend_api_key' => 'required',
]);
$this->team->save();
refreshSession();
$this->dispatch('success', 'Settings saved.');
} catch (\Throwable $e) {
$this->team->resend_enabled = false;
return handleError($e, $this);
}
}
public function copyFromInstanceSettings()
{
$settings = InstanceSettings::get();
@@ -176,6 +191,7 @@ class Email extends Component
refreshSession();
$this->team = $team;
$this->dispatch('success', 'Settings saved.');
return;
}
if ($settings->resend_enabled) {
@@ -187,10 +203,12 @@ class Email extends Component
refreshSession();
$this->team = $team;
$this->dispatch('success', 'Settings saved.');
return;
}
$this->dispatch('error', 'Instance SMTP/Resend settings are not enabled.');
}
public function render()
{
return view('livewire.notifications.email');