Fix styling
This commit is contained in:
committed by
github-actions[bot]
parent
41fb6a1fc9
commit
d86274cc37
@@ -9,6 +9,7 @@ use Livewire\Component;
|
||||
class Discord extends Component
|
||||
{
|
||||
public Team $team;
|
||||
|
||||
protected $rules = [
|
||||
'team.discord_enabled' => 'nullable|boolean',
|
||||
'team.discord_webhook_url' => 'required|url',
|
||||
@@ -18,6 +19,7 @@ class Discord extends Component
|
||||
'team.discord_notifications_database_backups' => 'nullable|boolean',
|
||||
'team.discord_notifications_scheduled_tasks' => 'nullable|boolean',
|
||||
];
|
||||
|
||||
protected $validationAttributes = [
|
||||
'team.discord_webhook_url' => 'Discord Webhook',
|
||||
];
|
||||
@@ -26,6 +28,7 @@ class Discord extends Component
|
||||
{
|
||||
$this->team = auth()->user()->currentTeam();
|
||||
}
|
||||
|
||||
public function instantSave()
|
||||
{
|
||||
try {
|
||||
@@ -56,6 +59,7 @@ class Discord extends Component
|
||||
$this->team?->notify(new Test());
|
||||
$this->dispatch('success', 'Test notification sent.');
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.notifications.discord');
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -8,8 +8,8 @@ use Livewire\Component;
|
||||
|
||||
class Telegram extends Component
|
||||
{
|
||||
|
||||
public Team $team;
|
||||
|
||||
protected $rules = [
|
||||
'team.telegram_enabled' => 'nullable|boolean',
|
||||
'team.telegram_token' => 'required|string',
|
||||
@@ -25,6 +25,7 @@ class Telegram extends Component
|
||||
'team.telegram_notifications_database_backups_message_thread_id' => 'nullable|string',
|
||||
'team.telegram_notifications_scheduled_tasks_thread_id' => 'nullable|string',
|
||||
];
|
||||
|
||||
protected $validationAttributes = [
|
||||
'team.telegram_token' => 'Token',
|
||||
'team.telegram_chat_id' => 'Chat ID',
|
||||
@@ -34,6 +35,7 @@ class Telegram extends Component
|
||||
{
|
||||
$this->team = auth()->user()->currentTeam();
|
||||
}
|
||||
|
||||
public function instantSave()
|
||||
{
|
||||
try {
|
||||
@@ -64,6 +66,7 @@ class Telegram extends Component
|
||||
$this->team?->notify(new Test());
|
||||
$this->dispatch('success', 'Test notification sent.');
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.notifications.telegram');
|
||||
|
||||
Reference in New Issue
Block a user