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

Commit

Permalink
Reset the right panel when changing rooms/groups
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
turt2live committed Dec 10, 2019
1 parent 405b3f6 commit b93cadf
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/stores/RightPanelStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b93cadf

Please sign in to comment.