fix: null notify

This commit is contained in:
Andras Bacsai 2023-12-13 12:01:27 +01:00
parent d93bf97919
commit 2dc175be63
10 changed files with 15 additions and 15 deletions

View File

@ -1341,10 +1341,10 @@ private function next(string $status)
}
queue_next_deployment($this->application);
if ($status === ApplicationDeploymentStatus::FINISHED->value) {
$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));
}
if ($status === ApplicationDeploymentStatus::FAILED->value) {
$this->application->environment->project->team->notify(new DeploymentFailed($this->application, $this->deployment_uuid, $this->preview));
$this->application->environment->project->team?->notify(new DeploymentFailed($this->application, $this->deployment_uuid, $this->preview));
}
}

View File

@ -63,19 +63,19 @@ public function handle(): void
Sleep::for(10)->seconds();
if ($this->healthcheck()) {
if ($this->server->log_drain_notification_sent) {
$this->server->team->notify(new ContainerRestarted('Coolify Log Drainer', $this->server));
$this->server->team?->notify(new ContainerRestarted('Coolify Log Drainer', $this->server));
$this->server->update(['log_drain_notification_sent' => false]);
}
return;
}
if (!$this->server->log_drain_notification_sent) {
ray('Log drain container still unhealthy. Sending notification...');
$this->server->team->notify(new ContainerStopped('Coolify Log Drainer', $this->server, null));
$this->server->team?->notify(new ContainerStopped('Coolify Log Drainer', $this->server, null));
$this->server->update(['log_drain_notification_sent' => true]);
}
} else {
if ($this->server->log_drain_notification_sent) {
$this->server->team->notify(new ContainerRestarted('Coolify Log Drainer', $this->server));
$this->server->team?->notify(new ContainerRestarted('Coolify Log Drainer', $this->server));
$this->server->update(['log_drain_notification_sent' => false]);
}
}

View File

@ -286,7 +286,7 @@ public function handle(): void
if ($this->backup->save_s3) {
$this->upload_to_s3();
}
$this->team->notify(new BackupSuccess($this->backup, $this->database));
$this->team?->notify(new BackupSuccess($this->backup, $this->database));
$this->backup_log->update([
'status' => 'success',
'message' => $this->backup_output,
@ -302,7 +302,7 @@ public function handle(): void
]);
}
send_internal_notification('DatabaseBackupJob failed with: ' . $e->getMessage());
$this->team->notify(new BackupFailed($this->backup, $this->database, $this->backup_output));
$this->team?->notify(new BackupFailed($this->backup, $this->database, $this->backup_output));
throw $e;
}
}

View File

@ -54,7 +54,7 @@ public function cleanup(bool $notify = false): void
} else {
$this->server->high_disk_usage_notification_sent = true;
$this->server->save();
$this->server->team->notify(new HighDiskUsage($this->server, $this->disk_usage, $this->server->settings->cleanup_after_percentage));
$this->server->team?->notify(new HighDiskUsage($this->server, $this->disk_usage, $this->server->settings->cleanup_after_percentage));
}
} else {
DockerCleanupJob::dispatchSync($this->server);

View File

@ -52,7 +52,7 @@ public function saveModel()
public function sendTestNotification()
{
$this->team->notify(new Test());
$this->team?->notify(new Test());
$this->dispatch('success', 'Test notification sent.');
}
}

View File

@ -70,7 +70,7 @@ public function submitFromFields()
}
public function sendTestNotification()
{
$this->team->notify(new Test($this->emails));
$this->team?->notify(new Test($this->emails));
$this->dispatch('success', 'Test Email sent successfully.');
}
public function instantSaveInstance()

View File

@ -58,7 +58,7 @@ public function saveModel()
public function sendTestNotification()
{
$this->team->notify(new Test());
$this->team?->notify(new Test());
$this->dispatch('success', 'Test notification sent.');
}
}

View File

@ -106,7 +106,7 @@ public function submit()
public function sendTestNotification()
{
$this->settings->notify(new Test($this->emails));
$this->settings?->notify(new Test($this->emails));
$this->dispatch('success', 'Test email sent.');
}
}

View File

@ -164,7 +164,7 @@ public function isServerReady()
if ($serverUptimeCheckNumber >= $serverUptimeCheckNumberMax) {
if ($this->unreachable_notification_sent === false) {
ray('Server unreachable, sending notification...');
$this->team->notify(new Unreachable($this));
$this->team?->notify(new Unreachable($this));
$this->update(['unreachable_notification_sent' => true]);
}
$this->settings()->update([
@ -401,7 +401,7 @@ public function validateConnection()
}
if (data_get($server, 'unreachable_notification_sent') === true) {
$server->team->notify(new Revived($server));
$server->team?->notify(new Revived($server));
$server->update(['unreachable_notification_sent' => false]);
}

View File

@ -98,7 +98,7 @@ public function sendVerificationEmail()
}
public function sendPasswordResetNotification($token): void
{
$this->notify(new TransactionalEmailsResetPassword($token));
$this?->notify(new TransactionalEmailsResetPassword($token));
}
public function isAdmin()