Second batch: Replace MatrixClient.isRoomEncrypted
by MatrixClient.CryptoApi.isEncryptionEnabledInRoom
(#28466)
* Add `asyncFilter` * Replace `MatrixClient.isRoomEncrypted` by `MatrixClient.CryptoApi.isEncryptionEnabledInRoom` in `MemberListStore.tsx` * Replace `MatrixClient.isRoomEncrypted` by `MatrixClient.CryptoApi.isEncryptionEnabledInRoom` in `EventIndex.tsx` * Replace `MatrixClient.isRoomEncrypted` by `MatrixClient.CryptoApi.isEncryptionEnabledInRoom` in `SendMessageComposer.tsx` * Replace `MatrixClient.isRoomEncrypted` by `MatrixClient.CryptoApi.isEncryptionEnabledInRoom` in `ScalarMessaging.ts` * Replace `MatrixClient.isRoomEncrypted` by `MatrixClient.CryptoApi.isEncryptionEnabledInRoom` in `RolesRoomSettingsTab.tsx` * Add reject doc to `asyncFilter` * Reverse `MemberListStore.loadMembers` condition * Remove async for `ScalarMessaging.ts` * Display permission section only after `isEncrypted` is computed * Display composer only after `isEncrypted` is computed * Revert "Display composer only after `isEncrypted` is computed" This reverts commit4d4e037391
. * Revert "Replace `MatrixClient.isRoomEncrypted` by `MatrixClient.CryptoApi.isEncryptionEnabledInRoom` in `SendMessageComposer.tsx`" This reverts commit6bf06da02c
.
This commit is contained in:
parent
ca33d9165a
commit
5cdcf44b6f
8 changed files with 93 additions and 49 deletions
|
@ -39,6 +39,7 @@ import { MatrixClientPeg } from "../MatrixClientPeg";
|
|||
import SettingsStore from "../settings/SettingsStore";
|
||||
import { SettingLevel } from "../settings/SettingLevel";
|
||||
import { ICrawlerCheckpoint, IEventAndProfile, IIndexStats, ILoadArgs, ISearchArgs } from "./BaseEventIndexManager";
|
||||
import { asyncFilter } from "../utils/arrays.ts";
|
||||
|
||||
// The time in ms that the crawler will wait loop iterations if there
|
||||
// have not been any checkpoints to consume in the last iteration.
|
||||
|
@ -103,13 +104,11 @@ export default class EventIndex extends EventEmitter {
|
|||
const client = MatrixClientPeg.safeGet();
|
||||
const rooms = client.getRooms();
|
||||
|
||||
const isRoomEncrypted = (room: Room): boolean => {
|
||||
return client.isRoomEncrypted(room.roomId);
|
||||
};
|
||||
|
||||
// We only care to crawl the encrypted rooms, non-encrypted
|
||||
// rooms can use the search provided by the homeserver.
|
||||
const encryptedRooms = rooms.filter(isRoomEncrypted);
|
||||
const encryptedRooms = await asyncFilter(rooms, async (room) =>
|
||||
Boolean(await client.getCrypto()?.isEncryptionEnabledInRoom(room.roomId)),
|
||||
);
|
||||
|
||||
logger.log("EventIndex: Adding initial crawler checkpoints");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue