Skip to content

Commit

Permalink
fix(teams): Filter out already added teams from invite suggestions
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Feb 11, 2025
1 parent ea087b7 commit 9d57bde
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/Collaboration/Collaborators/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
}
}

0 comments on commit 9d57bde

Please sign in to comment.