Move room encryption check earlier in mount

This commit is contained in:
Florian Duros 2024-10-23 16:15:10 +02:00
parent 7507e3cb9a
commit 3ccfd9bee1
No known key found for this signature in database
GPG Key ID: A5BBB4041B493F15

View File

@ -117,15 +117,14 @@ class FilePanel extends React.Component<IProps, IState> {
public async componentDidMount(): Promise<void> {
const client = MatrixClientPeg.safeGet();
await this.updateTimelineSet(this.props.roomId);
const isRoomEncrypted = Boolean(await client.getCrypto()?.isEncryptionEnabledInRoom(this.props.roomId));
this.setState({
isRoomEncrypted,
});
if (!isRoomEncrypted) return;
await this.updateTimelineSet(this.props.roomId);
if (isRoomEncrypted) return;
// The timelineSets filter makes sure that encrypted events that contain
// URLs never get added to the timeline, even if they are live events.