@@ -7,7 +7,6 @@ use App\Models\Team;
|
||||
use App\Notifications\Test;
|
||||
use Livewire\Attributes\Validate;
|
||||
use Livewire\Component;
|
||||
use Throwable;
|
||||
|
||||
class Discord extends Component
|
||||
{
|
||||
@@ -63,11 +62,9 @@ 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)
|
||||
@@ -120,24 +117,20 @@ 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()
|
||||
@@ -146,11 +139,9 @@ 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()
|
||||
@@ -165,11 +156,9 @@ 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()
|
||||
|
||||
@@ -5,12 +5,10 @@ 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
|
||||
{
|
||||
@@ -111,11 +109,9 @@ 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)
|
||||
@@ -189,11 +185,9 @@ class Email extends Component
|
||||
try {
|
||||
$this->resetErrorBag();
|
||||
$this->saveModel();
|
||||
} catch (Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function saveModel()
|
||||
@@ -216,9 +210,9 @@ class Email extends Component
|
||||
$this->resendEnabled = false;
|
||||
$this->saveModel();
|
||||
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
if ($type === 'SMTP') {
|
||||
$this->smtpEnabled = false;
|
||||
} elseif ($type === 'Resend') {
|
||||
@@ -229,8 +223,6 @@ class Email extends Component
|
||||
} finally {
|
||||
$this->dispatch('refresh');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function submitSmtp()
|
||||
@@ -274,13 +266,11 @@ 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()
|
||||
@@ -311,11 +301,9 @@ 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()
|
||||
@@ -339,13 +327,11 @@ 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()
|
||||
|
||||
@@ -8,7 +8,6 @@ use App\Notifications\Test;
|
||||
use Livewire\Attributes\Locked;
|
||||
use Livewire\Attributes\Validate;
|
||||
use Livewire\Component;
|
||||
use Throwable;
|
||||
|
||||
class Pushover extends Component
|
||||
{
|
||||
@@ -71,11 +70,9 @@ 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)
|
||||
@@ -132,28 +129,24 @@ 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()
|
||||
@@ -162,11 +155,9 @@ 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()
|
||||
@@ -181,11 +172,9 @@ 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()
|
||||
|
||||
@@ -8,7 +8,6 @@ use App\Notifications\Test;
|
||||
use Livewire\Attributes\Locked;
|
||||
use Livewire\Attributes\Validate;
|
||||
use Livewire\Component;
|
||||
use Throwable;
|
||||
|
||||
class Slack extends Component
|
||||
{
|
||||
@@ -68,11 +67,9 @@ 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)
|
||||
@@ -125,28 +122,24 @@ 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()
|
||||
@@ -155,11 +148,9 @@ 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()
|
||||
@@ -174,11 +165,9 @@ 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()
|
||||
|
||||
@@ -8,7 +8,6 @@ use App\Notifications\Test;
|
||||
use Livewire\Attributes\Locked;
|
||||
use Livewire\Attributes\Validate;
|
||||
use Livewire\Component;
|
||||
use Throwable;
|
||||
|
||||
class Telegram extends Component
|
||||
{
|
||||
@@ -107,11 +106,9 @@ 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)
|
||||
@@ -186,13 +183,11 @@ 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()
|
||||
@@ -201,11 +196,9 @@ 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()
|
||||
@@ -219,15 +212,13 @@ 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()
|
||||
@@ -242,11 +233,9 @@ 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()
|
||||
|
||||
Reference in New Issue
Block a user