Skip to content

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.

feat: always sent notifications

peaklabs-deva849bfdc3eb2
diff --git a/app/Notifications/Internal/GeneralNotification.php b/app/Notifications/Internal/GeneralNotification.php
index 699291d16b..7049e3055d 100644
--- a/app/Notifications/Internal/GeneralNotification.php
+++ b/app/Notifications/Internal/GeneralNotification.php
@@ -2,9 +2,6 @@
namespace App\Notifications\Internal;
-use App\Notifications\Channels\DiscordChannel;
-use App\Notifications\Channels\TelegramChannel;
-use App\Notifications\Channels\SlackChannel;
use App\Notifications\Dto\DiscordMessage;
use App\Notifications\Dto\SlackMessage;
use Illuminate\Bus\Queueable;
@@ -24,22 +21,7 @@ class GeneralNotification extends Notification implements ShouldQueue
public function via(object $notifiable): array
{
- $channels = [];
- $isDiscordEnabled = data_get($notifiable, 'discord_enabled');
- $isTelegramEnabled = data_get($notifiable, 'telegram_enabled');
- $isSlackEnabled = data_get($notifiable, 'slack_enabled');
-
- if ($isDiscordEnabled) {
- $channels[] = DiscordChannel::class;
- }
- if ($isTelegramEnabled) {
- $channels[] = TelegramChannel::class;
- }
- if ($isSlackEnabled) {
- $channels[] = SlackChannel::class;
- }
-
- return $channels;
+ return $notifiable->getEnabledChannels('general');
}
public function toDiscord(): DiscordMessage
diff --git a/app/Notifications/Server/ForceDisabled.php b/app/Notifications/Server/ForceDisabled.php
index 1939170f6b..e122849da3 100644
--- a/app/Notifications/Server/ForceDisabled.php
+++ b/app/Notifications/Server/ForceDisabled.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 ForceDisabled extends CustomEmailNotification
@@ -21,25 +17,7 @@ class ForceDisabled extends CustomEmailNotification
public 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('server_force_disabled');
}
public function toMail(): MailMessage
@@ -73,13 +51,12 @@ class ForceDisabled extends CustomEmailNotification
];
}
-
public function toSlack(): SlackMessage
{
- $title = "Server disabled";
+ $title = 'Server disabled';
$description = "Server ({$this->server->name}) disabled because it is not paid!\n";
$description .= "All automations and integrations are stopped.\n\n";
- $description .= "Please update your subscription to enable the server again: https://app.coolify.io/subscriptions";
+ $description .= 'Please update your subscription to enable the server again: https://app.coolify.io/subscriptions';
return new SlackMessage(
title: $title,
diff --git a/app/Notifications/Server/ForceEnabled.php b/app/Notifications/Server/ForceEnabled.php
index 4b6181e192..a0e0a8b59d 100644
--- a/app/Notifications/Server/ForceEnabled.php
+++ b/app/Notifications/Server/ForceEnabled.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 ForceEnabled extends CustomEmailNotification
@@ -21,25 +17,7 @@ class ForceEnabled extends CustomEmailNotification
public 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('server_force_enabled');
}
public function toMail(): MailMessage
@@ -69,7 +47,6 @@ class ForceEnabled extends CustomEmailNotification
];
}
-
public function toSlack(): SlackMessage
{
return new SlackMessage(
@@ -78,5 +55,4 @@ class ForceEnabled extends CustomEmailNotification
color: SlackMessage::successColor()
);
}
-
}