From a61f4c1811c266afacd18434cc628ffb1f986f82 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 24 Mar 2021 19:58:35 +0000 Subject: [PATCH] Auto-select space if joined whilst being viewed --- src/stores/SpaceStore.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/stores/SpaceStore.tsx b/src/stores/SpaceStore.tsx index e4b537169e..bcf95a82be 100644 --- a/src/stores/SpaceStore.tsx +++ b/src/stores/SpaceStore.tsx @@ -34,6 +34,7 @@ import {setHasDiff} from "../utils/sets"; import {objectDiff} from "../utils/objects"; import {arrayHasDiff} from "../utils/arrays"; import {ISpaceSummaryEvent, ISpaceSummaryRoom} from "../components/structures/SpaceRoomDirectory"; +import RoomViewStore from "./RoomViewStore"; type SpaceKey = string | symbol; @@ -368,6 +369,11 @@ export class SpaceStoreClass extends AsyncStoreWithClient { this.onRoomsUpdate(); } + // if the user was looking at the room and then joined select that space + if (room.getMyMembership() === "join" && room.roomId === RoomViewStore.getRoomId()) { + this.setActiveSpace(room); + } + const numSuggestedRooms = this._suggestedRooms.length; this._suggestedRooms = this._suggestedRooms.filter(r => r.room_id !== room.roomId); if (numSuggestedRooms !== this._suggestedRooms.length) {