ManageEventIndexDialog: Show how many rooms are being currently crawled.

This commit is contained in:
Damir Jelić 2020-02-01 12:00:04 +01:00
parent 98c8986ead
commit 75fe3c2219
3 changed files with 40 additions and 3 deletions

View file

@ -748,4 +748,31 @@ export default class EventIndex extends EventEmitter {
return client.getRoom(this.crawlerCheckpoints[0].roomId);
}
}
crawlingRooms() {
const totalRooms = new Set();
const crawlingRooms = new Set();
this.crawlerCheckpoints.forEach((checkpoint, index) => {
crawlingRooms.add(checkpoint.roomId);
});
if (this._currentCheckpoint !== null) {
crawlingRooms.add(this._currentCheckpoint.roomId);
}
const client = MatrixClientPeg.get();
const rooms = client.getRooms();
const isRoomEncrypted = (room) => {
return client.isRoomEncrypted(room.roomId);
};
const encryptedRooms = rooms.filter(isRoomEncrypted);
encryptedRooms.forEach((room, index) => {
totalRooms.add(room.roomId);
});
return {crawlingRooms, totalRooms};
}
}