Revert "rector: arrrrr"

This reverts commit 16c0cd10d8.
This commit is contained in:
Andras Bacsai
2025-01-07 15:31:43 +01:00
parent da07b4fdcf
commit 1fe4dd722b
349 changed files with 3689 additions and 4184 deletions

View File

@@ -30,12 +30,12 @@ class DeploymentFailed extends CustomEmailNotification
public ?string $fqdn = null;
public function __construct(Application $application, string $deployment_uuid, ?ApplicationPreview $applicationPreview = null)
public function __construct(Application $application, string $deployment_uuid, ?ApplicationPreview $preview = null)
{
$this->onQueue('high');
$this->application = $application;
$this->deployment_uuid = $deployment_uuid;
$this->preview = $applicationPreview;
$this->preview = $preview;
$this->application_name = data_get($application, 'name');
$this->project_uuid = data_get($application, 'environment.project.uuid');
$this->environment_uuid = data_get($application, 'environment.uuid');
@@ -54,28 +54,28 @@ class DeploymentFailed extends CustomEmailNotification
public function toMail(): MailMessage
{
$mailMessage = new MailMessage;
$mail = new MailMessage;
$pull_request_id = data_get($this->preview, 'pull_request_id', 0);
$fqdn = $this->fqdn;
if ($pull_request_id === 0) {
$mailMessage->subject('Coolify: Deployment failed of '.$this->application_name.'.');
$mail->subject('Coolify: Deployment failed of '.$this->application_name.'.');
} else {
$fqdn = $this->preview->fqdn;
$mailMessage->subject('Coolify: Deployment failed of pull request #'.$this->preview->pull_request_id.' of '.$this->application_name.'.');
$mail->subject('Coolify: Deployment failed of pull request #'.$this->preview->pull_request_id.' of '.$this->application_name.'.');
}
$mailMessage->view('emails.application-deployment-failed', [
$mail->view('emails.application-deployment-failed', [
'name' => $this->application_name,
'fqdn' => $fqdn,
'deployment_url' => $this->deployment_url,
'pull_request_id' => data_get($this->preview, 'pull_request_id', 0),
]);
return $mailMessage;
return $mail;
}
public function toDiscord(): DiscordMessage
{
if ($this->preview instanceof ApplicationPreview) {
if ($this->preview) {
$message = new DiscordMessage(
title: ':cross_mark: Deployment failed',
description: 'Pull request: '.$this->preview->pull_request_id,
@@ -92,16 +92,22 @@ class DeploymentFailed extends CustomEmailNotification
$message->addField('Domain', $this->fqdn, true);
}
} else {
$description = $this->fqdn ? '[Open application]('.$this->fqdn.')' : '';
if ($this->fqdn) {
$description = '[Open application]('.$this->fqdn.')';
} else {
$description = '';
}
$message = new DiscordMessage(
title: ':cross_mark: Deployment failed',
description: $description,
color: DiscordMessage::errorColor(),
isCritical: true,
);
$message->addField('Project', data_get($this->application, 'environment.project.name'), true);
$message->addField('Environment', $this->environment_name, true);
$message->addField('Name', $this->application_name, true);
$message->addField('Deployment Logs', '[Link]('.$this->deployment_url.')');
}
@@ -110,7 +116,7 @@ class DeploymentFailed extends CustomEmailNotification
public function toTelegram(): array
{
if ($this->preview instanceof ApplicationPreview) {
if ($this->preview) {
$message = 'Coolify: Pull request #'.$this->preview->pull_request_id.' of '.$this->application_name.' ('.$this->preview->fqdn.') deployment failed: ';
} else {
$message = 'Coolify: Deployment failed of '.$this->application_name.' ('.$this->fqdn.'): ';
@@ -130,7 +136,7 @@ class DeploymentFailed extends CustomEmailNotification
public function toPushover(): PushoverMessage
{
if ($this->preview instanceof ApplicationPreview) {
if ($this->preview) {
$title = "Pull request #{$this->preview->pull_request_id} deployment failed";
$message = "Pull request deployment failed for {$this->application_name}";
} else {
@@ -155,7 +161,7 @@ class DeploymentFailed extends CustomEmailNotification
public function toSlack(): SlackMessage
{
if ($this->preview instanceof ApplicationPreview) {
if ($this->preview) {
$title = "Pull request #{$this->preview->pull_request_id} deployment failed";
$description = "Pull request deployment failed for {$this->application_name}";
if ($this->preview->fqdn) {