fix: disable share resolve postpone in tests

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2026-02-17 17:12:54 +01:00 committed by Louis Chmn
parent 2b8f96ba48
commit 7c53aff96f
2 changed files with 14 additions and 2 deletions

View file

@ -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;
}
}

View file

@ -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 {