Browse Source
last_joined_call is not a timestamp not a date field
Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/4324/head
Joas Schilling
5 years ago
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
2 changed files with
9 additions and
5 deletions
-
lib/Model/AttendeeMapper.php
-
lib/Service/ParticipantService.php
|
|
|
@ -60,18 +60,18 @@ class AttendeeMapper extends QBMapper { |
|
|
|
/** |
|
|
|
* @param int $roomId |
|
|
|
* @param string $actorType |
|
|
|
* @param \DateTime|null $lastJoinedCall |
|
|
|
* @param int|null $lastJoinedCall |
|
|
|
* @return Attendee[] |
|
|
|
*/ |
|
|
|
public function getActorsByType(int $roomId, string $actorType, ?\DateTime $lastJoinedCall = null): array { |
|
|
|
public function getActorsByType(int $roomId, string $actorType, ?int $lastJoinedCall = null): array { |
|
|
|
$query = $this->db->getQueryBuilder(); |
|
|
|
$query->select('*') |
|
|
|
->from($this->getTableName()) |
|
|
|
->where($query->expr()->eq('room_id', $query->createNamedParameter($roomId, IQueryBuilder::PARAM_INT))) |
|
|
|
->andWhere($query->expr()->eq('actor_type', $query->createNamedParameter($actorType))); |
|
|
|
|
|
|
|
if ($lastJoinedCall instanceof \DateTimeInterface) { |
|
|
|
$query->andWhere($query->expr()->gte('last_joined_call', $query->createNamedParameter($lastJoinedCall, IQueryBuilder::PARAM_DATE))); |
|
|
|
if ($lastJoinedCall !== null) { |
|
|
|
$query->andWhere($query->expr()->gte('last_joined_call', $query->createNamedParameter($lastJoinedCall, IQueryBuilder::PARAM_INT))); |
|
|
|
} |
|
|
|
|
|
|
|
return $this->findEntities($query); |
|
|
|
|
|
|
|
@ -516,7 +516,11 @@ class ParticipantService { |
|
|
|
* @return string[] |
|
|
|
*/ |
|
|
|
public function getParticipantUserIds(Room $room, \DateTime $maxLastJoined = null): array { |
|
|
|
$attendees = $this->attendeeMapper->getActorsByType($room->getId(), 'users', $maxLastJoined); |
|
|
|
$maxLastJoinedTimestamp = null; |
|
|
|
if ($maxLastJoined !== null) { |
|
|
|
$maxLastJoinedTimestamp = $maxLastJoined->getTimestamp(); |
|
|
|
} |
|
|
|
$attendees = $this->attendeeMapper->getActorsByType($room->getId(), 'users', $maxLastJoinedTimestamp); |
|
|
|
|
|
|
|
return array_map(static function (Attendee $attendee) { |
|
|
|
return $attendee->getActorId(); |
|
|
|
|