From b718c092a77b3ac59e608ab9d4ce6d60ce642d39 Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Wed, 23 Oct 2024 15:35:42 +0200 Subject: [PATCH] Display `SearchWarning` when `isRoomEncrypted` is loaded --- src/components/structures/FilePanel.tsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/structures/FilePanel.tsx b/src/components/structures/FilePanel.tsx index 5d754f0e4d..7ee0ab04eb 100644 --- a/src/components/structures/FilePanel.tsx +++ b/src/components/structures/FilePanel.tsx @@ -44,7 +44,10 @@ interface IProps { interface IState { timelineSet: EventTimelineSet | null; narrow: boolean; - isRoomEncrypted: boolean; + /** + * Whether the room is encrypted or not. If null, the state is still being determined. + */ + isRoomEncrypted: boolean | null; } /* @@ -63,7 +66,7 @@ class FilePanel extends React.Component { public state: IState = { timelineSet: null, narrow: false, - isRoomEncrypted: false, + isRoomEncrypted: null, }; private onRoomTimeline = ( @@ -270,7 +273,8 @@ class FilePanel extends React.Component { /> ); - const isRoomEncrypted = this.noRoom ? false : this.state.isRoomEncrypted; + const isRoomEncryptedLoaded = this.state.isRoomEncrypted !== null; + const isRoomEncrypted = Boolean(this.noRoom ? false : this.state.isRoomEncrypted); if (this.state.timelineSet) { return ( @@ -291,7 +295,9 @@ class FilePanel extends React.Component { {this.card.current && ( )} - + {isRoomEncryptedLoaded && ( + + )}