rector: arrrrr

This commit is contained in:
Andras Bacsai
2025-01-07 14:52:08 +01:00
parent c702ebff6d
commit 16c0cd10d8
349 changed files with 4204 additions and 3712 deletions

View File

@@ -7,6 +7,7 @@ use App\Models\Team;
use App\Notifications\Test;
use Livewire\Attributes\Validate;
use Livewire\Component;
use Throwable;
class Discord extends Component
{
@@ -62,9 +63,11 @@ class Discord extends Component
$this->team = auth()->user()->currentTeam();
$this->settings = $this->team->discordNotificationSettings;
$this->syncData();
} catch (\Throwable $e) {
} catch (Throwable $e) {
return handleError($e, $this);
}
return null;
}
public function syncData(bool $toModel = false)
@@ -117,20 +120,24 @@ class Discord extends Component
'discordWebhookUrl.required' => 'Discord Webhook URL is required.',
]);
$this->saveModel();
} catch (\Throwable $e) {
} catch (Throwable $e) {
$this->discordEnabled = false;
return handleError($e, $this);
}
return null;
}
public function instantSave()
{
try {
$this->syncData(true);
} catch (\Throwable $e) {
} catch (Throwable $e) {
return handleError($e, $this);
}
return null;
}
public function submit()
@@ -139,9 +146,11 @@ class Discord extends Component
$this->resetErrorBag();
$this->syncData(true);
$this->saveModel();
} catch (\Throwable $e) {
} catch (Throwable $e) {
return handleError($e, $this);
}
return null;
}
public function saveModel()
@@ -156,9 +165,11 @@ class Discord extends Component
try {
$this->team->notify(new Test(channel: 'discord'));
$this->dispatch('success', 'Test notification sent.');
} catch (\Throwable $e) {
} catch (Throwable $e) {
return handleError($e, $this);
}
return null;
}
public function render()

View File

@@ -5,10 +5,12 @@ namespace App\Livewire\Notifications;
use App\Models\EmailNotificationSettings;
use App\Models\Team;
use App\Notifications\Test;
use Exception;
use Illuminate\Support\Facades\RateLimiter;
use Livewire\Attributes\Locked;
use Livewire\Attributes\Validate;
use Livewire\Component;
use Throwable;
class Email extends Component
{
@@ -109,9 +111,11 @@ class Email extends Component
$this->settings = $this->team->emailNotificationSettings;
$this->syncData();
$this->testEmailAddress = auth()->user()->email;
} catch (\Throwable $e) {
} catch (Throwable $e) {
return handleError($e, $this);
}
return null;
}
public function syncData(bool $toModel = false)
@@ -185,9 +189,11 @@ class Email extends Component
try {
$this->resetErrorBag();
$this->saveModel();
} catch (\Throwable $e) {
} catch (Throwable $e) {
return handleError($e, $this);
}
return null;
}
public function saveModel()
@@ -210,9 +216,9 @@ class Email extends Component
$this->resendEnabled = false;
$this->saveModel();
return;
return null;
}
} catch (\Throwable $e) {
} catch (Throwable $e) {
if ($type === 'SMTP') {
$this->smtpEnabled = false;
} elseif ($type === 'Resend') {
@@ -223,6 +229,8 @@ class Email extends Component
} finally {
$this->dispatch('refresh');
}
return null;
}
public function submitSmtp()
@@ -266,11 +274,13 @@ class Email extends Component
$this->settings->save();
$this->dispatch('success', 'SMTP settings updated.');
} catch (\Throwable $e) {
} catch (Throwable $e) {
$this->smtpEnabled = false;
return handleError($e);
}
return null;
}
public function submitResend()
@@ -301,9 +311,11 @@ class Email extends Component
$this->settings->save();
$this->dispatch('success', 'Resend settings updated.');
} catch (\Throwable $e) {
} catch (Throwable $e) {
return handleError($e, $this);
}
return null;
}
public function sendTestEmail()
@@ -327,11 +339,13 @@ class Email extends Component
);
if (! $executed) {
throw new \Exception('Too many messages sent!');
throw new Exception('Too many messages sent!');
}
} catch (\Throwable $e) {
} catch (Throwable $e) {
return handleError($e, $this);
}
return null;
}
public function copyFromInstanceSettings()

View File

@@ -8,6 +8,7 @@ use App\Notifications\Test;
use Livewire\Attributes\Locked;
use Livewire\Attributes\Validate;
use Livewire\Component;
use Throwable;
class Pushover extends Component
{
@@ -70,9 +71,11 @@ class Pushover extends Component
$this->team = auth()->user()->currentTeam();
$this->settings = $this->team->pushoverNotificationSettings;
$this->syncData();
} catch (\Throwable $e) {
} catch (Throwable $e) {
return handleError($e, $this);
}
return null;
}
public function syncData(bool $toModel = false)
@@ -129,24 +132,28 @@ class Pushover extends Component
'pushoverApiToken.required' => 'Pushover API Token is required.',
]);
$this->saveModel();
} catch (\Throwable $e) {
} catch (Throwable $e) {
$this->pushoverEnabled = false;
return handleError($e, $this);
} finally {
$this->dispatch('refresh');
}
return null;
}
public function instantSave()
{
try {
$this->syncData(true);
} catch (\Throwable $e) {
} catch (Throwable $e) {
return handleError($e, $this);
} finally {
$this->dispatch('refresh');
}
return null;
}
public function submit()
@@ -155,9 +162,11 @@ class Pushover extends Component
$this->resetErrorBag();
$this->syncData(true);
$this->saveModel();
} catch (\Throwable $e) {
} catch (Throwable $e) {
return handleError($e, $this);
}
return null;
}
public function saveModel()
@@ -172,9 +181,11 @@ class Pushover extends Component
try {
$this->team->notify(new Test(channel: 'pushover'));
$this->dispatch('success', 'Test notification sent.');
} catch (\Throwable $e) {
} catch (Throwable $e) {
return handleError($e, $this);
}
return null;
}
public function render()

View File

@@ -8,6 +8,7 @@ use App\Notifications\Test;
use Livewire\Attributes\Locked;
use Livewire\Attributes\Validate;
use Livewire\Component;
use Throwable;
class Slack extends Component
{
@@ -67,9 +68,11 @@ class Slack extends Component
$this->team = auth()->user()->currentTeam();
$this->settings = $this->team->slackNotificationSettings;
$this->syncData();
} catch (\Throwable $e) {
} catch (Throwable $e) {
return handleError($e, $this);
}
return null;
}
public function syncData(bool $toModel = false)
@@ -122,24 +125,28 @@ class Slack extends Component
'slackWebhookUrl.required' => 'Slack Webhook URL is required.',
]);
$this->saveModel();
} catch (\Throwable $e) {
} catch (Throwable $e) {
$this->slackEnabled = false;
return handleError($e, $this);
} finally {
$this->dispatch('refresh');
}
return null;
}
public function instantSave()
{
try {
$this->syncData(true);
} catch (\Throwable $e) {
} catch (Throwable $e) {
return handleError($e, $this);
} finally {
$this->dispatch('refresh');
}
return null;
}
public function submit()
@@ -148,9 +155,11 @@ class Slack extends Component
$this->resetErrorBag();
$this->syncData(true);
$this->saveModel();
} catch (\Throwable $e) {
} catch (Throwable $e) {
return handleError($e, $this);
}
return null;
}
public function saveModel()
@@ -165,9 +174,11 @@ class Slack extends Component
try {
$this->team->notify(new Test(channel: 'slack'));
$this->dispatch('success', 'Test notification sent.');
} catch (\Throwable $e) {
} catch (Throwable $e) {
return handleError($e, $this);
}
return null;
}
public function render()

View File

@@ -8,6 +8,7 @@ use App\Notifications\Test;
use Livewire\Attributes\Locked;
use Livewire\Attributes\Validate;
use Livewire\Component;
use Throwable;
class Telegram extends Component
{
@@ -106,9 +107,11 @@ class Telegram extends Component
$this->team = auth()->user()->currentTeam();
$this->settings = $this->team->telegramNotificationSettings;
$this->syncData();
} catch (\Throwable $e) {
} catch (Throwable $e) {
return handleError($e, $this);
}
return null;
}
public function syncData(bool $toModel = false)
@@ -183,11 +186,13 @@ class Telegram extends Component
{
try {
$this->syncData(true);
} catch (\Throwable $e) {
} catch (Throwable $e) {
return handleError($e, $this);
} finally {
$this->dispatch('refresh');
}
return null;
}
public function submit()
@@ -196,9 +201,11 @@ class Telegram extends Component
$this->resetErrorBag();
$this->syncData(true);
$this->saveModel();
} catch (\Throwable $e) {
} catch (Throwable $e) {
return handleError($e, $this);
}
return null;
}
public function instantSaveTelegramEnabled()
@@ -212,13 +219,15 @@ class Telegram extends Component
'telegramChatId.required' => 'Telegram Chat ID is required.',
]);
$this->saveModel();
} catch (\Throwable $e) {
} catch (Throwable $e) {
$this->telegramEnabled = false;
return handleError($e, $this);
} finally {
$this->dispatch('refresh');
}
return null;
}
public function saveModel()
@@ -233,9 +242,11 @@ class Telegram extends Component
try {
$this->team->notify(new Test(channel: 'telegram'));
$this->dispatch('success', 'Test notification sent.');
} catch (\Throwable $e) {
} catch (Throwable $e) {
return handleError($e, $this);
}
return null;
}
public function render()