File tree Expand file tree Collapse file tree
apps/files_sharing/lib/Listener Expand file tree Collapse file tree Original file line number Diff line number Diff 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 );
You can’t perform that action at this time.
0 commit comments