diff --git a/lib/Controller/BreakoutRoomController.php b/lib/Controller/BreakoutRoomController.php index fef7a67323e..d35f5143b23 100644 --- a/lib/Controller/BreakoutRoomController.php +++ b/lib/Controller/BreakoutRoomController.php @@ -207,7 +207,10 @@ protected function formatMultipleRooms(array $rooms): array { $this->getResponseFormat(), [], $room, - $this->participantService->getParticipant($room, $this->userId) + $this->participantService->getParticipant($room, $this->userId), + [], + false, + true ); } catch (ParticipantNotFoundException $e) { } diff --git a/lib/Manager.php b/lib/Manager.php index 83d406557a0..235028b4772 100644 --- a/lib/Manager.php +++ b/lib/Manager.php @@ -813,7 +813,7 @@ 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); @@ -821,6 +821,10 @@ public function getMultipleRoomsByObject(string $objectType, string $objectId): ->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()) { @@ -1044,18 +1048,23 @@ public function createRemoteRoom(int $type, string $name, string $remoteToken, s ]); } - public function resolveRoomDisplayName(Room $room, string $userId): string { + public function resolveRoomDisplayName(Room $room, string $userId, bool $forceName = false): string { if ($room->getObjectType() === 'share:password') { return $this->l->t('Password request: %s', [$room->getName()]); } + if ($room->getType() === Room::TYPE_CHANGELOG) { return $this->l->t('Talk updates ✅'); } + + if ($forceName) { + return $room->getName(); + } + if ($userId === '' && $room->getType() !== Room::TYPE_PUBLIC) { return $this->l->t('Private conversation'); } - if ($room->getType() !== Room::TYPE_ONE_TO_ONE && $room->getName() === '') { /** @var RoomService $roomService */ $roomService = Server::get(RoomService::class); diff --git a/lib/Room.php b/lib/Room.php index bc65df6fbc9..aeaa74989ef 100644 --- a/lib/Room.php +++ b/lib/Room.php @@ -413,8 +413,8 @@ public function getSecondParticipant(string $userId): string { return $this->getName(); } - public function getDisplayName(string $userId): string { - return $this->manager->resolveRoomDisplayName($this, $userId); + public function getDisplayName(string $userId, bool $forceName = false): string { + return $this->manager->resolveRoomDisplayName($this, $userId, $forceName); } public function getDescription(): string { diff --git a/lib/Service/BreakoutRoomService.php b/lib/Service/BreakoutRoomService.php index e2180124ae4..47b3ffc5b76 100644 --- a/lib/Service/BreakoutRoomService.php +++ b/lib/Service/BreakoutRoomService.php @@ -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) { diff --git a/lib/Service/RoomFormatter.php b/lib/Service/RoomFormatter.php index 7f0f56009bb..104473a5dca 100644 --- a/lib/Service/RoomFormatter.php +++ b/lib/Service/RoomFormatter.php @@ -160,7 +160,7 @@ public function formatRoomV4( ) { return array_merge($roomData, [ 'name' => $room->getName(), - 'displayName' => $room->getDisplayName($isSIPBridgeRequest || $this->userId === null ? '' : $this->userId), + 'displayName' => $room->getDisplayName($isListingBreakoutRooms || $isSIPBridgeRequest || $this->userId === null ? '' : $this->userId, $isListingBreakoutRooms || $isSIPBridgeRequest), 'objectType' => $room->getObjectType(), 'objectId' => $room->getObjectId(), 'readOnly' => $room->getReadOnly(),