Properly handle closing encryption panel
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
73ab074219
commit
8a50b7bcbb
1 changed files with 20 additions and 11 deletions
|
@ -60,6 +60,7 @@ import QuestionDialog from "../dialogs/QuestionDialog";
|
||||||
import ConfirmUserActionDialog from "../dialogs/ConfirmUserActionDialog";
|
import ConfirmUserActionDialog from "../dialogs/ConfirmUserActionDialog";
|
||||||
import InfoDialog from "../dialogs/InfoDialog";
|
import InfoDialog from "../dialogs/InfoDialog";
|
||||||
import { EventType } from "matrix-js-sdk/src/@types/event";
|
import { EventType } from "matrix-js-sdk/src/@types/event";
|
||||||
|
import {SetRightPanelPhasePayload} from "../../../dispatcher/payloads/SetRightPanelPhasePayload";
|
||||||
|
|
||||||
interface IDevice {
|
interface IDevice {
|
||||||
deviceId: string;
|
deviceId: string;
|
||||||
|
@ -1534,6 +1535,24 @@ const UserInfo: React.FC<Props> = ({
|
||||||
|
|
||||||
const classes = ["mx_UserInfo"];
|
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<SetRightPanelPhasePayload>({
|
||||||
|
action: Action.SetRightPanelPhase,
|
||||||
|
phase: previousPhase,
|
||||||
|
refireParams: refireParams,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let content;
|
let content;
|
||||||
switch (phase) {
|
switch (phase) {
|
||||||
case RightPanelPhases.RoomMemberInfo:
|
case RightPanelPhases.RoomMemberInfo:
|
||||||
|
@ -1553,23 +1572,13 @@ const UserInfo: React.FC<Props> = ({
|
||||||
<EncryptionPanel
|
<EncryptionPanel
|
||||||
{...props as React.ComponentProps<typeof EncryptionPanel>}
|
{...props as React.ComponentProps<typeof EncryptionPanel>}
|
||||||
member={member}
|
member={member}
|
||||||
onClose={onClose}
|
onClose={onEncryptionPanelClose}
|
||||||
isRoomEncrypted={isRoomEncrypted}
|
isRoomEncrypted={isRoomEncrypted}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
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;
|
let closeLabel = undefined;
|
||||||
if (phase === RightPanelPhases.EncryptionPanel) {
|
if (phase === RightPanelPhases.EncryptionPanel) {
|
||||||
const verificationRequest = (props as React.ComponentProps<typeof EncryptionPanel>).verificationRequest;
|
const verificationRequest = (props as React.ComponentProps<typeof EncryptionPanel>).verificationRequest;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue