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 cli = MatrixClientPeg.safeGet();
|
||||||
|
|
||||||
const { roomId } = this.props.member;
|
const { roomId } = this.props.member;
|
||||||
if (roomId) {
|
if (roomId) {
|
||||||
const isRoomEncrypted = cli.isRoomEncrypted(roomId);
|
const isRoomEncrypted = Boolean(await cli.getCrypto()?.isEncryptionEnabledInRoom(roomId));
|
||||||
this.setState({
|
this.setState({
|
||||||
isRoomEncrypted,
|
isRoomEncrypted,
|
||||||
});
|
});
|
||||||
|
@ -31,6 +31,7 @@ import {
|
|||||||
filterConsole,
|
filterConsole,
|
||||||
flushPromises,
|
flushPromises,
|
||||||
getMockClientWithEventEmitter,
|
getMockClientWithEventEmitter,
|
||||||
|
mockClientMethodsCrypto,
|
||||||
mockClientMethodsRooms,
|
mockClientMethodsRooms,
|
||||||
mockClientMethodsUser,
|
mockClientMethodsUser,
|
||||||
} from "../../../../test-utils";
|
} from "../../../../test-utils";
|
||||||
@ -361,6 +362,7 @@ describe("MemberList", () => {
|
|||||||
client = getMockClientWithEventEmitter({
|
client = getMockClientWithEventEmitter({
|
||||||
...mockClientMethodsUser(),
|
...mockClientMethodsUser(),
|
||||||
...mockClientMethodsRooms(),
|
...mockClientMethodsRooms(),
|
||||||
|
...mockClientMethodsCrypto(),
|
||||||
getRoom: jest.fn(),
|
getRoom: jest.fn(),
|
||||||
hasLazyLoadMembersEnabled: jest.fn(),
|
hasLazyLoadMembersEnabled: jest.fn(),
|
||||||
});
|
});
|
||||||
|
@ -22,7 +22,7 @@ describe("MemberTile", () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
matrixClient = TestUtils.stubClient();
|
matrixClient = TestUtils.stubClient();
|
||||||
mocked(matrixClient.isRoomEncrypted).mockReturnValue(true);
|
jest.spyOn(matrixClient.getCrypto()!, "isEncryptionEnabledInRoom").mockResolvedValue(true);
|
||||||
member = new RoomMember("roomId", matrixClient.getUserId()!);
|
member = new RoomMember("roomId", matrixClient.getUserId()!);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user