From f70a9c6974be8b0975266975fc4ddc093e6d2ef0 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 1 Mar 2024 19:07:21 +0100 Subject: [PATCH] Fix notification channels in ApplicationDeploymentJob and DeploymentSuccess --- app/Jobs/ApplicationDeploymentJob.php | 2 +- app/Notifications/Application/DeploymentSuccess.php | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index cded183aa..becf6387a 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -1651,7 +1651,7 @@ private function next(string $status) if (!$this->only_this_server) { $this->deploy_to_additional_destinations(); } - // $this->application->environment->project->team?->notify(new DeploymentSuccess($this->application, $this->deployment_uuid, $this->preview)); + $this->application->environment->project->team?->notify(new DeploymentSuccess($this->application, $this->deployment_uuid, $this->preview)); } } diff --git a/app/Notifications/Application/DeploymentSuccess.php b/app/Notifications/Application/DeploymentSuccess.php index 0f03885e8..8a409aa94 100644 --- a/app/Notifications/Application/DeploymentSuccess.php +++ b/app/Notifications/Application/DeploymentSuccess.php @@ -43,7 +43,11 @@ public function __construct(Application $application, string $deployment_uuid, A public function via(object $notifiable): array { - return setNotificationChannels($notifiable, 'deployments'); + $channels = setNotificationChannels($notifiable, 'deployments'); + $channels = array_filter($channels, function ($channel) { + return $channel !== 'App\Notifications\Channels\EmailChannel'; + }); + return $channels; } public function toMail(): MailMessage @@ -69,7 +73,7 @@ public function toMail(): MailMessage public function toDiscord(): string { 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) {