From 317f7515bb971bfd8dd4b3b3aab54de07774f760 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Wed, 24 Jun 2026 17:39:51 +0530 Subject: [PATCH] fix: wrap outer installations lookup in authorization skip --- .../Platform/Modules/VCS/Http/GitHub/Events/Create.php | 2 +- tests/unit/Vcs/GitHubInstallationEventTest.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php index 789c01ef47..725779a969 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php @@ -113,7 +113,7 @@ class Create extends Action if ($installationCursor !== null) { $installationQueries[] = Query::cursorAfter($installationCursor); } - $installations = $dbForPlatform->find('installations', $installationQueries); + $installations = $authorization->skip(fn () => $dbForPlatform->find('installations', $installationQueries)); foreach ($installations as $installation) { $projectId = $installation->getAttribute('projectId', ''); diff --git a/tests/unit/Vcs/GitHubInstallationEventTest.php b/tests/unit/Vcs/GitHubInstallationEventTest.php index 46582ffd61..045ac5d9d6 100644 --- a/tests/unit/Vcs/GitHubInstallationEventTest.php +++ b/tests/unit/Vcs/GitHubInstallationEventTest.php @@ -95,9 +95,9 @@ final class GitHubInstallationEventTest extends TestCase return true; })); - // 1: getDocument(projects), 2: find(functions), 3: updateDocument(func1), - // 4: find(sites), 5: find(repositories), 6: deleteDocument(installations) - $authorization->expects($this->exactly(6)) + // 1: find(installations), 2: getDocument(projects), 3: find(functions), 4: updateDocument(func1), + // 5: find(sites), 6: find(repositories), 7: deleteDocument(installations) + $authorization->expects($this->exactly(7)) ->method('skip') ->willReturnCallback(fn (callable $fn): mixed => $fn()); @@ -138,8 +138,8 @@ final class GitHubInstallationEventTest extends TestCase ->with('projects', 'project1') ->willReturn(new Document()); - // 1: getDocument(projects), 2: find(repositories), 3: deleteDocument(installations) - $authorization->expects($this->exactly(3)) + // 1: find(installations), 2: getDocument(projects), 3: find(repositories), 4: deleteDocument(installations) + $authorization->expects($this->exactly(4)) ->method('skip') ->willReturnCallback(fn (callable $fn): mixed => $fn());