mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
fix creating the rooms segment
This commit is contained in:
parent
a360d0a2b9
commit
7b13e45e19
@ -42,19 +42,21 @@ function allowsChild(parent, child) {
|
||||
}
|
||||
|
||||
function roomsSegmentWithRoom(rooms, roomId, path) {
|
||||
const room = path.get("room");
|
||||
let index = 0;
|
||||
if (room) {
|
||||
index = rooms.value.indexOf(room.value);
|
||||
} else {
|
||||
if(!rooms.value.includes(roomId)) {
|
||||
const emptyGridTile = path.get("empty-grid-tile");
|
||||
const oldRoom = path.get("room");
|
||||
let index = 0;
|
||||
if (emptyGridTile) {
|
||||
index = emptyGridTile.value;
|
||||
} else if (oldRoom) {
|
||||
index = rooms.value.indexOf(oldRoom.value);
|
||||
}
|
||||
const roomIds = rooms.value.slice();
|
||||
roomIds[index] = roomId;
|
||||
return new Segment("rooms", roomIds);
|
||||
} else {
|
||||
return rooms;
|
||||
}
|
||||
const newRooms = rooms.value.slice();
|
||||
newRooms[index] = roomId;
|
||||
return new Segment("rooms", newRooms);
|
||||
}
|
||||
|
||||
export function parseUrlPath(urlPath, currentNavPath) {
|
||||
|
Loading…
Reference in New Issue
Block a user