Skip to content

Commit

Permalink
refactor: Extract generalized getter with parameter
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
  • Loading branch information
danxuliu committed Jul 22, 2024
1 parent 1e67e29 commit d74fab2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/Service/ParticipantService.php
Original file line number Diff line number Diff line change
Expand Up @@ -1619,11 +1619,18 @@ protected function getParticipantFromQuery(IQueryBuilder $query, Room $room): Pa
* @return string[]
*/
public function getParticipantUserIds(Room $room, ?\DateTime $maxLastJoined = null): array {
return $this->getParticipantActorIdsByActorType($room, Attendee::ACTOR_USERS, $maxLastJoined);
}

/**
* @return string[]
*/
public function getParticipantActorIdsByActorType(Room $room, string $actorType, ?\DateTime $maxLastJoined = null): array {
$maxLastJoinedTimestamp = null;
if ($maxLastJoined !== null) {
$maxLastJoinedTimestamp = $maxLastJoined->getTimestamp();
}
$attendees = $this->attendeeMapper->getActorsByType($room->getId(), Attendee::ACTOR_USERS, $maxLastJoinedTimestamp);
$attendees = $this->attendeeMapper->getActorsByType($room->getId(), $actorType, $maxLastJoinedTimestamp);

return array_map(static function (Attendee $attendee) {
return $attendee->getActorId();
Expand Down

0 comments on commit d74fab2

Please sign in to comment.