Display `SearchWarning` when `isRoomEncrypted` is loaded

florianduros/rip-out-legacy-crypto/migrate-filepanel-isRoomEncrypted
Florian Duros 2024-10-23 15:35:42 +02:00
parent 42fcb9ce85
commit b718c092a7
No known key found for this signature in database
GPG Key ID: A5BBB4041B493F15
1 changed files with 10 additions and 4 deletions

View File

@ -44,7 +44,10 @@ interface IProps {
interface IState { interface IState {
timelineSet: EventTimelineSet | null; timelineSet: EventTimelineSet | null;
narrow: boolean; 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<IProps, IState> {
public state: IState = { public state: IState = {
timelineSet: null, timelineSet: null,
narrow: false, narrow: false,
isRoomEncrypted: false, isRoomEncrypted: null,
}; };
private onRoomTimeline = ( private onRoomTimeline = (
@ -270,7 +273,8 @@ class FilePanel extends React.Component<IProps, IState> {
/> />
); );
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) { if (this.state.timelineSet) {
return ( return (
@ -291,7 +295,9 @@ class FilePanel extends React.Component<IProps, IState> {
{this.card.current && ( {this.card.current && (
<Measured sensor={this.card.current} onMeasurement={this.onMeasurement} /> <Measured sensor={this.card.current} onMeasurement={this.onMeasurement} />
)} )}
<SearchWarning isRoomEncrypted={isRoomEncrypted} kind={WarningKind.Files} /> {isRoomEncryptedLoaded && (
<SearchWarning isRoomEncrypted={isRoomEncrypted} kind={WarningKind.Files} />
)}
<TimelinePanel <TimelinePanel
manageReadReceipts={false} manageReadReceipts={false}
manageReadMarkers={false} manageReadMarkers={false}