fix: don't trigger recursive SharesUpdatedListener when share is moved on validate

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2026-04-17 14:56:49 +02:00
parent a05a3b9005
commit f42bfebcc0
No known key found for this signature in database
GPG key ID: 42B69D8A64526EFB
2 changed files with 12 additions and 4 deletions

View file

@ -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();

View file

@ -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
*/