few fixes

This commit is contained in:
Andras Bacsai
2023-06-20 15:25:45 +02:00
parent de759290e5
commit f648ab49f7
5 changed files with 29 additions and 26 deletions

View File

@@ -31,7 +31,6 @@ class DeployedSuccessfullyNotification extends Notification implements ShouldQue
$this->application = $application;
$this->deployment_uuid = $deployment_uuid;
$this->preview = $preview;
$this->application_name = data_get($application, 'name');
$this->project_uuid = data_get($application, 'environment.project.uuid');
$this->environment_name = data_get($application, 'environment.name');
@@ -55,12 +54,17 @@ class DeployedSuccessfullyNotification extends Notification implements ShouldQue
public function toMail(Team $team): MailMessage
{
$mail = new MailMessage();
$mail->subject("✅ New version is deployed of {$this->application_name}");
$pull_request_id = data_get($this->preview, 'pull_request_id', 0);
if ($pull_request_id === 0) {
$mail->subject("✅ New version is deployed of {$this->application_name}");
} else {
$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,
'pull_request_id' => $this->preview->pull_request_id,
'pull_request_id' => $pull_request_id,
]);
return $mail;
}

View File

@@ -60,7 +60,7 @@ class DeployedWithErrorNotification extends Notification implements ShouldQueue
'name' => $this->application_name,
'fqdn' => $this->fqdn,
'url' => $this->deployment_url,
'pull_request_id' => $this->preview->pull_request_id,
'pull_request_id' => data_get($this->preview, 'pull_request_id', 0),
]);
return $mail;
}