feat: always sent notifications

This commit is contained in:
peaklabs-dev
2024-12-09 17:00:07 +01:00
parent b6500142c4
commit a849bfdc3e
3 changed files with 7 additions and 72 deletions

View File

@@ -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()
);
}
}