From 524f530dcee72b7fe5c2859d9982a78a7df3d3f8 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 19 Jan 2023 19:20:42 +0000 Subject: [PATCH 1/2] Lowercase room alias before joining --- src/matrix-utils.ts | 6 ++++++ src/room/useLoadGroupCall.ts | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/matrix-utils.ts b/src/matrix-utils.ts index dc55702..03e3267 100644 --- a/src/matrix-utils.ts +++ b/src/matrix-utils.ts @@ -211,6 +211,12 @@ export function fullAliasFromRoomName( return `#${roomAliasLocalpartFromRoomName(roomName)}:${client.getDomain()}`; } +/** + * XXX What is this trying to do? It looks like it's getting the localpart from + * a room alias, but why is it splitting on hyphens and then putting spaces in?? + * @param roomId + * @returns + */ export function roomNameFromRoomId(roomId: string): string { return roomId .match(/([^:]+):.*$/)[1] diff --git a/src/room/useLoadGroupCall.ts b/src/room/useLoadGroupCall.ts index 363739a..d90e0bc 100644 --- a/src/room/useLoadGroupCall.ts +++ b/src/room/useLoadGroupCall.ts @@ -52,7 +52,11 @@ export const useLoadGroupCall = ( const fetchOrCreateRoom = async (): Promise => { try { - const room = await client.joinRoom(roomIdOrAlias, { viaServers }); + // We lowercase the localpart when we create the room, so we must lowercase + // it here too (we just do the whole alias). + const room = await client.joinRoom(roomIdOrAlias.toLowerCase(), { + viaServers, + }); logger.info( `Joined ${roomIdOrAlias}, waiting room to be ready for group calls` ); From 7e1033f5a424b5805d497e5e00211cdc90e7e408 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 20 Jan 2023 09:35:50 +0000 Subject: [PATCH 2/2] Add colon in comment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Šimon Brandner --- src/matrix-utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/matrix-utils.ts b/src/matrix-utils.ts index 03e3267..0a2ecfe 100644 --- a/src/matrix-utils.ts +++ b/src/matrix-utils.ts @@ -212,7 +212,7 @@ export function fullAliasFromRoomName( } /** - * XXX What is this trying to do? It looks like it's getting the localpart from + * XXX: What is this trying to do? It looks like it's getting the localpart from * a room alias, but why is it splitting on hyphens and then putting spaces in?? * @param roomId * @returns