From a25e2072d3bf449e72b1a4fc8ebcac297715f7f1 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 12 Feb 2025 10:19:45 +0100 Subject: [PATCH] fix(deployment): improve server selection for deployment cancellation - Add fallback for build server and deployment server selection - Use `ownedByCurrentTeam()` scope when finding servers - Handle cases where server IDs might be null --- app/Livewire/Project/Application/DeploymentNavbar.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Livewire/Project/Application/DeploymentNavbar.php b/app/Livewire/Project/Application/DeploymentNavbar.php index 87b40d4dc..66f387fcf 100644 --- a/app/Livewire/Project/Application/DeploymentNavbar.php +++ b/app/Livewire/Project/Application/DeploymentNavbar.php @@ -53,13 +53,13 @@ class DeploymentNavbar extends Component public function cancel() { $kill_command = "docker rm -f {$this->application_deployment_queue->deployment_uuid}"; - $build_server_id = $this->application_deployment_queue->build_server_id; + $build_server_id = $this->application_deployment_queue->build_server_id ?? $this->application->destination->server_id; $server_id = $this->application_deployment_queue->server_id ?? $this->application->destination->server_id; try { if ($this->application->settings->is_build_server_enabled) { - $server = Server::find($build_server_id); + $server = Server::ownedByCurrentTeam()->find($build_server_id); } else { - $server = Server::find($server_id); + $server = Server::ownedByCurrentTeam()->find($server_id); } if ($this->application_deployment_queue->logs) { $previous_logs = json_decode($this->application_deployment_queue->logs, associative: true, flags: JSON_THROW_ON_ERROR);