Skip to content

Commit 2fde14a

Browse files
committed
fix: don't trigger recursive SharesUpdatedListener when share is moved on create
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent e7e909c commit 2fde14a

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

apps/files_sharing/lib/Listener/SharesUpdatedListener.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class SharesUpdatedListener implements IEventListener {
4646
* The total amount of time we've spent so far processing updates
4747
*/
4848
private float $updatedTime = 0.0;
49+
private bool $inUpdate = false;
4950

5051
public function __construct(
5152
private readonly IManager $shareManager,
@@ -60,6 +61,11 @@ public function __construct(
6061
}
6162

6263
public function handle(Event $event): void {
64+
// prevent recursive updates
65+
if ($this->inUpdate) {
66+
return;
67+
}
68+
6369
// don't trigger the on-setup checks if this handler triggers an fs setup
6470
$oldState = $this->homeSetupListener->setDisabled(true);
6571

@@ -87,7 +93,9 @@ public function handle(Event $event): void {
8793
foreach ($this->shareManager->getUsersForShare($share) as $user) {
8894
if ($share->getSharedBy() !== $user->getUID()) {
8995
$this->markOrRun($user, function () use ($user, $share) {
96+
$this->inUpdate = true;
9097
$this->shareUpdater->updateForAddedShare($user, $share);
98+
$this->inUpdate = false;
9199
});
92100
// Share target validation might have changed the target, restore it for the next user
93101
$share->setTarget($shareTarget);

0 commit comments

Comments
 (0)