mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 14:05:04 +08:00
EventIndexing: Check if there is a room when resetting the timeline.
This commit is contained in:
parent
f453fea24a
commit
1316e04776
@ -347,7 +347,7 @@ export default class EventIndexer {
|
|||||||
console.log("Seshat: Stopping crawler function");
|
console.log("Seshat: Stopping crawler function");
|
||||||
}
|
}
|
||||||
|
|
||||||
async addCheckpointForLimitedRoom(room) {
|
async onLimitedTimeline(room) {
|
||||||
const indexManager = PlatformPeg.get().getEventIndexingManager();
|
const indexManager = PlatformPeg.get().getEventIndexingManager();
|
||||||
if (indexManager === null) return;
|
if (indexManager === null) return;
|
||||||
if (!MatrixClientPeg.get().isRoomEncrypted(room.roomId)) return;
|
if (!MatrixClientPeg.get().isRoomEncrypted(room.roomId)) return;
|
||||||
@ -362,21 +362,12 @@ export default class EventIndexer {
|
|||||||
direction: "b",
|
direction: "b",
|
||||||
};
|
};
|
||||||
|
|
||||||
const forwardsCheckpoint = {
|
|
||||||
roomId: room.roomId,
|
|
||||||
token: token,
|
|
||||||
fullCrawl: false,
|
|
||||||
direction: "f",
|
|
||||||
};
|
|
||||||
|
|
||||||
console.log("Seshat: Added checkpoint because of a limited timeline",
|
console.log("Seshat: Added checkpoint because of a limited timeline",
|
||||||
backwardsCheckpoint, forwardsCheckpoint);
|
backwardsCheckpoint);
|
||||||
|
|
||||||
await indexManager.addCrawlerCheckpoint(backwardsCheckpoint);
|
await indexManager.addCrawlerCheckpoint(backwardsCheckpoint);
|
||||||
await indexManager.addCrawlerCheckpoint(forwardsCheckpoint);
|
|
||||||
|
|
||||||
this.crawlerChekpoints.push(backwardsCheckpoint);
|
this.crawlerChekpoints.push(backwardsCheckpoint);
|
||||||
this.crawlerChekpoints.push(forwardsCheckpoint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async deleteEventIndex() {
|
async deleteEventIndex() {
|
||||||
|
@ -1310,8 +1310,8 @@ export default createReactClass({
|
|||||||
cli.on("Room.timelineReset", async (room, timelineSet, resetAllTimelines) => {
|
cli.on("Room.timelineReset", async (room, timelineSet, resetAllTimelines) => {
|
||||||
const eventIndex = EventIndexPeg.get();
|
const eventIndex = EventIndexPeg.get();
|
||||||
if (eventIndex === null) return;
|
if (eventIndex === null) return;
|
||||||
if (resetAllTimelines === true) return;
|
if (room === null) return;
|
||||||
await eventIndex.addCheckpointForLimitedRoom(room);
|
await eventIndex.onLimitedTimeline(room);
|
||||||
});
|
});
|
||||||
|
|
||||||
cli.on('sync', function(state, prevState, data) {
|
cli.on('sync', function(state, prevState, data) {
|
||||||
|
Loading…
Reference in New Issue
Block a user