mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-25 18:08:14 +08:00
Replace MatrixClient.isRoomEncrypted
by MatrixClient.CryptoApi.isEncryptionEnabledInRoom
in MemberListStore.tsx
This commit is contained in:
parent
6533a6b642
commit
f8c5eac8a9
@ -70,7 +70,7 @@ export class MemberListStore {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.isLazyLoadingEnabled(roomId) || this.loadedRooms.has(roomId)) {
|
if (!(await this.isLazyLoadingEnabled(roomId)) || this.loadedRooms.has(roomId)) {
|
||||||
// nice and easy, we must already have all the members so just return them.
|
// nice and easy, we must already have all the members so just return them.
|
||||||
return this.loadMembersInRoom(room);
|
return this.loadMembersInRoom(room);
|
||||||
}
|
}
|
||||||
@ -121,10 +121,10 @@ export class MemberListStore {
|
|||||||
* @param roomId The room to check if lazy loading is enabled
|
* @param roomId The room to check if lazy loading is enabled
|
||||||
* @returns True if enabled
|
* @returns True if enabled
|
||||||
*/
|
*/
|
||||||
private isLazyLoadingEnabled(roomId: string): boolean {
|
private async isLazyLoadingEnabled(roomId: string): Promise<boolean> {
|
||||||
if (SettingsStore.getValue("feature_sliding_sync")) {
|
if (SettingsStore.getValue("feature_sliding_sync")) {
|
||||||
// only unencrypted rooms use lazy loading
|
// only unencrypted rooms use lazy loading
|
||||||
return !this.stores.client!.isRoomEncrypted(roomId);
|
return !(await this.stores.client?.getCrypto()?.isEncryptionEnabledInRoom(roomId));
|
||||||
}
|
}
|
||||||
return this.stores.client!.hasLazyLoadMembersEnabled();
|
return this.stores.client!.hasLazyLoadMembersEnabled();
|
||||||
}
|
}
|
||||||
|
@ -189,8 +189,7 @@ describe("MemberListStore", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("does not use lazy loading on encrypted rooms", async () => {
|
it("does not use lazy loading on encrypted rooms", async () => {
|
||||||
client.isRoomEncrypted = jest.fn();
|
jest.spyOn(client.getCrypto()!, "isEncryptionEnabledInRoom").mockResolvedValue(true);
|
||||||
mocked(client.isRoomEncrypted).mockReturnValue(true);
|
|
||||||
|
|
||||||
const { joined } = await store.loadMemberList(roomId);
|
const { joined } = await store.loadMemberList(roomId);
|
||||||
expect(joined).toEqual([room.getMember(alice)]);
|
expect(joined).toEqual([room.getMember(alice)]);
|
||||||
|
Loading…
Reference in New Issue
Block a user