feat: use new notification event names
This commit is contained in:
@@ -45,7 +45,7 @@ class DeploymentFailed extends CustomEmailNotification
|
|||||||
|
|
||||||
public function via(object $notifiable): array
|
public function via(object $notifiable): array
|
||||||
{
|
{
|
||||||
return setNotificationChannels($notifiable, 'deployments');
|
return $notifiable->getEnabledChannels('deployment_failure');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toMail(): MailMessage
|
public function toMail(): MailMessage
|
||||||
@@ -139,7 +139,7 @@ class DeploymentFailed extends CustomEmailNotification
|
|||||||
$description .= "\nPreview URL: {$this->preview->fqdn}";
|
$description .= "\nPreview URL: {$this->preview->fqdn}";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$title = "Deployment failed";
|
$title = 'Deployment failed';
|
||||||
$description = "Deployment failed for {$this->application_name}";
|
$description = "Deployment failed for {$this->application_name}";
|
||||||
if ($this->fqdn) {
|
if ($this->fqdn) {
|
||||||
$description .= "\nApplication URL: {$this->fqdn}";
|
$description .= "\nApplication URL: {$this->fqdn}";
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ use App\Models\Application;
|
|||||||
use App\Models\ApplicationPreview;
|
use App\Models\ApplicationPreview;
|
||||||
use App\Notifications\CustomEmailNotification;
|
use App\Notifications\CustomEmailNotification;
|
||||||
use App\Notifications\Dto\DiscordMessage;
|
use App\Notifications\Dto\DiscordMessage;
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
|
||||||
use App\Notifications\Dto\SlackMessage;
|
use App\Notifications\Dto\SlackMessage;
|
||||||
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
|
|
||||||
class DeploymentSuccess extends CustomEmailNotification
|
class DeploymentSuccess extends CustomEmailNotification
|
||||||
{
|
{
|
||||||
@@ -45,13 +45,7 @@ class DeploymentSuccess extends CustomEmailNotification
|
|||||||
|
|
||||||
public function via(object $notifiable): array
|
public function via(object $notifiable): array
|
||||||
{
|
{
|
||||||
$channels = setNotificationChannels($notifiable, 'deployments');
|
return $notifiable->getEnabledChannels('deployment_success');
|
||||||
if (isCloud()) {
|
|
||||||
// TODO: Make batch notifications work with email
|
|
||||||
$channels = array_diff($channels, [\App\Notifications\Channels\EmailChannel::class]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $channels;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toMail(): MailMessage
|
public function toMail(): MailMessage
|
||||||
@@ -145,7 +139,6 @@ class DeploymentSuccess extends CustomEmailNotification
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function toSlack(): SlackMessage
|
public function toSlack(): SlackMessage
|
||||||
{
|
{
|
||||||
if ($this->preview) {
|
if ($this->preview) {
|
||||||
@@ -155,7 +148,7 @@ class DeploymentSuccess extends CustomEmailNotification
|
|||||||
$description .= "\nPreview URL: {$this->preview->fqdn}";
|
$description .= "\nPreview URL: {$this->preview->fqdn}";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$title = "New version successfully deployed";
|
$title = 'New version successfully deployed';
|
||||||
$description = "New version successfully deployed for {$this->application_name}";
|
$description = "New version successfully deployed for {$this->application_name}";
|
||||||
if ($this->fqdn) {
|
if ($this->fqdn) {
|
||||||
$description .= "\nApplication URL: {$this->fqdn}";
|
$description .= "\nApplication URL: {$this->fqdn}";
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ namespace App\Notifications\Application;
|
|||||||
use App\Models\Application;
|
use App\Models\Application;
|
||||||
use App\Notifications\CustomEmailNotification;
|
use App\Notifications\CustomEmailNotification;
|
||||||
use App\Notifications\Dto\DiscordMessage;
|
use App\Notifications\Dto\DiscordMessage;
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
|
||||||
use App\Notifications\Dto\SlackMessage;
|
use App\Notifications\Dto\SlackMessage;
|
||||||
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
|
|
||||||
class StatusChanged extends CustomEmailNotification
|
class StatusChanged extends CustomEmailNotification
|
||||||
{
|
{
|
||||||
@@ -35,7 +35,7 @@ class StatusChanged extends CustomEmailNotification
|
|||||||
|
|
||||||
public function via(object $notifiable): array
|
public function via(object $notifiable): array
|
||||||
{
|
{
|
||||||
return setNotificationChannels($notifiable, 'status_changes');
|
return $notifiable->getEnabledChannels('status_change');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toMail(): MailMessage
|
public function toMail(): MailMessage
|
||||||
@@ -79,7 +79,7 @@ class StatusChanged extends CustomEmailNotification
|
|||||||
|
|
||||||
public function toSlack(): SlackMessage
|
public function toSlack(): SlackMessage
|
||||||
{
|
{
|
||||||
$title = "Application stopped";
|
$title = 'Application stopped';
|
||||||
$description = "{$this->resource_name} has been stopped";
|
$description = "{$this->resource_name} has been stopped";
|
||||||
|
|
||||||
$description .= "\n\n**Project:** ".data_get($this->resource, 'environment.project.name');
|
$description .= "\n\n**Project:** ".data_get($this->resource, 'environment.project.name');
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ namespace App\Notifications\Container;
|
|||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use App\Notifications\CustomEmailNotification;
|
use App\Notifications\CustomEmailNotification;
|
||||||
use App\Notifications\Dto\DiscordMessage;
|
use App\Notifications\Dto\DiscordMessage;
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
|
||||||
use App\Notifications\Dto\SlackMessage;
|
use App\Notifications\Dto\SlackMessage;
|
||||||
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
|
|
||||||
class ContainerRestarted extends CustomEmailNotification
|
class ContainerRestarted extends CustomEmailNotification
|
||||||
{
|
{
|
||||||
@@ -17,7 +17,7 @@ class ContainerRestarted extends CustomEmailNotification
|
|||||||
|
|
||||||
public function via(object $notifiable): array
|
public function via(object $notifiable): array
|
||||||
{
|
{
|
||||||
return setNotificationChannels($notifiable, 'status_changes');
|
return $notifiable->getEnabledChannels('status_change');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toMail(): MailMessage
|
public function toMail(): MailMessage
|
||||||
@@ -70,7 +70,7 @@ class ContainerRestarted extends CustomEmailNotification
|
|||||||
|
|
||||||
public function toSlack(): SlackMessage
|
public function toSlack(): SlackMessage
|
||||||
{
|
{
|
||||||
$title = "Resource restarted";
|
$title = 'Resource restarted';
|
||||||
$description = "A resource ({$this->name}) has been restarted automatically on {$this->server->name}";
|
$description = "A resource ({$this->name}) has been restarted automatically on {$this->server->name}";
|
||||||
|
|
||||||
if ($this->url) {
|
if ($this->url) {
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ namespace App\Notifications\Container;
|
|||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use App\Notifications\CustomEmailNotification;
|
use App\Notifications\CustomEmailNotification;
|
||||||
use App\Notifications\Dto\DiscordMessage;
|
use App\Notifications\Dto\DiscordMessage;
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
|
||||||
use App\Notifications\Dto\SlackMessage;
|
use App\Notifications\Dto\SlackMessage;
|
||||||
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
|
|
||||||
class ContainerStopped extends CustomEmailNotification
|
class ContainerStopped extends CustomEmailNotification
|
||||||
{
|
{
|
||||||
@@ -17,7 +17,7 @@ class ContainerStopped extends CustomEmailNotification
|
|||||||
|
|
||||||
public function via(object $notifiable): array
|
public function via(object $notifiable): array
|
||||||
{
|
{
|
||||||
return setNotificationChannels($notifiable, 'status_changes');
|
return $notifiable->getEnabledChannels('status_change');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toMail(): MailMessage
|
public function toMail(): MailMessage
|
||||||
@@ -70,7 +70,7 @@ class ContainerStopped extends CustomEmailNotification
|
|||||||
|
|
||||||
public function toSlack(): SlackMessage
|
public function toSlack(): SlackMessage
|
||||||
{
|
{
|
||||||
$title = "Resource stopped";
|
$title = 'Resource stopped';
|
||||||
$description = "A resource ({$this->name}) has been stopped unexpectedly on {$this->server->name}";
|
$description = "A resource ({$this->name}) has been stopped unexpectedly on {$this->server->name}";
|
||||||
|
|
||||||
if ($this->url) {
|
if ($this->url) {
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ namespace App\Notifications\Database;
|
|||||||
use App\Models\ScheduledDatabaseBackup;
|
use App\Models\ScheduledDatabaseBackup;
|
||||||
use App\Notifications\CustomEmailNotification;
|
use App\Notifications\CustomEmailNotification;
|
||||||
use App\Notifications\Dto\DiscordMessage;
|
use App\Notifications\Dto\DiscordMessage;
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
|
||||||
use App\Notifications\Dto\SlackMessage;
|
use App\Notifications\Dto\SlackMessage;
|
||||||
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
|
|
||||||
class BackupFailed extends CustomEmailNotification
|
class BackupFailed extends CustomEmailNotification
|
||||||
{
|
{
|
||||||
@@ -23,13 +23,13 @@ class BackupFailed extends CustomEmailNotification
|
|||||||
|
|
||||||
public function via(object $notifiable): array
|
public function via(object $notifiable): array
|
||||||
{
|
{
|
||||||
return setNotificationChannels($notifiable, 'database_backups');
|
return $notifiable->getEnabledChannels('backup_failure');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toMail(): MailMessage
|
public function toMail(): MailMessage
|
||||||
{
|
{
|
||||||
$mail = new MailMessage;
|
$mail = new MailMessage;
|
||||||
$mail->subject("Coolify: [ACTION REQUIRED] Backup FAILED for {$this->database->name}");
|
$mail->subject("Coolify: [ACTION REQUIRED] Database Backup FAILED for {$this->database->name}");
|
||||||
$mail->view('emails.backup-failed', [
|
$mail->view('emails.backup-failed', [
|
||||||
'name' => $this->name,
|
'name' => $this->name,
|
||||||
'database_name' => $this->database_name,
|
'database_name' => $this->database_name,
|
||||||
@@ -66,7 +66,7 @@ class BackupFailed extends CustomEmailNotification
|
|||||||
|
|
||||||
public function toSlack(): SlackMessage
|
public function toSlack(): SlackMessage
|
||||||
{
|
{
|
||||||
$title = "Database backup failed";
|
$title = 'Database backup failed';
|
||||||
$description = "Database backup for {$this->name} (db:{$this->database_name}) has FAILED.";
|
$description = "Database backup for {$this->name} (db:{$this->database_name}) has FAILED.";
|
||||||
|
|
||||||
$description .= "\n\n**Frequency:** {$this->frequency}";
|
$description .= "\n\n**Frequency:** {$this->frequency}";
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ namespace App\Notifications\Database;
|
|||||||
use App\Models\ScheduledDatabaseBackup;
|
use App\Models\ScheduledDatabaseBackup;
|
||||||
use App\Notifications\CustomEmailNotification;
|
use App\Notifications\CustomEmailNotification;
|
||||||
use App\Notifications\Dto\DiscordMessage;
|
use App\Notifications\Dto\DiscordMessage;
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
|
||||||
use App\Notifications\Dto\SlackMessage;
|
use App\Notifications\Dto\SlackMessage;
|
||||||
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
|
|
||||||
class BackupSuccess extends CustomEmailNotification
|
class BackupSuccess extends CustomEmailNotification
|
||||||
{
|
{
|
||||||
@@ -24,7 +24,7 @@ class BackupSuccess extends CustomEmailNotification
|
|||||||
|
|
||||||
public function via(object $notifiable): array
|
public function via(object $notifiable): array
|
||||||
{
|
{
|
||||||
return setNotificationChannels($notifiable, 'database_backups');
|
return $notifiable->getEnabledChannels('backup_success');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toMail(): MailMessage
|
public function toMail(): MailMessage
|
||||||
@@ -64,7 +64,7 @@ class BackupSuccess extends CustomEmailNotification
|
|||||||
|
|
||||||
public function toSlack(): SlackMessage
|
public function toSlack(): SlackMessage
|
||||||
{
|
{
|
||||||
$title = "Database backup successful";
|
$title = 'Database backup successful';
|
||||||
$description = "Database backup for {$this->name} (db:{$this->database_name}) was successful.";
|
$description = "Database backup for {$this->name} (db:{$this->database_name}) was successful.";
|
||||||
|
|
||||||
$description .= "\n\n**Frequency:** {$this->frequency}";
|
$description .= "\n\n**Frequency:** {$this->frequency}";
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ namespace App\Notifications\ScheduledTask;
|
|||||||
use App\Models\ScheduledTask;
|
use App\Models\ScheduledTask;
|
||||||
use App\Notifications\CustomEmailNotification;
|
use App\Notifications\CustomEmailNotification;
|
||||||
use App\Notifications\Dto\DiscordMessage;
|
use App\Notifications\Dto\DiscordMessage;
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
|
||||||
use App\Notifications\Dto\SlackMessage;
|
use App\Notifications\Dto\SlackMessage;
|
||||||
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
|
|
||||||
class TaskFailed extends CustomEmailNotification
|
class TaskFailed extends CustomEmailNotification
|
||||||
{
|
{
|
||||||
@@ -24,7 +24,7 @@ class TaskFailed extends CustomEmailNotification
|
|||||||
|
|
||||||
public function via(object $notifiable): array
|
public function via(object $notifiable): array
|
||||||
{
|
{
|
||||||
return setNotificationChannels($notifiable, 'scheduled_tasks');
|
return $notifiable->getEnabledChannels('scheduled_task_failure');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toMail(): MailMessage
|
public function toMail(): MailMessage
|
||||||
@@ -72,7 +72,7 @@ class TaskFailed extends CustomEmailNotification
|
|||||||
|
|
||||||
public function toSlack(): SlackMessage
|
public function toSlack(): SlackMessage
|
||||||
{
|
{
|
||||||
$title = "Scheduled task failed";
|
$title = 'Scheduled task failed';
|
||||||
$description = "Scheduled task ({$this->task->name}) failed.";
|
$description = "Scheduled task ({$this->task->name}) failed.";
|
||||||
|
|
||||||
if ($this->output) {
|
if ($this->output) {
|
||||||
|
|||||||
@@ -3,11 +3,10 @@
|
|||||||
namespace App\Notifications\Server;
|
namespace App\Notifications\Server;
|
||||||
|
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use App\Notifications\Channels\DiscordChannel;
|
|
||||||
use App\Notifications\Channels\TelegramChannel;
|
|
||||||
use App\Notifications\CustomEmailNotification;
|
use App\Notifications\CustomEmailNotification;
|
||||||
use App\Notifications\Dto\DiscordMessage;
|
use App\Notifications\Dto\DiscordMessage;
|
||||||
use App\Notifications\Dto\SlackMessage;
|
use App\Notifications\Dto\SlackMessage;
|
||||||
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
|
|
||||||
class DockerCleanup extends CustomEmailNotification
|
class DockerCleanup extends CustomEmailNotification
|
||||||
{
|
{
|
||||||
@@ -18,38 +17,20 @@ class DockerCleanup extends CustomEmailNotification
|
|||||||
|
|
||||||
public function via(object $notifiable): array
|
public function via(object $notifiable): array
|
||||||
{
|
{
|
||||||
$channels = [];
|
return $notifiable->getEnabledChannels('docker_cleanup');
|
||||||
// $isEmailEnabled = isEmailEnabled($notifiable);
|
|
||||||
$isDiscordEnabled = data_get($notifiable, 'discord_enabled');
|
|
||||||
$isTelegramEnabled = data_get($notifiable, 'telegram_enabled');
|
|
||||||
$isSlackEnabled = data_get($notifiable, 'slack_enabled');
|
|
||||||
if ($isDiscordEnabled) {
|
|
||||||
$channels[] = DiscordChannel::class;
|
|
||||||
}
|
|
||||||
// if ($isEmailEnabled) {
|
|
||||||
// $channels[] = EmailChannel::class;
|
|
||||||
// }
|
|
||||||
if ($isTelegramEnabled) {
|
|
||||||
$channels[] = TelegramChannel::class;
|
|
||||||
}
|
|
||||||
if ($isSlackEnabled) {
|
|
||||||
$channels[] = SlackChannel::class;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $channels;
|
public function toMail(): MailMessage
|
||||||
}
|
{
|
||||||
|
$mail = new MailMessage;
|
||||||
|
$mail->subject("Coolify: Server ({$this->server->name}) docker cleanup job done!");
|
||||||
|
$mail->view('emails.docker-cleanup', [
|
||||||
|
'name' => $this->server->name,
|
||||||
|
'message' => $this->message,
|
||||||
|
]);
|
||||||
|
|
||||||
// public function toMail(): MailMessage
|
return $mail;
|
||||||
// {
|
}
|
||||||
// $mail = new MailMessage();
|
|
||||||
// $mail->subject("Coolify: Server ({$this->server->name}) high disk usage detected!");
|
|
||||||
// $mail->view('emails.high-disk-usage', [
|
|
||||||
// 'name' => $this->server->name,
|
|
||||||
// 'disk_usage' => $this->disk_usage,
|
|
||||||
// 'threshold' => $this->docker_cleanup_threshold,
|
|
||||||
// ]);
|
|
||||||
// return $mail;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public function toDiscord(): DiscordMessage
|
public function toDiscord(): DiscordMessage
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class HighDiskUsage extends CustomEmailNotification
|
|||||||
|
|
||||||
public function via(object $notifiable): array
|
public function via(object $notifiable): array
|
||||||
{
|
{
|
||||||
return setNotificationChannels($notifiable, 'server_disk_usage');
|
return $notifiable->getEnabledChannels('server_disk_usage');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toMail(): MailMessage
|
public function toMail(): MailMessage
|
||||||
@@ -65,8 +65,8 @@ class HighDiskUsage extends CustomEmailNotification
|
|||||||
$description .= "Please cleanup your disk to prevent data-loss.\n";
|
$description .= "Please cleanup your disk to prevent data-loss.\n";
|
||||||
$description .= "Tips for cleanup: https://coolify.io/docs/knowledge-base/server/automated-cleanup\n";
|
$description .= "Tips for cleanup: https://coolify.io/docs/knowledge-base/server/automated-cleanup\n";
|
||||||
$description .= "Change settings:\n";
|
$description .= "Change settings:\n";
|
||||||
$description .= "- Threshold: " . base_url() . "/server/" . $this->server->uuid . "#advanced\n";
|
$description .= '- Threshold: '.base_url().'/server/'.$this->server->uuid."#advanced\n";
|
||||||
$description .= "- Notifications: " . base_url() . "/notifications/discord";
|
$description .= '- Notifications: '.base_url().'/notifications/discord';
|
||||||
|
|
||||||
return new SlackMessage(
|
return new SlackMessage(
|
||||||
title: 'High disk usage detected',
|
title: 'High disk usage detected',
|
||||||
|
|||||||
@@ -3,13 +3,9 @@
|
|||||||
namespace App\Notifications\Server;
|
namespace App\Notifications\Server;
|
||||||
|
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use App\Notifications\Channels\DiscordChannel;
|
|
||||||
use App\Notifications\Channels\EmailChannel;
|
|
||||||
use App\Notifications\Channels\TelegramChannel;
|
|
||||||
use App\Notifications\Channels\SlackChannel;
|
|
||||||
use App\Notifications\Dto\SlackMessage;
|
|
||||||
use App\Notifications\CustomEmailNotification;
|
use App\Notifications\CustomEmailNotification;
|
||||||
use App\Notifications\Dto\DiscordMessage;
|
use App\Notifications\Dto\DiscordMessage;
|
||||||
|
use App\Notifications\Dto\SlackMessage;
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
|
|
||||||
class Reachable extends CustomEmailNotification
|
class Reachable extends CustomEmailNotification
|
||||||
@@ -30,25 +26,7 @@ class Reachable extends CustomEmailNotification
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$channels = [];
|
return $notifiable->getEnabledChannels('server_reachable');
|
||||||
$isEmailEnabled = isEmailEnabled($notifiable);
|
|
||||||
$isDiscordEnabled = data_get($notifiable, 'discord_enabled');
|
|
||||||
$isTelegramEnabled = data_get($notifiable, 'telegram_enabled');
|
|
||||||
$isSlackEnabled = data_get($notifiable, 'slack_enabled');
|
|
||||||
if ($isDiscordEnabled) {
|
|
||||||
$channels[] = DiscordChannel::class;
|
|
||||||
}
|
|
||||||
if ($isEmailEnabled) {
|
|
||||||
$channels[] = EmailChannel::class;
|
|
||||||
}
|
|
||||||
if ($isTelegramEnabled) {
|
|
||||||
$channels[] = TelegramChannel::class;
|
|
||||||
}
|
|
||||||
if ($isSlackEnabled) {
|
|
||||||
$channels[] = SlackChannel::class;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $channels;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toMail(): MailMessage
|
public function toMail(): MailMessage
|
||||||
@@ -78,13 +56,10 @@ class Reachable extends CustomEmailNotification
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function toSlack(): SlackMessage
|
public function toSlack(): SlackMessage
|
||||||
{
|
{
|
||||||
return new SlackMessage(
|
return new SlackMessage(
|
||||||
title: "Server revived",
|
title: 'Server revived',
|
||||||
description: "Server '{$this->server->name}' revived.\nAll automations & integrations are turned on again!",
|
description: "Server '{$this->server->name}' revived.\nAll automations & integrations are turned on again!",
|
||||||
color: SlackMessage::successColor()
|
color: SlackMessage::successColor()
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,13 +3,9 @@
|
|||||||
namespace App\Notifications\Server;
|
namespace App\Notifications\Server;
|
||||||
|
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use App\Notifications\Channels\DiscordChannel;
|
|
||||||
use App\Notifications\Channels\EmailChannel;
|
|
||||||
use App\Notifications\Channels\TelegramChannel;
|
|
||||||
use App\Notifications\Channels\SlackChannel;
|
|
||||||
use App\Notifications\Dto\SlackMessage;
|
|
||||||
use App\Notifications\CustomEmailNotification;
|
use App\Notifications\CustomEmailNotification;
|
||||||
use App\Notifications\Dto\DiscordMessage;
|
use App\Notifications\Dto\DiscordMessage;
|
||||||
|
use App\Notifications\Dto\SlackMessage;
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
|
|
||||||
class Unreachable extends CustomEmailNotification
|
class Unreachable extends CustomEmailNotification
|
||||||
@@ -30,26 +26,7 @@ class Unreachable extends CustomEmailNotification
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$channels = [];
|
return $notifiable->getEnabledChannels('server_unreachable');
|
||||||
$isEmailEnabled = isEmailEnabled($notifiable);
|
|
||||||
$isDiscordEnabled = data_get($notifiable, 'discord_enabled');
|
|
||||||
$isTelegramEnabled = data_get($notifiable, 'telegram_enabled');
|
|
||||||
$isSlackEnabled = data_get($notifiable, 'slack_enabled');
|
|
||||||
|
|
||||||
if ($isDiscordEnabled) {
|
|
||||||
$channels[] = DiscordChannel::class;
|
|
||||||
}
|
|
||||||
if ($isEmailEnabled) {
|
|
||||||
$channels[] = EmailChannel::class;
|
|
||||||
}
|
|
||||||
if ($isTelegramEnabled) {
|
|
||||||
$channels[] = TelegramChannel::class;
|
|
||||||
}
|
|
||||||
if ($isSlackEnabled) {
|
|
||||||
$channels[] = SlackChannel::class;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $channels;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toMail(): ?MailMessage
|
public function toMail(): ?MailMessage
|
||||||
@@ -83,12 +60,11 @@ class Unreachable extends CustomEmailNotification
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function toSlack(): SlackMessage
|
public function toSlack(): SlackMessage
|
||||||
{
|
{
|
||||||
$description = "Your server '{$this->server->name}' is unreachable.\n";
|
$description = "Your server '{$this->server->name}' is unreachable.\n";
|
||||||
$description .= "All automations & integrations are turned off!\n\n";
|
$description .= "All automations & integrations are turned off!\n\n";
|
||||||
$description .= "*IMPORTANT:* We automatically try to revive your server and turn on all automations & integrations.";
|
$description .= '*IMPORTANT:* We automatically try to revive your server and turn on all automations & integrations.';
|
||||||
|
|
||||||
return new SlackMessage(
|
return new SlackMessage(
|
||||||
title: 'Server unreachable',
|
title: 'Server unreachable',
|
||||||
|
|||||||
Reference in New Issue
Block a user