1
0
Fork 0
forked from mirror/cinny

fix tombstone replacement room open previous room (#1856)

This commit is contained in:
Ajay Bura 2024-07-30 17:49:51 +05:30 committed by GitHub
parent 5058136737
commit e54bb2e423
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);