From c6ed0abfd70bab40daff8a8fa59e35142a123fc5 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 23 Sep 2021 18:49:23 +0200 Subject: [PATCH] eventIds is missing --- src/matrix/room/timeline/persistence/GapWriter.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/matrix/room/timeline/persistence/GapWriter.js b/src/matrix/room/timeline/persistence/GapWriter.js index 7af75ead..7a6ffeff 100644 --- a/src/matrix/room/timeline/persistence/GapWriter.js +++ b/src/matrix/room/timeline/persistence/GapWriter.js @@ -26,8 +26,9 @@ export class GapWriter { this._fragmentIdComparer = fragmentIdComparer; this._relationWriter = relationWriter; } - // events is in reverse-chronological order (last event comes at index 0) if backwards - async _findOverlappingEvents(fragmentEntry, events, txn, log) { + + async _findOverlappingEvents(fragmentEntry, events, txn) { + const eventIds = events.map(e => e.event_id); const existingEventKeyMap = await txn.timelineEvents.getEventKeysForIds(this._roomId, eventIds); const nonOverlappingEvents = events.filter(e => !existingEventKeyMap.has(e.event_id)); let neighbourFragmentEntry; @@ -185,7 +186,7 @@ export class GapWriter { const { nonOverlappingEvents, neighbourFragmentEntry - } = await this._findOverlappingEvents(fragmentEntry, chunk, txn, log); + } = await this._findOverlappingEvents(fragmentEntry, chunk, txn); // create entries for all events in chunk, add them to entries const {entries, updatedEntries} = await this._storeEvents(nonOverlappingEvents, lastKey, direction, state, txn, log); const fragments = await this._updateFragments(fragmentEntry, neighbourFragmentEntry, end, entries, txn);