mirror of
https://github.com/nextcloud/server.git
synced 2026-05-22 01:55:56 -04:00
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:
parent
a05a3b9005
commit
f42bfebcc0
2 changed files with 12 additions and 4 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue