Replace MatrixClient.isRoomEncrypted by MatrixClient.CryptoApi.isEncryptionEnabledInRoom in SecurityRoomSettingsTab (#28281)

This commit is contained in:
Florian Duros 2024-10-24 10:34:07 +02:00 committed by GitHub
parent e73a832008
commit 6d0d237c79
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 26 additions and 30 deletions

View file

@ -78,14 +78,18 @@ export default class SecurityRoomSettingsTab extends React.Component<IProps, ISt
HistoryVisibility.Shared,
),
hasAliases: false, // async loaded in componentDidMount
encrypted: context.isRoomEncrypted(this.props.room.roomId),
encrypted: false, // async loaded in componentDidMount
showAdvancedSection: false,
};
}
public componentDidMount(): void {
public async componentDidMount(): Promise<void> {
this.context.on(RoomStateEvent.Events, this.onStateEvent);
this.hasAliases().then((hasAliases) => this.setState({ hasAliases }));
this.setState({
hasAliases: await this.hasAliases(),
encrypted: Boolean(await this.context.getCrypto()?.isEncryptionEnabledInRoom(this.props.room.roomId)),
});
}
private pullContentPropertyFromEvent<T>(event: MatrixEvent | null | undefined, key: string, defaultValue: T): T {