diff --git a/app/Jobs/SendMessageToDiscordJob.php b/app/Jobs/SendMessageToDiscordJob.php
index 8f1962829..11122e7e3 100644
--- a/app/Jobs/SendMessageToDiscordJob.php
+++ b/app/Jobs/SendMessageToDiscordJob.php
@@ -29,7 +29,8 @@ class SendMessageToDiscordJob implements ShouldQueue
public function __construct(
public string $text,
public string $webhookUrl
- ) {}
+ ) {
+ }
/**
* Execute the job.
@@ -39,7 +40,7 @@ class SendMessageToDiscordJob implements ShouldQueue
$payload = [
'content' => $this->text,
];
-
+ ray($payload);
Http::post($this->webhookUrl, $payload);
}
}
diff --git a/app/Notifications/Notifications/Application/DeployedSuccessfullyNotification.php b/app/Notifications/Notifications/Application/DeployedSuccessfullyNotification.php
index 22f0badc7..245aa194b 100644
--- a/app/Notifications/Notifications/Application/DeployedSuccessfullyNotification.php
+++ b/app/Notifications/Notifications/Application/DeployedSuccessfullyNotification.php
@@ -56,19 +56,21 @@ class DeployedSuccessfullyNotification extends Notification implements ShouldQue
}
return $channels;
}
- public function toMail(Team $team): MailMessage
+ public function toMail(): MailMessage
{
$mail = new MailMessage();
$pull_request_id = data_get($this->preview, 'pull_request_id', 0);
+ $fqdn = $this->fqdn;
if ($pull_request_id === 0) {
$mail->subject("✅ New version is deployed of {$this->application_name}");
} else {
+ $fqdn = $this->preview->fqdn;
$mail->subject("✅ Pull request #{$pull_request_id} of {$this->application_name} deployed successfully");
}
$mail->view('emails.application-deployed-successfully', [
'name' => $this->application_name,
- 'fqdn' => $this->fqdn,
- 'url' => $this->deployment_url,
+ 'fqdn' => $fqdn,
+ 'deployment_url' => $this->deployment_url,
'pull_request_id' => $pull_request_id,
]);
return $mail;
@@ -77,10 +79,11 @@ class DeployedSuccessfullyNotification extends Notification implements ShouldQue
public function toDiscord(): string
{
if ($this->preview) {
- $message = '✅ Pull request #' . $this->preview->pull_request_id . ' of **' . $this->application_name . '**. \n\n';
+ $message = '✅ Pull request #' . $this->preview->pull_request_id . ' of **' . $this->application_name . '** deployed successfully: ';
$message .= '[Application Link](' . $this->preview->fqdn . ') | [Deployment logs](' . $this->deployment_url . ')';
} else {
- $message = '✅ A new version has been deployed of **' . $this->application_name . '**. \n\n ';
+ $message = '✅ A new version has been deployed of **' . $this->application_name . '**.';
+ $message .= "\n\n";
$message .= '[Application Link](' . $this->fqdn . ') | [Deployment logs](' . $this->deployment_url . ')';
}
return $message;
diff --git a/app/Notifications/Notifications/Application/DeployedWithErrorNotification.php b/app/Notifications/Notifications/Application/DeployedWithErrorNotification.php
index 2e309024d..ef4c81770 100644
--- a/app/Notifications/Notifications/Application/DeployedWithErrorNotification.php
+++ b/app/Notifications/Notifications/Application/DeployedWithErrorNotification.php
@@ -57,14 +57,22 @@ class DeployedWithErrorNotification extends Notification implements ShouldQueue
}
return $channels;
}
- public function toMail(Team $team): MailMessage
+ public function toMail(): MailMessage
{
$mail = new MailMessage();
- $mail->subject("❌ Deployment failed of {$this->application_name}");
+ $pull_request_id = data_get($this->preview, 'pull_request_id', 0);
+ $fqdn = $this->fqdn;
+ if ($pull_request_id === 0) {
+ $mail->subject('❌ Deployment failed of ' . $this->application_name . '.');
+ } else {
+ $fqdn = $this->preview->fqdn;
+ $mail->subject('❌ Pull request #' . $this->preview->pull_request_id . ' of ' . $this->application_name . ' deployment failed.');
+ }
+
$mail->view('emails.application-deployed-with-error', [
'name' => $this->application_name,
- 'fqdn' => $this->fqdn,
- 'url' => $this->deployment_url,
+ 'fqdn' => $fqdn,
+ 'deployment_url' => $this->deployment_url,
'pull_request_id' => data_get($this->preview, 'pull_request_id', 0),
]);
return $mail;
@@ -72,13 +80,13 @@ class DeployedWithErrorNotification extends Notification implements ShouldQueue
public function toDiscord(): string
{
- $message = '❌ Deployment failed of **' . $this->application_name;
if ($this->preview) {
- $message .= ": PR# {$this->preview->pull_request_id}";
+ $message = '❌ Pull request #' . $this->preview->pull_request_id . ' of **' . $this->application_name . '** (' . $this->preview->fqdn . ') deployment failed: ';
+ $message .= '[View Deployment Logs](' . $this->deployment_url . ')';
+ } else {
+ $message = '❌ Deployment failed of **' . $this->application_name . '** (' . $this->fqdn . '): ';
+ $message .= '[View Deployment Logs](' . $this->deployment_url . ')';
}
- $message .= '**.';
- $message .= "\n\n";
- $message .= "[Deployment logs]({$this->deployment_url})";
return $message;
}
}
diff --git a/app/Notifications/Notifications/TestNotification.php b/app/Notifications/Notifications/TestNotification.php
index 8c9ada66a..7753c155d 100644
--- a/app/Notifications/Notifications/TestNotification.php
+++ b/app/Notifications/Notifications/TestNotification.php
@@ -45,8 +45,9 @@ class TestNotification extends Notification implements ShouldQueue
public function toDiscord(): string
{
- return 'This is a test Discord notification from Coolify.
-
-[Go to your dashboard](' . base_url() . ')';
+ $message = 'This is a test Discord notification from Coolify.';
+ $message .= "\n\n";
+ $message .= '[Go to your dashboard](' . base_url() . ')';
+ return $message;
}
}
diff --git a/resources/views/emails/application-deployed-successfully.blade.php b/resources/views/emails/application-deployed-successfully.blade.php
index 0e4fccf8e..ae52aa913 100644
--- a/resources/views/emails/application-deployed-successfully.blade.php
+++ b/resources/views/emails/application-deployed-successfully.blade.php
@@ -1,8 +1,8 @@
@if ($pull_request_id === 0)
- A new version of {{ $fqdn }} is available.
+ A new version of {{ $fqdn }} is available:
@else
- Pull request #{{ $pull_request_id }} is available for review at {{ $fqdn }}
+ Pull request #{{ $pull_request_id }} of {{ $name }} deployed successfully: Application Link |
@endif
-View
+View
Deployment Logs
diff --git a/resources/views/emails/application-deployed-with-error.blade.php b/resources/views/emails/application-deployed-with-error.blade.php
index d01c96bf8..c9a35860d 100644
--- a/resources/views/emails/application-deployed-with-error.blade.php
+++ b/resources/views/emails/application-deployed-with-error.blade.php
@@ -1,12 +1,8 @@
-Hello,
-
-Deployment failed of "{{ $name }}"
-
@if ($pull_request_id !== 0)
- :PR #{{ $pull_request_id }}
+ Pull Request #{{ $pull_request_id }} of {{ $name }} ({{ $fqdn }}) deployment failed:
+@else
+ Deployment failed of {{ $name }} ({{ $fqdn }}):
@endif
-to {{ $fqdn }}.
-
-Click the following link to view the deployment logs: View
- Deployment Logs
+View Deployment Logs