mirror of
https://github.com/nextcloud/spreed.git
synced 2025-12-18 05:20:50 +01:00
Make the method loop over the sessions instead of the attendees
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
62aae8ad96
commit
9cc02f5b70
2 changed files with 9 additions and 4 deletions
|
|
@ -603,22 +603,27 @@ class ParticipantService {
|
|||
|
||||
/**
|
||||
* @param Room $room
|
||||
* @param int $maxAge
|
||||
* @return Participant[]
|
||||
*/
|
||||
public function getParticipantsWithSession(Room $room): array {
|
||||
public function getParticipantsForAllSessions(Room $room, int $maxAge = 0): array {
|
||||
$query = $this->connection->getQueryBuilder();
|
||||
|
||||
$helper = new SelectHelper();
|
||||
$helper->selectAttendeesTable($query);
|
||||
$helper->selectSessionsTable($query);
|
||||
$query->from('talk_attendees', 'a')
|
||||
$query->from('talk_sessions', 's')
|
||||
->leftJoin(
|
||||
'a', 'talk_sessions', 's',
|
||||
's', 'talk_attendees', 'a',
|
||||
$query->expr()->eq('s.attendee_id', 'a.id')
|
||||
)
|
||||
->where($query->expr()->eq('a.room_id', $query->createNamedParameter($room->getId(), IQueryBuilder::PARAM_INT)))
|
||||
->andWhere($query->expr()->isNotNull('s.id'));
|
||||
|
||||
if ($maxAge > 0) {
|
||||
$query->andWhere($query->expr()->gt('s.last_ping', $query->createNamedParameter($maxAge, IQueryBuilder::PARAM_INT)));
|
||||
}
|
||||
|
||||
return $this->getParticipantsFromQuery($query, $room);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ class Messages {
|
|||
]
|
||||
);
|
||||
|
||||
$participants = $this->participantService->getParticipantsWithSession($room);
|
||||
$participants = $this->participantService->getParticipantsForAllSessions($room);
|
||||
foreach ($participants as $participant) {
|
||||
$session = $participant->getSession();
|
||||
if ($session instanceof Session) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue