diff --git a/src/async-components/views/dialogs/eventindex/ManageEventIndexDialog.js b/src/async-components/views/dialogs/eventindex/ManageEventIndexDialog.js index 58605a3263..b98fecf22f 100644 --- a/src/async-components/views/dialogs/eventindex/ManageEventIndexDialog.js +++ b/src/async-components/views/dialogs/eventindex/ManageEventIndexDialog.js @@ -38,6 +38,7 @@ export default class ManageEventIndexDialog extends React.Component { this.state = { eventIndexSize: 0, eventCount: 0, + crawlingRoomsCount: 0, roomCount: 0, currentRoom: null, crawlerSleepTime: @@ -51,11 +52,15 @@ export default class ManageEventIndexDialog extends React.Component { let currentRoom = null; if (room) currentRoom = room.name; + const roomStats = eventIndex.crawlingRooms(); + const crawlingRoomsCount = roomStats.crawlingRooms.size; + const roomCount = roomStats.totalRooms.size; this.setState({ eventIndexSize: stats.size, - roomCount: stats.roomCount, eventCount: stats.eventCount, + crawlingRoomsCount: crawlingRoomsCount, + roomCount: roomCount, currentRoom: currentRoom, }); } @@ -70,6 +75,7 @@ export default class ManageEventIndexDialog extends React.Component { async componentWillMount(): void { let eventIndexSize = 0; + let crawlingRoomsCount = 0; let roomCount = 0; let eventCount = 0; let currentRoom = null; @@ -80,8 +86,10 @@ export default class ManageEventIndexDialog extends React.Component { eventIndex.on("changedCheckpoint", this.updateCurrentRoom.bind(this)); const stats = await eventIndex.getStats(); + const roomStats = eventIndex.crawlingRooms(); eventIndexSize = stats.size; - roomCount = stats.roomCount; + crawlingRoomsCount = roomStats.crawlingRooms.size; + roomCount = roomStats.totalRooms.size; eventCount = stats.eventCount; const room = eventIndex.currentRoom(); @@ -91,6 +99,7 @@ export default class ManageEventIndexDialog extends React.Component { this.setState({ eventIndexSize, eventCount, + crawlingRoomsCount, roomCount, currentRoom, }); @@ -135,7 +144,8 @@ export default class ManageEventIndexDialog extends React.Component {
{_t("Space used:")} {formatBytes(this.state.eventIndexSize, 0)}
{_t("Indexed messages:")} {formatCountLong(this.state.eventCount)}
- {_t("Number of rooms:")} {formatCountLong(this.state.roomCount)}
+ {_t("Number of rooms:")} {formatCountLong(this.state.crawlingRoomsCount)} {_t("of ")} + {formatCountLong(this.state.roomCount)}
{crawlerState}
{ + 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}; + } }