Skip to content

Commit

Permalink
fix(breakoutrooms): Always order breakout rooms in the same order
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Mar 2, 2023
1 parent ead0997 commit 4210197
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -813,14 +813,18 @@ public function getRoomByObject(string $objectType, string $objectId): Room {
* @param string $objectId
* @return Room[]
*/
public function getMultipleRoomsByObject(string $objectType, string $objectId): array {
public function getMultipleRoomsByObject(string $objectType, string $objectId, bool $orderById = false): array {
$query = $this->db->getQueryBuilder();
$helper = new SelectHelper();
$helper->selectRoomsTable($query);
$query->from('talk_rooms', 'r')
->where($query->expr()->eq('r.object_type', $query->createNamedParameter($objectType)))
->andWhere($query->expr()->eq('r.object_id', $query->createNamedParameter($objectId)));

if ($orderById) {
$query->orderBy('id', 'ASC');
}

$result = $query->executeQuery();
$rooms = [];
while ($row = $result->fetch()) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/BreakoutRoomService.php
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ public function getBreakoutRooms(Room $parent, Participant $participant): array
throw new \InvalidArgumentException('status');
}

$breakoutRooms = $this->manager->getMultipleRoomsByObject(BreakoutRoom::PARENT_OBJECT_TYPE, $parent->getToken());
$breakoutRooms = $this->manager->getMultipleRoomsByObject(BreakoutRoom::PARENT_OBJECT_TYPE, $parent->getToken(), true);

$returnAll = $participant->hasModeratorPermissions() || $parent->getBreakoutRoomMode() === BreakoutRoom::MODE_FREE;
if (!$returnAll) {
Expand Down

0 comments on commit 4210197

Please sign in to comment.