5151use OCA \Circles \Tools \Traits \TDeserialize ;
5252use OCA \Circles \Tools \Traits \TNCLogger ;
5353use OCA \Circles \Tools \Traits \TStringTools ;
54+ use OCA \Files_Sharing \Event \UserShareAccessUpdatedEvent ;
55+ use OCP \EventDispatcher \IEventDispatcher ;
5456use OCP \ICache ;
5557use OCP \ICacheFactory ;
5658use OCP \IL10N ;
@@ -124,6 +126,7 @@ public function __construct(
124126 MemberService $ memberService ,
125127 PermissionService $ permissionService ,
126128 ConfigService $ configService ,
129+ private readonly IEventDispatcher $ eventDispatcher ,
127130 ) {
128131 $ this ->l10n = $ l10n ;
129132 $ this ->hasher = $ hasher ;
@@ -422,14 +425,16 @@ public function updateDescription(string $circleId, string $description): array
422425 */
423426 public function circleJoin (string $ circleId ): array {
424427 $ this ->federatedUserService ->mustHaveCurrentUser ();
428+ /** @var FederatedUser $currentUser */
429+ $ currentUser = $ this ->federatedUserService ->getCurrentUser ();
425430
426431 $ probe = new CircleProbe ();
427432 $ probe ->includeNonVisibleCircles ()
428433 ->emulateVisitor ();
429434
430435 $ circle = $ this ->circleRequest ->getCircle (
431436 $ circleId ,
432- $ this -> federatedUserService -> getCurrentUser () ,
437+ $ currentUser ,
433438 $ probe
434439 );
435440
@@ -442,6 +447,8 @@ public function circleJoin(string $circleId): array {
442447
443448 $ this ->federatedEventService ->newEvent ($ event );
444449
450+ $ this ->eventDispatcher ->dispatchTyped (new UserShareAccessUpdatedEvent ($ this ->memberService ->collectShareAccessUpdateUsers ($ currentUser )));
451+
445452 return $ event ->getOutcome ();
446453 }
447454
@@ -465,14 +472,16 @@ public function circleJoin(string $circleId): array {
465472 */
466473 public function circleLeave (string $ circleId , bool $ force = false ): array {
467474 $ this ->federatedUserService ->mustHaveCurrentUser ();
475+ /** @var FederatedUser $currentUser */
476+ $ currentUser = $ this ->federatedUserService ->getCurrentUser ();
468477
469478 $ probe = new CircleProbe ();
470479 $ probe ->includeNonVisibleCircles ()
471480 ->emulateVisitor ();
472481
473482 $ circle = $ this ->circleRequest ->getCircle (
474483 $ circleId ,
475- $ this -> federatedUserService -> getCurrentUser () ,
484+ $ currentUser ,
476485 $ probe
477486 );
478487
@@ -482,10 +491,11 @@ public function circleLeave(string $circleId, bool $force = false): array {
482491
483492 $ this ->federatedEventService ->newEvent ($ event );
484493
494+ $ this ->eventDispatcher ->dispatchTyped (new UserShareAccessUpdatedEvent ($ this ->memberService ->collectShareAccessUpdateUsers ($ currentUser )));
495+
485496 return $ event ->getOutcome ();
486497 }
487498
488-
489499 /**
490500 * @param string $circleId
491501 * @param CircleProbe|null $probe
0 commit comments