mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-28 11:28:12 +08:00
Replace MatrixClient.isRoomEncrypted
by MatrixClient.CryptoApi.isEncryptionEnabledInRoom
in MemberTile.tsx
This commit is contained in:
parent
92405c39fc
commit
f227ac8205
@ -49,12 +49,12 @@ export default class MemberTile extends React.Component<IProps, IState> {
|
||||
};
|
||||
}
|
||||
|
||||
public componentDidMount(): void {
|
||||
public async componentDidMount(): Promise<void> {
|
||||
const cli = MatrixClientPeg.safeGet();
|
||||
|
||||
const { roomId } = this.props.member;
|
||||
if (roomId) {
|
||||
const isRoomEncrypted = cli.isRoomEncrypted(roomId);
|
||||
const isRoomEncrypted = Boolean(await cli.getCrypto()?.isEncryptionEnabledInRoom(roomId));
|
||||
this.setState({
|
||||
isRoomEncrypted,
|
||||
});
|
||||
|
@ -31,6 +31,7 @@ import {
|
||||
filterConsole,
|
||||
flushPromises,
|
||||
getMockClientWithEventEmitter,
|
||||
mockClientMethodsCrypto,
|
||||
mockClientMethodsRooms,
|
||||
mockClientMethodsUser,
|
||||
} from "../../../../test-utils";
|
||||
@ -361,6 +362,7 @@ describe("MemberList", () => {
|
||||
client = getMockClientWithEventEmitter({
|
||||
...mockClientMethodsUser(),
|
||||
...mockClientMethodsRooms(),
|
||||
...mockClientMethodsCrypto(),
|
||||
getRoom: jest.fn(),
|
||||
hasLazyLoadMembersEnabled: jest.fn(),
|
||||
});
|
||||
|
@ -22,7 +22,7 @@ describe("MemberTile", () => {
|
||||
|
||||
beforeEach(() => {
|
||||
matrixClient = TestUtils.stubClient();
|
||||
mocked(matrixClient.isRoomEncrypted).mockReturnValue(true);
|
||||
jest.spyOn(matrixClient.getCrypto()!, "isEncryptionEnabledInRoom").mockResolvedValue(true);
|
||||
member = new RoomMember("roomId", matrixClient.getUserId()!);
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user