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
parent
commit
b010a1fed9
No known key found for this signature in database GPG Key ID: 7076EA9751AACDDA
  1. 8
      lib/Model/AttendeeMapper.php
  2. 6
      lib/Service/ParticipantService.php

8
lib/Model/AttendeeMapper.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);

6
lib/Service/ParticipantService.php

@ -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();

Loading…
Cancel
Save