Skip to content

Commit

Permalink
fix tombstone replacement room open previous room (#1856)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajbura authored Jul 30, 2024
1 parent 5058136 commit e54bb2e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/app/utils/matrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e54bb2e

Please sign in to comment.