Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Fix automatic space switching wrongly going via Home for room aliases #7247

Merged
merged 1 commit into from
Dec 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix automatic space switching wrongly going via Home for room aliases
  • Loading branch information
t3chguy committed Dec 1, 2021
commit 05703694672f5fdbfd82ffea34ccce8e684db51b
9 changes: 8 additions & 1 deletion src/stores/spaces/SpaceStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import {
UPDATE_SUGGESTED_ROOMS,
UPDATE_TOP_LEVEL_SPACES,
} from ".";
import { getCachedRoomIDForAlias } from "../../RoomAliasCache";

interface IState {}

Expand Down Expand Up @@ -834,8 +835,14 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
// Don't auto-switch rooms when reacting to a context-switch
// as this is not helpful and can create loops of rooms/space switching
if (payload.context_switch) break;
let roomId = payload.room_id;

if (payload.room_alias && !roomId) {
roomId = getCachedRoomIDForAlias(payload.room_alias);
}

if (!roomId) return; // we'll get re-fired with the room ID shortly

const roomId = payload.room_id;
const room = this.matrixClient?.getRoom(roomId);
if (room?.isSpaceRoom()) {
// Don't context switch when navigating to the space room
Expand Down