From c2b2d06e47798031e6f8ff2aae74cac36313a0b4 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 10 Jul 2024 10:29:19 +0200 Subject: [PATCH] fix: remove own app from domain checks --- bootstrap/helpers/shared.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index 5efc0f9ef..7aab313c2 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -2168,7 +2168,7 @@ function ip_match($ip, $cidrs, &$match = null) return false; } -function checkIfDomainIsAlreadyUsed(Collection|array $domains, ?string $teamId = null) +function checkIfDomainIsAlreadyUsed(Collection|array $domains, ?string $teamId, string $uuid) { if (is_null($teamId)) { return response()->json(['error' => 'Team ID is required.'], 400); @@ -2184,8 +2184,8 @@ function checkIfDomainIsAlreadyUsed(Collection|array $domains, ?string $teamId = return str($domain); }); - $applications = Application::ownedByCurrentTeamAPI($teamId)->get('fqdn'); - $serviceApplications = ServiceApplication::ownedByCurrentTeamAPI($teamId)->get('fqdn'); + $applications = Application::ownedByCurrentTeamAPI($teamId)->get(['fqdn', 'uuid'])->filter(fn ($app) => $app->uuid !== $uuid); + $serviceApplications = ServiceApplication::ownedByCurrentTeamAPI($teamId)->get(['fqdn', 'uuid'])->filter(fn ($app) => $app->uuid !== $uuid); $domainFound = false; foreach ($applications as $app) { if (is_null($app->fqdn)) {