diff --git a/src/components/views/right_panel/UserInfo.tsx b/src/components/views/right_panel/UserInfo.tsx index 70c22859e2..a4b5cd0fbb 100644 --- a/src/components/views/right_panel/UserInfo.tsx +++ b/src/components/views/right_panel/UserInfo.tsx @@ -60,6 +60,7 @@ import QuestionDialog from "../dialogs/QuestionDialog"; import ConfirmUserActionDialog from "../dialogs/ConfirmUserActionDialog"; import InfoDialog from "../dialogs/InfoDialog"; import { EventType } from "matrix-js-sdk/src/@types/event"; +import {SetRightPanelPhasePayload} from "../../../dispatcher/payloads/SetRightPanelPhasePayload"; interface IDevice { deviceId: string; @@ -1534,6 +1535,24 @@ const UserInfo: React.FC = ({ const classes = ["mx_UserInfo"]; + let refireParams; + let previousPhase: RightPanelPhases; + // We have no previousPhase for when viewing a UserInfo from a Group or without a Room at this time + if (room && phase === RightPanelPhases.EncryptionPanel) { + previousPhase = RightPanelPhases.RoomMemberInfo; + refireParams = {member: member}; + } else if (room) { + previousPhase = RightPanelPhases.RoomMemberList; + } + + const onEncryptionPanelClose = () => { + dis.dispatch({ + action: Action.SetRightPanelPhase, + phase: previousPhase, + refireParams: refireParams, + }); + } + let content; switch (phase) { case RightPanelPhases.RoomMemberInfo: @@ -1553,23 +1572,13 @@ const UserInfo: React.FC = ({ } member={member} - onClose={onClose} + onClose={onEncryptionPanelClose} isRoomEncrypted={isRoomEncrypted} /> ); break; } - let refireParams; - let previousPhase: RightPanelPhases; - // We have no previousPhase for when viewing a UserInfo from a Group or without a Room at this time - if (room && phase === RightPanelPhases.EncryptionPanel) { - previousPhase = RightPanelPhases.RoomMemberInfo; - refireParams = {member: member}; - } else if (room) { - previousPhase = RightPanelPhases.RoomMemberList; - } - let closeLabel = undefined; if (phase === RightPanelPhases.EncryptionPanel) { const verificationRequest = (props as React.ComponentProps).verificationRequest;