diff --git a/apps/files_sharing/lib/Listener/SharesUpdatedListener.php b/apps/files_sharing/lib/Listener/SharesUpdatedListener.php index aba49b74ad3..d80d76f644e 100644 --- a/apps/files_sharing/lib/Listener/SharesUpdatedListener.php +++ b/apps/files_sharing/lib/Listener/SharesUpdatedListener.php @@ -98,9 +98,13 @@ class SharesUpdatedListener implements IEventListener { if ($event instanceof ShareMovedEvent) { $share = $event->getShare(); $user = $event->getUser(); - $this->markOrRun($user, function () use ($user, $share) { - $this->shareUpdater->updateForMovedShare($user, $share); - }); + + // don't trigger if the share is moved as part of the conflict resolution + if (!$this->shareUpdater->isInUpdate($user)) { + $this->markOrRun($user, function () use ($user, $share) { + $this->shareUpdater->updateForMovedShare($user, $share); + }); + } } if ($event instanceof BeforeShareDeletedEvent) { $share = $event->getShare(); diff --git a/apps/files_sharing/lib/ShareRecipientUpdater.php b/apps/files_sharing/lib/ShareRecipientUpdater.php index cdb7a7c1b75..fe1e74c770b 100644 --- a/apps/files_sharing/lib/ShareRecipientUpdater.php +++ b/apps/files_sharing/lib/ShareRecipientUpdater.php @@ -30,7 +30,7 @@ class ShareRecipientUpdater { */ public function updateForUser(IUser $user): void { // prevent recursion - if (isset($this->inUpdate[$user->getUID()])) { + if ($this->isInUpdate($user)) { return; } $this->inUpdate[$user->getUID()] = true; @@ -63,6 +63,10 @@ class ShareRecipientUpdater { unset($this->inUpdate[$user->getUID()]); } + public function isInUpdate(IUser $user): bool { + return isset($this->inUpdate[$user->getUID()]); + } + /** * Validate a single received share for a user */