An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
feat: use new notification event names
peaklabs-devb6500142c404
diff --git a/app/Notifications/Application/DeploymentFailed.php b/app/Notifications/Application/DeploymentFailed.phpindex cdcec3261e..06a2b48e35 100644--- a/app/Notifications/Application/DeploymentFailed.php+++ b/app/Notifications/Application/DeploymentFailed.php@@ -40,12 +40,12 @@ class DeploymentFailed extends CustomEmailNotificationif (str($this->fqdn)->explode(',')->count() > 1) {$this->fqdn = str($this->fqdn)->explode(',')->first();}- $this->deployment_url = base_url() . "/project/{$this->project_uuid}/" . urlencode($this->environment_name) . "/application/{$this->application->uuid}/deployment/{$this->deployment_uuid}";+ $this->deployment_url = base_url()."/project/{$this->project_uuid}/".urlencode($this->environment_name)."/application/{$this->application->uuid}/deployment/{$this->deployment_uuid}";}public function via(object $notifiable): array{- return setNotificationChannels($notifiable, 'deployments');+ return $notifiable->getEnabledChannels('deployment_failure');}public function toMail(): MailMessage@@ -54,10 +54,10 @@ class DeploymentFailed extends CustomEmailNotification$pull_request_id = data_get($this->preview, 'pull_request_id', 0);$fqdn = $this->fqdn;if ($pull_request_id === 0) {- $mail->subject('Coolify: Deployment failed of ' . $this->application_name . '.');+ $mail->subject('Coolify: Deployment failed of '.$this->application_name.'.');} else {$fqdn = $this->preview->fqdn;- $mail->subject('Coolify: Deployment failed of pull request #' . $this->preview->pull_request_id . ' of ' . $this->application_name . '.');+ $mail->subject('Coolify: Deployment failed of pull request #'.$this->preview->pull_request_id.' of '.$this->application_name.'.');}$mail->view('emails.application-deployment-failed', ['name' => $this->application_name,@@ -74,7 +74,7 @@ class DeploymentFailed extends CustomEmailNotificationif ($this->preview) {$message = new DiscordMessage(title: ':cross_mark: Deployment failed',- description: 'Pull request: ' . $this->preview->pull_request_id,+ description: 'Pull request: '.$this->preview->pull_request_id,color: DiscordMessage::errorColor(),isCritical: true,);@@ -83,13 +83,13 @@ class DeploymentFailed extends CustomEmailNotification$message->addField('Environment', $this->environment_name, true);$message->addField('Name', $this->application_name, true);- $message->addField('Deployment Logs', '[Link](' . $this->deployment_url . ')');+ $message->addField('Deployment Logs', '[Link]('.$this->deployment_url.')');if ($this->fqdn) {$message->addField('Domain', $this->fqdn, true);}} else {if ($this->fqdn) {- $description = '[Open application](' . $this->fqdn . ')';+ $description = '[Open application]('.$this->fqdn.')';} else {$description = '';}@@ -104,7 +104,7 @@ class DeploymentFailed extends CustomEmailNotification$message->addField('Environment', $this->environment_name, true);$message->addField('Name', $this->application_name, true);- $message->addField('Deployment Logs', '[Link](' . $this->deployment_url . ')');+ $message->addField('Deployment Logs', '[Link]('.$this->deployment_url.')');}return $message;@@ -113,9 +113,9 @@ class DeploymentFailed extends CustomEmailNotificationpublic function toTelegram(): array{if ($this->preview) {- $message = 'Coolify: Pull request #' . $this->preview->pull_request_id . ' of ' . $this->application_name . ' (' . $this->preview->fqdn . ') deployment failed: ';+ $message = 'Coolify: Pull request #'.$this->preview->pull_request_id.' of '.$this->application_name.' ('.$this->preview->fqdn.') deployment failed: ';} else {- $message = 'Coolify: Deployment failed of ' . $this->application_name . ' (' . $this->fqdn . '): ';+ $message = 'Coolify: Deployment failed of '.$this->application_name.' ('.$this->fqdn.'): ';}$buttons[] = ['text' => 'Deployment logs',@@ -139,14 +139,14 @@ class DeploymentFailed extends CustomEmailNotification$description .= "\nPreview URL: {$this->preview->fqdn}";}} else {- $title = "Deployment failed";+ $title = 'Deployment failed';$description = "Deployment failed for {$this->application_name}";if ($this->fqdn) {$description .= "\nApplication URL: {$this->fqdn}";}}- $description .= "\n\n**Project:** " . data_get($this->application, 'environment.project.name');+ $description .= "\n\n**Project:** ".data_get($this->application, 'environment.project.name');$description .= "\n**Environment:** {$this->environment_name}";$description .= "\n**Deployment Logs:** {$this->deployment_url}";diff --git a/app/Notifications/Application/DeploymentSuccess.php b/app/Notifications/Application/DeploymentSuccess.phpindex 565bce0a5c..548f5c6e5d 100644--- a/app/Notifications/Application/DeploymentSuccess.php+++ b/app/Notifications/Application/DeploymentSuccess.php@@ -6,8 +6,8 @@ use App\Models\Application;use App\Models\ApplicationPreview;use App\Notifications\CustomEmailNotification;use App\Notifications\Dto\DiscordMessage;-use Illuminate\Notifications\Messages\MailMessage;use App\Notifications\Dto\SlackMessage;+use Illuminate\Notifications\Messages\MailMessage;class DeploymentSuccess extends CustomEmailNotification{@@ -40,18 +40,12 @@ class DeploymentSuccess extends CustomEmailNotificationif (str($this->fqdn)->explode(',')->count() > 1) {$this->fqdn = str($this->fqdn)->explode(',')->first();}- $this->deployment_url = base_url() . "/project/{$this->project_uuid}/" . urlencode($this->environment_name) . "/application/{$this->application->uuid}/deployment/{$this->deployment_uuid}";+ $this->deployment_url = base_url()."/project/{$this->project_uuid}/".urlencode($this->environment_name)."/application/{$this->application->uuid}/deployment/{$this->deployment_uuid}";}public function via(object $notifiable): array{- $channels = setNotificationChannels($notifiable, 'deployments');- if (isCloud()) {- // TODO: Make batch notifications work with email- $channels = array_diff($channels, [\App\Notifications\Channels\EmailChannel::class]);- }-- return $channels;+ return $notifiable->getEnabledChannels('deployment_success');}public function toMail(): MailMessage@@ -80,21 +74,21 @@ class DeploymentSuccess extends CustomEmailNotificationif ($this->preview) {$message = new DiscordMessage(title: ':white_check_mark: Preview deployment successful',- description: 'Pull request: ' . $this->preview->pull_request_id,+ description: 'Pull request: '.$this->preview->pull_request_id,color: DiscordMessage::successColor(),);if ($this->preview->fqdn) {- $message->addField('Application', '[Link](' . $this->preview->fqdn . ')');+ $message->addField('Application', '[Link]('.$this->preview->fqdn.')');}$message->addField('Project', data_get($this->application, 'environment.project.name'), true);$message->addField('Environment', $this->environment_name, true);$message->addField('Name', $this->application_name, true);- $message->addField('Deployment logs', '[Link](' . $this->deployment_url . ')');+ $message->addField('Deployment logs', '[Link]('.$this->deployment_url.')');} else {if ($this->fqdn) {- $description = '[Open application](' . $this->fqdn . ')';+ $description = '[Open application]('.$this->fqdn.')';} else {$description = '';}@@ -107,7 +101,7 @@ class DeploymentSuccess extends CustomEmailNotification$message->addField('Environment', $this->environment_name, true);$message->addField('Name', $this->application_name, true);- $message->addField('Deployment logs', '[Link](' . $this->deployment_url . ')');+ $message->addField('Deployment logs', '[Link]('.$this->deployment_url.')');}return $message;@@ -116,7 +110,7 @@ class DeploymentSuccess extends CustomEmailNotificationpublic function toTelegram(): array{if ($this->preview) {- $message = 'Coolify: New PR' . $this->preview->pull_request_id . ' version successfully deployed of ' . $this->application_name . '';+ $message = 'Coolify: New PR'.$this->preview->pull_request_id.' version successfully deployed of '.$this->application_name.'';if ($this->preview->fqdn) {$buttons[] = ['text' => 'Open Application',@@ -124,7 +118,7 @@ class DeploymentSuccess extends CustomEmailNotification];}} else {- $message = '✅ New version successfully deployed of ' . $this->application_name . '';+ $message = '✅ New version successfully deployed of '.$this->application_name.'';if ($this->fqdn) {$buttons[] = ['text' => 'Open Application',@@ -145,7 +139,6 @@ class DeploymentSuccess extends CustomEmailNotification];}-public function toSlack(): SlackMessage{if ($this->preview) {@@ -155,14 +148,14 @@ class DeploymentSuccess extends CustomEmailNotification$description .= "\nPreview URL: {$this->preview->fqdn}";}} else {- $title = "New version successfully deployed";+ $title = 'New version successfully deployed';$description = "New version successfully deployed for {$this->application_name}";if ($this->fqdn) {$description .= "\nApplication URL: {$this->fqdn}";}}- $description .= "\n\n**Project:** " . data_get($this->application, 'environment.project.name');+ $description .= "\n\n**Project:** ".data_get($this->application, 'environment.project.name');$description .= "\n**Environment:** {$this->environment_name}";$description .= "\n**Deployment Logs:** {$this->deployment_url}";diff --git a/app/Notifications/Application/StatusChanged.php b/app/Notifications/Application/StatusChanged.phpindex 18c042ca6c..32a6a659a0 100644--- a/app/Notifications/Application/StatusChanged.php+++ b/app/Notifications/Application/StatusChanged.php@@ -5,8 +5,8 @@ namespace App\Notifications\Application;use App\Models\Application;use App\Notifications\CustomEmailNotification;use App\Notifications\Dto\DiscordMessage;-use Illuminate\Notifications\Messages\MailMessage;use App\Notifications\Dto\SlackMessage;+use Illuminate\Notifications\Messages\MailMessage;class StatusChanged extends CustomEmailNotification{@@ -30,12 +30,12 @@ class StatusChanged extends CustomEmailNotificationif (str($this->fqdn)->explode(',')->count() > 1) {$this->fqdn = str($this->fqdn)->explode(',')->first();}- $this->resource_url = base_url() . "/project/{$this->project_uuid}/" . urlencode($this->environment_name) . "/application/{$this->resource->uuid}";+ $this->resource_url = base_url()."/project/{$this->project_uuid}/".urlencode($this->environment_name)."/application/{$this->resource->uuid}";}public function via(object $notifiable): array{- return setNotificationChannels($notifiable, 'status_changes');+ return $notifiable->getEnabledChannels('status_change');}public function toMail(): MailMessage@@ -56,7 +56,7 @@ class StatusChanged extends CustomEmailNotification{return new DiscordMessage(title: ':cross_mark: Application stopped',- description: '[Open Application in Coolify](' . $this->resource_url . ')',+ description: '[Open Application in Coolify]('.$this->resource_url.')',color: DiscordMessage::errorColor(),isCritical: true,);@@ -64,7 +64,7 @@ class StatusChanged extends CustomEmailNotificationpublic function toTelegram(): array{- $message = 'Coolify: ' . $this->resource_name . ' has been stopped.';+ $message = 'Coolify: '.$this->resource_name.' has been stopped.';return ['message' => $message,@@ -79,10 +79,10 @@ class StatusChanged extends CustomEmailNotificationpublic function toSlack(): SlackMessage{- $title = "Application stopped";+ $title = 'Application 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');$description .= "\n**Environment:** {$this->environment_name}";$description .= "\n**Application URL:** {$this->resource_url}";diff --git a/app/Notifications/Container/ContainerRestarted.php b/app/Notifications/Container/ContainerRestarted.phpindex e1cf836ff7..c25072ecfa 100644--- a/app/Notifications/Container/ContainerRestarted.php+++ b/app/Notifications/Container/ContainerRestarted.php@@ -5,8 +5,8 @@ namespace App\Notifications\Container;use App\Models\Server;use App\Notifications\CustomEmailNotification;use App\Notifications\Dto\DiscordMessage;-use Illuminate\Notifications\Messages\MailMessage;use App\Notifications\Dto\SlackMessage;+use Illuminate\Notifications\Messages\MailMessage;class ContainerRestarted extends CustomEmailNotification{@@ -17,7 +17,7 @@ class ContainerRestarted extends CustomEmailNotificationpublic function via(object $notifiable): array{- return setNotificationChannels($notifiable, 'status_changes');+ return $notifiable->getEnabledChannels('status_change');}public function toMail(): MailMessage@@ -42,7 +42,7 @@ class ContainerRestarted extends CustomEmailNotification);if ($this->url) {- $message->addField('Resource', '[Link](' . $this->url . ')');+ $message->addField('Resource', '[Link]('.$this->url.')');}return $message;@@ -70,7 +70,7 @@ class ContainerRestarted extends CustomEmailNotificationpublic function toSlack(): SlackMessage{- $title = "Resource restarted";+ $title = 'Resource restarted';$description = "A resource ({$this->name}) has been restarted automatically on {$this->server->name}";if ($this->url) {diff --git a/app/Notifications/Container/ContainerStopped.php b/app/Notifications/Container/ContainerStopped.phpindex 76c2dae802..bc6e52b6dc 100644--- a/app/Notifications/Container/ContainerStopped.php+++ b/app/Notifications/Container/ContainerStopped.php@@ -5,8 +5,8 @@ namespace App\Notifications\Container;use App\Models\Server;use App\Notifications\CustomEmailNotification;use App\Notifications\Dto\DiscordMessage;-use Illuminate\Notifications\Messages\MailMessage;use App\Notifications\Dto\SlackMessage;+use Illuminate\Notifications\Messages\MailMessage;class ContainerStopped extends CustomEmailNotification{@@ -17,7 +17,7 @@ class ContainerStopped extends CustomEmailNotificationpublic function via(object $notifiable): array{- return setNotificationChannels($notifiable, 'status_changes');+ return $notifiable->getEnabledChannels('status_change');}public function toMail(): MailMessage@@ -42,7 +42,7 @@ class ContainerStopped extends CustomEmailNotification);if ($this->url) {- $message->addField('Resource', '[Link](' . $this->url . ')');+ $message->addField('Resource', '[Link]('.$this->url.')');}return $message;@@ -70,7 +70,7 @@ class ContainerStopped extends CustomEmailNotificationpublic function toSlack(): SlackMessage{- $title = "Resource stopped";+ $title = 'Resource stopped';$description = "A resource ({$this->name}) has been stopped unexpectedly on {$this->server->name}";if ($this->url) {diff --git a/app/Notifications/Database/BackupFailed.php b/app/Notifications/Database/BackupFailed.phpindex a1b5c42e5d..2208f7b1da 100644--- a/app/Notifications/Database/BackupFailed.php+++ b/app/Notifications/Database/BackupFailed.php@@ -5,8 +5,8 @@ namespace App\Notifications\Database;use App\Models\ScheduledDatabaseBackup;use App\Notifications\CustomEmailNotification;use App\Notifications\Dto\DiscordMessage;-use Illuminate\Notifications\Messages\MailMessage;use App\Notifications\Dto\SlackMessage;+use Illuminate\Notifications\Messages\MailMessage;class BackupFailed extends CustomEmailNotification{@@ -23,13 +23,13 @@ class BackupFailed extends CustomEmailNotificationpublic function via(object $notifiable): array{- return setNotificationChannels($notifiable, 'database_backups');+ return $notifiable->getEnabledChannels('backup_failure');}public function toMail(): 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', ['name' => $this->name,'database_name' => $this->database_name,@@ -66,7 +66,7 @@ class BackupFailed extends CustomEmailNotificationpublic function toSlack(): SlackMessage{- $title = "Database backup failed";+ $title = 'Database backup failed';$description = "Database backup for {$this->name} (db:{$this->database_name}) has FAILED.";$description .= "\n\n**Frequency:** {$this->frequency}";diff --git a/app/Notifications/Database/BackupSuccess.php b/app/Notifications/Database/BackupSuccess.phpindex f2aa247a6f..10b4ff3dfb 100644--- a/app/Notifications/Database/BackupSuccess.php+++ b/app/Notifications/Database/BackupSuccess.php@@ -5,8 +5,8 @@ namespace App\Notifications\Database;use App\Models\ScheduledDatabaseBackup;use App\Notifications\CustomEmailNotification;use App\Notifications\Dto\DiscordMessage;-use Illuminate\Notifications\Messages\MailMessage;use App\Notifications\Dto\SlackMessage;+use Illuminate\Notifications\Messages\MailMessage;class BackupSuccess extends CustomEmailNotification{@@ -24,7 +24,7 @@ class BackupSuccess extends CustomEmailNotificationpublic function via(object $notifiable): array{- return setNotificationChannels($notifiable, 'database_backups');+ return $notifiable->getEnabledChannels('backup_success');}public function toMail(): MailMessage@@ -64,7 +64,7 @@ class BackupSuccess extends CustomEmailNotificationpublic function toSlack(): SlackMessage{- $title = "Database backup successful";+ $title = 'Database backup successful';$description = "Database backup for {$this->name} (db:{$this->database_name}) was successful.";$description .= "\n\n**Frequency:** {$this->frequency}";diff --git a/app/Notifications/ScheduledTask/TaskFailed.php b/app/Notifications/ScheduledTask/TaskFailed.phpindex 53b7f46a3e..878eae5bcc 100644--- a/app/Notifications/ScheduledTask/TaskFailed.php+++ b/app/Notifications/ScheduledTask/TaskFailed.php@@ -5,8 +5,8 @@ namespace App\Notifications\ScheduledTask;use App\Models\ScheduledTask;use App\Notifications\CustomEmailNotification;use App\Notifications\Dto\DiscordMessage;-use Illuminate\Notifications\Messages\MailMessage;use App\Notifications\Dto\SlackMessage;+use Illuminate\Notifications\Messages\MailMessage;class TaskFailed extends CustomEmailNotification{@@ -24,7 +24,7 @@ class TaskFailed extends CustomEmailNotificationpublic function via(object $notifiable): array{- return setNotificationChannels($notifiable, 'scheduled_tasks');+ return $notifiable->getEnabledChannels('scheduled_task_failure');}public function toMail(): MailMessage@@ -49,7 +49,7 @@ class TaskFailed extends CustomEmailNotification);if ($this->url) {- $message->addField('Scheduled task', '[Link](' . $this->url . ')');+ $message->addField('Scheduled task', '[Link]('.$this->url.')');}return $message;@@ -72,7 +72,7 @@ class TaskFailed extends CustomEmailNotificationpublic function toSlack(): SlackMessage{- $title = "Scheduled task failed";+ $title = 'Scheduled task failed';$description = "Scheduled task ({$this->task->name}) failed.";if ($this->output) {diff --git a/app/Notifications/Server/DockerCleanup.php b/app/Notifications/Server/DockerCleanup.phpindex 46b730c7b1..f4f8ffd098 100644--- a/app/Notifications/Server/DockerCleanup.php+++ b/app/Notifications/Server/DockerCleanup.php@@ -3,11 +3,10 @@namespace App\Notifications\Server;use App\Models\Server;-use App\Notifications\Channels\DiscordChannel;-use App\Notifications\Channels\TelegramChannel;use App\Notifications\CustomEmailNotification;use App\Notifications\Dto\DiscordMessage;use App\Notifications\Dto\SlackMessage;+use Illuminate\Notifications\Messages\MailMessage;class DockerCleanup extends CustomEmailNotification{@@ -18,38 +17,20 @@ class DockerCleanup extends CustomEmailNotificationpublic function via(object $notifiable): array{- $channels = [];- // $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;+ return $notifiable->getEnabledChannels('docker_cleanup');}- // public function toMail(): MailMessage- // {- // $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 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,+ ]);++ return $mail;+ }public function toDiscord(): DiscordMessage{diff --git a/app/Notifications/Server/HighDiskUsage.php b/app/Notifications/Server/HighDiskUsage.phpindex 40c0e2cb6d..9f4826689e 100644--- a/app/Notifications/Server/HighDiskUsage.php+++ b/app/Notifications/Server/HighDiskUsage.php@@ -17,7 +17,7 @@ class HighDiskUsage extends CustomEmailNotificationpublic function via(object $notifiable): array{- return setNotificationChannels($notifiable, 'server_disk_usage');+ return $notifiable->getEnabledChannels('server_disk_usage');}public function toMail(): MailMessage@@ -45,7 +45,7 @@ class HighDiskUsage extends CustomEmailNotification$message->addField('Disk usage', "{$this->disk_usage}%", true);$message->addField('Threshold', "{$this->server_disk_usage_notification_threshold}%", true);$message->addField('What to do?', '[Link](https://coolify.io/docs/knowledge-base/server/automated-cleanup)', true);- $message->addField('Change Settings', '[Threshold](' . base_url() . '/server/' . $this->server->uuid . '#advanced) | [Notification](' . base_url() . '/notifications/discord)');+ $message->addField('Change Settings', '[Threshold]('.base_url().'/server/'.$this->server->uuid.'#advanced) | [Notification]('.base_url().'/notifications/discord)');return $message;}@@ -65,8 +65,8 @@ class HighDiskUsage extends CustomEmailNotification$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 .= "Change settings:\n";- $description .= "- Threshold: " . base_url() . "/server/" . $this->server->uuid . "#advanced\n";- $description .= "- Notifications: " . base_url() . "/notifications/discord";+ $description .= '- Threshold: '.base_url().'/server/'.$this->server->uuid."#advanced\n";+ $description .= '- Notifications: '.base_url().'/notifications/discord';return new SlackMessage(title: 'High disk usage detected',diff --git a/app/Notifications/Server/Reachable.php b/app/Notifications/Server/Reachable.phpindex a0dfd1cc52..4917e04f8c 100644--- a/app/Notifications/Server/Reachable.php+++ b/app/Notifications/Server/Reachable.php@@ -3,13 +3,9 @@namespace App\Notifications\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\Dto\DiscordMessage;+use App\Notifications\Dto\SlackMessage;use Illuminate\Notifications\Messages\MailMessage;class Reachable extends CustomEmailNotification@@ -20,7 +16,7 @@ class Reachable extends CustomEmailNotification{$this->onQueue('high');$this->isRateLimited = isEmailRateLimited(- limiterKey: 'server-reachable:' . $this->server->id,+ limiterKey: 'server-reachable:'.$this->server->id,);}@@ -30,25 +26,7 @@ class Reachable extends CustomEmailNotificationreturn [];}- $channels = [];- $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;+ return $notifiable->getEnabledChannels('server_reachable');}public function toMail(): MailMessage@@ -78,13 +56,10 @@ class Reachable extends CustomEmailNotification];}---public function toSlack(): SlackMessage{return new SlackMessage(- title: "Server revived",+ title: 'Server revived',description: "Server '{$this->server->name}' revived.\nAll automations & integrations are turned on again!",color: SlackMessage::successColor());diff --git a/app/Notifications/Server/Unreachable.php b/app/Notifications/Server/Unreachable.phpindex 0bd44ef3de..43f176d49d 100644--- a/app/Notifications/Server/Unreachable.php+++ b/app/Notifications/Server/Unreachable.php@@ -3,13 +3,9 @@namespace App\Notifications\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\Dto\DiscordMessage;+use App\Notifications\Dto\SlackMessage;use Illuminate\Notifications\Messages\MailMessage;class Unreachable extends CustomEmailNotification@@ -20,7 +16,7 @@ class Unreachable extends CustomEmailNotification{$this->onQueue('high');$this->isRateLimited = isEmailRateLimited(- limiterKey: 'server-unreachable:' . $this->server->id,+ limiterKey: 'server-unreachable:'.$this->server->id,);}@@ -30,26 +26,7 @@ class Unreachable extends CustomEmailNotificationreturn [];}- $channels = [];- $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;+ return $notifiable->getEnabledChannels('server_unreachable');}public function toMail(): ?MailMessage@@ -83,12 +60,11 @@ class Unreachable extends CustomEmailNotification];}-public function toSlack(): SlackMessage{$description = "Your server '{$this->server->name}' is unreachable.\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(title: 'Server unreachable',