Add allowClose to payload

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-06-24 10:39:45 +02:00
parent f0ad70f0e7
commit ebe19168c2
No known key found for this signature in database
GPG key ID: 9760693FDD98A790
2 changed files with 7 additions and 1 deletions

View file

@ -27,6 +27,11 @@ export interface SetRightPanelPhasePayload extends ActionPayload {
phase: RightPanelPhases; phase: RightPanelPhases;
refireParams?: SetRightPanelPhaseRefireParams; refireParams?: SetRightPanelPhaseRefireParams;
/**
* By default SetRightPanelPhase can close the panel, this allows overriding that behaviour
*/
allowClose?: boolean;
} }
export interface SetRightPanelPhaseRefireParams { export interface SetRightPanelPhaseRefireParams {

View file

@ -161,6 +161,7 @@ export default class RightPanelStore extends Store<ActionPayload> {
case Action.SetRightPanelPhase: { case Action.SetRightPanelPhase: {
let targetPhase = payload.phase; let targetPhase = payload.phase;
let refireParams = payload.refireParams; let refireParams = payload.refireParams;
const allowClose = payload.allowClose ?? true;
// redirect to EncryptionPanel if there is an ongoing verification request // redirect to EncryptionPanel if there is an ongoing verification request
if (targetPhase === RightPanelPhases.RoomMemberInfo && payload.refireParams) { if (targetPhase === RightPanelPhases.RoomMemberInfo && payload.refireParams) {
const {member} = payload.refireParams; const {member} = payload.refireParams;
@ -192,7 +193,7 @@ export default class RightPanelStore extends Store<ActionPayload> {
}); });
} }
} else { } else {
if (targetPhase === this.state.lastRoomPhase && !refireParams) { if (targetPhase === this.state.lastRoomPhase && !refireParams && allowClose) {
this.setState({ this.setState({
showRoomPanel: !this.state.showRoomPanel, showRoomPanel: !this.state.showRoomPanel,
previousPhase: null, previousPhase: null,