Properly handle closing encryption panel
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>pull/21833/head
							parent
							
								
									73ab074219
								
							
						
					
					
						commit
						8a50b7bcbb
					
				|  | @ -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<Props> = ({ | |||
| 
 | ||||
|     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; | ||||
|     switch (phase) { | ||||
|         case RightPanelPhases.RoomMemberInfo: | ||||
|  | @ -1553,23 +1572,13 @@ const UserInfo: React.FC<Props> = ({ | |||
|                 <EncryptionPanel | ||||
|                     {...props as React.ComponentProps<typeof EncryptionPanel>} | ||||
|                     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<typeof EncryptionPanel>).verificationRequest; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Šimon Brandner
						Šimon Brandner