Add room not found view

This commit is contained in:
Robert Long
2022-02-14 13:53:19 -08:00
parent 3ed35f9477
commit 47357b3fc6
5 changed files with 119 additions and 1 deletions

View File

@@ -50,6 +50,31 @@ export function roomAliasFromRoomName(roomName) {
.toLowerCase();
}
export function roomNameFromRoomId(roomId) {
return roomId
.match(/([^:]+):.*$/)[1]
.substring(1)
.split("-")
.map((part) =>
part.length > 0 ? part.charAt(0).toUpperCase() + part.slice(1) : part
)
.join(" ");
}
export function isLocalRoomId(roomId) {
if (!roomId) {
return false;
}
const parts = roomId.match(/[^:]+:(.*)$/);
if (parts.length < 2) {
return false;
}
return parts[1] === defaultHomeserverHost;
}
export async function createRoom(client, name) {
const { room_id, room_alias } = await client.createRoom({
visibility: "private",