rector: arrrrr

This commit is contained in:
Andras Bacsai
2025-01-07 14:52:08 +01:00
parent c702ebff6d
commit 16c0cd10d8
349 changed files with 4204 additions and 3712 deletions

View File

@@ -10,11 +10,11 @@ class DiscordChannel
/**
* Send the given notification.
*/
public function send(SendsDiscord $notifiable, Notification $notification): void
public function send(SendsDiscord $sendsDiscord, Notification $notification): void
{
$message = $notification->toDiscord();
$discordSettings = $notifiable->discordNotificationSettings;
$discordSettings = $sendsDiscord->discordNotificationSettings;
if (! $discordSettings || ! $discordSettings->isEnabled() || ! $discordSettings->discord_webhook_url) {
return;

View File

@@ -9,16 +9,16 @@ use Illuminate\Support\Facades\Mail;
class EmailChannel
{
public function send(SendsEmail $notifiable, Notification $notification): void
public function send(SendsEmail $sendsEmail, Notification $notification): void
{
try {
$this->bootConfigs($notifiable);
$recipients = $notifiable->getRecipients($notification);
$this->bootConfigs($sendsEmail);
$recipients = $sendsEmail->getRecipients($notification);
if (count($recipients) === 0) {
throw new Exception('No email recipients found');
}
$mailMessage = $notification->toMail($notifiable);
$mailMessage = $notification->toMail($sendsEmail);
Mail::send(
[],
[],

View File

@@ -7,10 +7,10 @@ use Illuminate\Notifications\Notification;
class PushoverChannel
{
public function send(SendsPushover $notifiable, Notification $notification): void
public function send(SendsPushover $sendsPushover, Notification $notification): void
{
$message = $notification->toPushover();
$pushoverSettings = $notifiable->pushoverNotificationSettings;
$pushoverSettings = $sendsPushover->pushoverNotificationSettings;
if (! $pushoverSettings || ! $pushoverSettings->isEnabled() || ! $pushoverSettings->pushover_user_key || ! $pushoverSettings->pushover_api_token) {
return;

View File

@@ -10,10 +10,10 @@ class SlackChannel
/**
* Send the given notification.
*/
public function send(SendsSlack $notifiable, Notification $notification): void
public function send(SendsSlack $sendsSlack, Notification $notification): void
{
$message = $notification->toSlack();
$slackSettings = $notifiable->slackNotificationSettings;
$slackSettings = $sendsSlack->slackNotificationSettings;
if (! $slackSettings || ! $slackSettings->isEnabled() || ! $slackSettings->slack_webhook_url) {
return;

View File

@@ -3,6 +3,20 @@
namespace App\Notifications\Channels;
use App\Jobs\SendMessageToTelegramJob;
use App\Notifications\Application\DeploymentFailed;
use App\Notifications\Application\DeploymentSuccess;
use App\Notifications\Application\StatusChanged;
use App\Notifications\Container\ContainerRestarted;
use App\Notifications\Container\ContainerStopped;
use App\Notifications\Database\BackupFailed;
use App\Notifications\Database\BackupSuccess;
use App\Notifications\ScheduledTask\TaskFailed;
use App\Notifications\ScheduledTask\TaskSuccess;
use App\Notifications\Server\DockerCleanupFailed;
use App\Notifications\Server\DockerCleanupSuccess;
use App\Notifications\Server\HighDiskUsage;
use App\Notifications\Server\Reachable;
use App\Notifications\Server\Unreachable;
class TelegramChannel
{
@@ -17,23 +31,23 @@ class TelegramChannel
$chatId = $settings->telegram_chat_id;
$threadId = match (get_class($notification)) {
\App\Notifications\Application\DeploymentSuccess::class => $settings->telegram_notifications_deployment_success_thread_id,
\App\Notifications\Application\DeploymentFailed::class => $settings->telegram_notifications_deployment_failure_thread_id,
\App\Notifications\Application\StatusChanged::class,
\App\Notifications\Container\ContainerRestarted::class,
\App\Notifications\Container\ContainerStopped::class => $settings->telegram_notifications_status_change_thread_id,
DeploymentSuccess::class => $settings->telegram_notifications_deployment_success_thread_id,
DeploymentFailed::class => $settings->telegram_notifications_deployment_failure_thread_id,
StatusChanged::class,
ContainerRestarted::class,
ContainerStopped::class => $settings->telegram_notifications_status_change_thread_id,
\App\Notifications\Database\BackupSuccess::class => $settings->telegram_notifications_backup_success_thread_id,
\App\Notifications\Database\BackupFailed::class => $settings->telegram_notifications_backup_failure_thread_id,
BackupSuccess::class => $settings->telegram_notifications_backup_success_thread_id,
BackupFailed::class => $settings->telegram_notifications_backup_failure_thread_id,
\App\Notifications\ScheduledTask\TaskSuccess::class => $settings->telegram_notifications_scheduled_task_success_thread_id,
\App\Notifications\ScheduledTask\TaskFailed::class => $settings->telegram_notifications_scheduled_task_failure_thread_id,
TaskSuccess::class => $settings->telegram_notifications_scheduled_task_success_thread_id,
TaskFailed::class => $settings->telegram_notifications_scheduled_task_failure_thread_id,
\App\Notifications\Server\DockerCleanupSuccess::class => $settings->telegram_notifications_docker_cleanup_success_thread_id,
\App\Notifications\Server\DockerCleanupFailed::class => $settings->telegram_notifications_docker_cleanup_failure_thread_id,
\App\Notifications\Server\HighDiskUsage::class => $settings->telegram_notifications_server_disk_usage_thread_id,
\App\Notifications\Server\Unreachable::class => $settings->telegram_notifications_server_unreachable_thread_id,
\App\Notifications\Server\Reachable::class => $settings->telegram_notifications_server_reachable_thread_id,
DockerCleanupSuccess::class => $settings->telegram_notifications_docker_cleanup_success_thread_id,
DockerCleanupFailed::class => $settings->telegram_notifications_docker_cleanup_failure_thread_id,
HighDiskUsage::class => $settings->telegram_notifications_server_disk_usage_thread_id,
Unreachable::class => $settings->telegram_notifications_server_unreachable_thread_id,
Reachable::class => $settings->telegram_notifications_server_reachable_thread_id,
default => null,
};

View File

@@ -10,18 +10,18 @@ use Illuminate\Support\Facades\Mail;
class TransactionalEmailChannel
{
public function send(User $notifiable, Notification $notification): void
public function send(User $user, Notification $notification): void
{
$settings = instanceSettings();
if (! data_get($settings, 'smtp_enabled') && ! data_get($settings, 'resend_enabled')) {
return;
}
$email = $notifiable->email;
$email = $user->email;
if (! $email) {
return;
}
$this->bootConfigs();
$mailMessage = $notification->toMail($notifiable);
$mailMessage = $notification->toMail($user);
Mail::send(
[],
[],