Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Reduce complexity for autocomplete suggestions
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Feb 24, 2021
commit 6b6ccabd99e54a67d0ab698f78e7848398d06d38
13 changes: 3 additions & 10 deletions lib/Command/Room/TRoomCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -406,15 +406,8 @@ protected function completeParticipantValues(CompletionContext $context): array
return [];
}

$users = [];
$participants = $this->participantService->getParticipantsForRoom($room);
foreach ($participants as $participant) {
if ($participant->getAttendee()->getActorType() === Attendee::ACTOR_USERS
&& stripos($participant->getAttendee()->getActorId(), $context->getCurrentWord()) !== false) {
$users[] = $participant->getAttendee()->getActorId();
}
}

return $users;
return array_filter($this->participantService->getParticipantUserIds($room), static function ($userId) use ($context) {
return stripos($userId, $context->getCurrentWord()) !== false;
});
}
}