summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-01-04 12:09:24 +0100
committerJoas Schilling <coding@schilljs.com>2023-01-05 07:07:30 +0100
commitce16342600b28bb5c1e5ace66dfa60bf11ce8d78 (patch)
treec98bfd857accbc8dee1917531bd91293c71ff53b /lib
parentc11d5ae46495f9ca9680cc12e35d7b012e0d019e (diff)
Create the Room object from available data
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Manager.php57
1 files changed, 54 insertions, 3 deletions
diff --git a/lib/Manager.php b/lib/Manager.php
index dfd0b630e..6f68ab02d 100644
--- a/lib/Manager.php
+++ b/lib/Manager.php
@@ -126,6 +126,44 @@ class Manager {
}
/**
+ * @param array $data
+ * @return Room
+ */
+ public function createRoomObjectFromData(array $data): Room {
+ return $this->createRoomObject(array_merge([
+ 'r_id' => 0,
+ 'type' => 0,
+ 'read_only' => 0,
+ 'listable' => 0,
+ 'message_expiration' => 0,
+ 'lobby_state' => 0,
+ 'sip_enabled' => 0,
+ 'assigned_hpb' => null,
+ 'token' => '',
+ 'name' => '',
+ 'description' => '',
+ 'password' => '',
+ 'avatar' => '',
+ 'remote_server' => '',
+ 'remote_token' => '',
+ 'active_guests' => 0,
+ 'default_permissions' => 0,
+ 'call_permissions' => 0,
+ 'call_flag' => 0,
+ 'active_since' => null,
+ 'last_activity' => null,
+ 'last_message' => 0,
+ 'comment_id' => null,
+ 'lobby_timer' => null,
+ 'object_type' => '',
+ 'object_id' => '',
+ 'breakout_room_mode' => 0,
+ 'breakout_room_status' => 0,
+ 'call_recording' => 0,
+ ], $data));
+ }
+
+ /**
* @param array $row
* @return Room
*/
@@ -956,8 +994,14 @@ class Manager {
$insert->executeStatement();
$roomId = $insert->getLastInsertId();
-
- $room = $this->getRoomById($roomId);
+ $room = $this->createRoomObjectFromData([
+ 'r_id' => $roomId,
+ 'name' => $name,
+ 'type' => $type,
+ 'token' => $token,
+ 'object_type' => $objectType,
+ 'object_id' => $objectId,
+ ]);
$event = new RoomEvent($room);
$this->dispatcher->dispatch(Room::EVENT_AFTER_ROOM_CREATE, $event);
@@ -988,7 +1032,14 @@ class Manager {
$qb->executeStatement();
$roomId = $qb->getLastInsertId();
- return $this->getRoomById($roomId);
+ return $this->createRoomObjectFromData([
+ 'r_id' => $roomId,
+ 'name' => $name,
+ 'type' => $type,
+ 'token' => $token,
+ 'remote_token' => $remoteToken,
+ 'remote_server' => $remoteServer,
+ ]);
}
public function resolveRoomDisplayName(Room $room, string $userId): string {