diff --git a/lib/Collaboration/Collaborators/Listener.php b/lib/Collaboration/Collaborators/Listener.php index eee8d9cf5c7..ec435564f5e 100644 --- a/lib/Collaboration/Collaborators/Listener.php +++ b/lib/Collaboration/Collaborators/Listener.php @@ -134,6 +134,13 @@ protected function filterExistingParticipants(string $token, array $results): ar $results['exact']['users'] = array_filter($results['exact']['users'], [$this, 'filterParticipantUserResult']); } + if (!empty($results['circles'])) { + $results['circles'] = array_filter($results['circles'], [$this, 'filterParticipantTeamResult']); + } + if (!empty($results['exact']['circles'])) { + $results['exact']['circles'] = array_filter($results['exact']['circles'], [$this, 'filterParticipantTeamResult']); + } + return $results; } @@ -166,4 +173,15 @@ protected function filterParticipantGroupResult(array $result): bool { return true; } } + + protected function filterParticipantTeamResult(array $result): bool { + $circleId = $result['value']['shareWith']; + + try { + $this->participantService->getParticipantByActor($this->room, Attendee::ACTOR_CIRCLES, $circleId); + return false; + } catch (ParticipantNotFoundException $e) { + return true; + } + } }