From c9ce7e60cfd565503b9734dd29f11b22f4b3aa6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Fri, 9 Jun 2023 14:36:33 +0200 Subject: [PATCH] fix vcsRepos deletion --- app/console | 2 +- app/controllers/api/functions.php | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/console b/app/console index 42938250c6..265fb01f80 160000 --- a/app/console +++ b/app/console @@ -1 +1 @@ -Subproject commit 42938250c6ee923d88d6f5b3c04484712a5a176f +Subproject commit 265fb01f80a9233c11e5cdaa0b85974a285cc8cf diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index f6e0fd5649..0b3b1b5d63 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -568,7 +568,16 @@ App::put('/v1/functions/:functionId') // Git disconnect logic if ($isConnected && empty($vcsRepositoryId)) { - $dbForConsole->deleteDocument('vcsRepos', $function->getAttribute('vcsRepositoryId', '')); + $repoDocs = $dbForConsole->find('vcsRepos', [ + Query::equal('projectId', [$project->getId()]), + Query::equal('resourceId', [$functionId]), + Query::equal('resourceType', ['function']), + Query::limit(100), + ]); + + foreach ($repoDocs as $repoDoc) { + $dbForConsole->deleteDocument('vcsRepos', $repoDoc->getId()); + } $vcsRepositoryId = ''; $vcsInstallationId = '';