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

Commit

Permalink
Fix automatic space switching wrongly going via Home for room aliases (
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy authored Dec 1, 2021
1 parent 2e82887 commit 757d473
Showing 1 changed file with 8 additions and 1 deletion.
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

0 comments on commit 757d473

Please sign in to comment.