From e54bb2e42377c49e7179f6b59669592186281eff Mon Sep 17 00:00:00 2001 From: Ajay Bura <32841439+ajbura@users.noreply.github.com> Date: Tue, 30 Jul 2024 17:49:51 +0530 Subject: [PATCH] fix tombstone replacement room open previous room (#1856) --- src/app/utils/matrix.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/utils/matrix.ts b/src/app/utils/matrix.ts index f837ed4..8613f36 100644 --- a/src/app/utils/matrix.ts +++ b/src/app/utils/matrix.ts @@ -33,7 +33,13 @@ export const isRoomId = (id: string): boolean => validMxId(id) && id.startsWith( export const isRoomAlias = (id: string): boolean => validMxId(id) && id.startsWith('#'); export const getCanonicalAliasRoomId = (mx: MatrixClient, alias: string): string | undefined => - mx.getRooms()?.find((room) => room.getCanonicalAlias() === alias)?.roomId; + mx + .getRooms() + ?.find( + (room) => + room.getCanonicalAlias() === alias && + getStateEvent(room, StateEvent.RoomTombstone) === undefined + )?.roomId; export const getCanonicalAliasOrRoomId = (mx: MatrixClient, roomId: string): string => { const room = mx.getRoom(roomId);