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