From 7c53aff96ff4571d575b768eadaaefcb55c48ff8 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 17 Feb 2026 17:12:54 +0100 Subject: [PATCH] fix: disable share resolve postpone in tests Signed-off-by: Robin Appelman --- .../lib/Listener/SharesUpdatedListener.php | 12 ++++++++++-- apps/files_sharing/tests/TestCase.php | 4 ++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/apps/files_sharing/lib/Listener/SharesUpdatedListener.php b/apps/files_sharing/lib/Listener/SharesUpdatedListener.php index 5e9d26a53da..39f9e4e9289 100644 --- a/apps/files_sharing/lib/Listener/SharesUpdatedListener.php +++ b/apps/files_sharing/lib/Listener/SharesUpdatedListener.php @@ -68,7 +68,7 @@ class SharesUpdatedListener implements IEventListener { foreach ($this->shareManager->getUsersForShare($share) as $user) { if ($share->getSharedBy() !== $user->getUID()) { $this->updatedCount++; - if ($this->updatedCount <= $this->cutOffMarkAllSingleShare) { + if ($this->cutOffMarkAllSingleShare === -1 || $this->updatedCount <= $this->cutOffMarkAllSingleShare) { $this->shareUpdater->updateForShare($user, $share); // Share target validation might have changed the target, restore it for the next user $share->setTarget($shareTarget); @@ -87,7 +87,7 @@ class SharesUpdatedListener implements IEventListener { private function updateOrMarkUser(IUser $user, bool $verifyMountPoints, array $ignoreShares = []): void { $this->updatedCount++; - if ($this->updatedCount <= $this->cutOffMarkAllShares) { + if ($this->cutOffMarkAllShares === -1 || $this->updatedCount <= $this->cutOffMarkAllShares) { $this->shareUpdater->updateForUser($user, $verifyMountPoints, $ignoreShares); } else { $this->markUserForRefresh($user); @@ -97,4 +97,12 @@ class SharesUpdatedListener implements IEventListener { private function markUserForRefresh(IUser $user): void { $this->userConfig->setValueBool($user->getUID(), Application::APP_ID, ConfigLexicon::USER_NEEDS_SHARE_REFRESH, true); } + + public function setCutOffMarkAllSingleShare(int $cutOffMarkAllSingleShare): void { + $this->cutOffMarkAllSingleShare = $cutOffMarkAllSingleShare; + } + + public function setCutOffMarkAllShares(int $cutOffMarkAllShares): void { + $this->cutOffMarkAllShares = $cutOffMarkAllShares; + } } diff --git a/apps/files_sharing/tests/TestCase.php b/apps/files_sharing/tests/TestCase.php index 6b72ecb259c..9ed3bacc391 100644 --- a/apps/files_sharing/tests/TestCase.php +++ b/apps/files_sharing/tests/TestCase.php @@ -15,6 +15,7 @@ use OC\SystemConfig; use OC\User\DisplayNameCache; use OCA\Files_Sharing\AppInfo\Application; use OCA\Files_Sharing\External\MountProvider as ExternalMountProvider; +use OCA\Files_Sharing\Listener\SharesUpdatedListener; use OCA\Files_Sharing\MountProvider; use OCP\Files\Config\IMountProviderCollection; use OCP\Files\IRootFolder; @@ -99,6 +100,9 @@ abstract class TestCase extends \Test\TestCase { $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER4, 'group3'); $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER2, self::TEST_FILES_SHARING_API_GROUP1); Server::get(IGroupManager::class)->addBackend($groupBackend); + + Server::get(SharesUpdatedListener::class)->setCutOffMarkAllShares(-1); + Server::get(SharesUpdatedListener::class)->setCutOffMarkAllSingleShare(-1); } protected function setUp(): void {