mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
fix: don't trigger recursive SharesUpdatedListener when share is moved on create
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
a77f8ca38c
commit
b66abe553c
1 changed files with 8 additions and 0 deletions
|
|
@ -46,6 +46,7 @@ class SharesUpdatedListener implements IEventListener {
|
|||
* The total amount of time we've spent so far processing updates
|
||||
*/
|
||||
private float $updatedTime = 0.0;
|
||||
private bool $inUpdate = false;
|
||||
|
||||
public function __construct(
|
||||
private readonly IManager $shareManager,
|
||||
|
|
@ -60,6 +61,11 @@ class SharesUpdatedListener implements IEventListener {
|
|||
}
|
||||
|
||||
public function handle(Event $event): void {
|
||||
// prevent recursive updates
|
||||
if ($this->inUpdate) {
|
||||
return;
|
||||
}
|
||||
|
||||
// don't trigger the on-setup checks if this handler triggers an fs setup
|
||||
$oldState = $this->homeSetupListener->setDisabled(true);
|
||||
|
||||
|
|
@ -87,7 +93,9 @@ class SharesUpdatedListener implements IEventListener {
|
|||
foreach ($this->shareManager->getUsersForShare($share) as $user) {
|
||||
if ($share->getSharedBy() !== $user->getUID()) {
|
||||
$this->markOrRun($user, function () use ($user, $share) {
|
||||
$this->inUpdate = true;
|
||||
$this->shareUpdater->updateForAddedShare($user, $share);
|
||||
$this->inUpdate = false;
|
||||
});
|
||||
// Share target validation might have changed the target, restore it for the next user
|
||||
$share->setTarget($shareTarget);
|
||||
|
|
|
|||
Loading…
Reference in a new issue