From b93cadf4d1189b83aac804bd55714c886e9c469f Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 10 Dec 2019 09:58:44 -0700 Subject: [PATCH] Reset the right panel when changing rooms/groups This is to prevent the member info from staying open, which could explode if the user isn't in the room you're switching to. --- src/stores/RightPanelStore.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/stores/RightPanelStore.js b/src/stores/RightPanelStore.js index 4542902ae8..37e7498141 100644 --- a/src/stores/RightPanelStore.js +++ b/src/stores/RightPanelStore.js @@ -121,6 +121,19 @@ export default class RightPanelStore extends Store { return; } + if (payload.action === 'view_room' || payload.action === 'view_group') { + // Reset to the member list if we're viewing member info + const memberInfoPhases = [RIGHT_PANEL_PHASES.RoomMemberInfo, RIGHT_PANEL_PHASES.Room3pidMemberInfo]; + if (memberInfoPhases.includes(this._state.lastRoomPhase)) { + this._setState({lastRoomPhase: RIGHT_PANEL_PHASES.RoomMemberList, lastRoomPhaseParams: {}}); + } + + // Do the same for groups + if (this._state.lastGroupPhase === RIGHT_PANEL_PHASES.GroupMemberInfo) { + this._setState({lastGroupPhase: RIGHT_PANEL_PHASES.GroupMemberList}); + } + } + if (payload.action !== 'set_right_panel_phase' || this._inhibitUpdates) return; const targetPhase = payload.phase;