Add allowClose to payload
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
f0ad70f0e7
commit
ebe19168c2
2 changed files with 7 additions and 1 deletions
|
@ -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 {
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue