diff --git a/src/matrix/room/ArchivedRoom.js b/src/matrix/room/ArchivedRoom.js index f975191e..1a23d25b 100644 --- a/src/matrix/room/ArchivedRoom.js +++ b/src/matrix/room/ArchivedRoom.js @@ -138,6 +138,7 @@ export class ArchivedRoom extends BaseRoom { storeNames.roomMembers, storeNames.timelineEvents, storeNames.timelineFragments, + storeNames.timelineRelations, storeNames.pendingEvents, storeNames.inboundGroupSessions, storeNames.groupSessionDecryptions, @@ -149,6 +150,7 @@ export class ArchivedRoom extends BaseRoom { txn.roomMembers.removeAllForRoom(this.id); txn.timelineEvents.removeAllForRoom(this.id); txn.timelineFragments.removeAllForRoom(this.id); + txn.timelineRelations.removeAllForRoom(this.id); txn.pendingEvents.removeAllForRoom(this.id); txn.inboundGroupSessions.removeAllForRoom(this.id); txn.groupSessionDecryptions.removeAllForRoom(this.id); diff --git a/src/matrix/storage/idb/stores/TimelineRelationStore.ts b/src/matrix/storage/idb/stores/TimelineRelationStore.ts index 88ef86ae..c8f8f20c 100644 --- a/src/matrix/storage/idb/stores/TimelineRelationStore.ts +++ b/src/matrix/storage/idb/stores/TimelineRelationStore.ts @@ -57,6 +57,16 @@ export class TimelineRelationStore { this._store.delete(range); } + removeAllForRoom(roomId: string) { + const range = this._store.IDBKeyRange.bound( + encodeKey(roomId, MIN_UNICODE, MIN_UNICODE, MIN_UNICODE), + encodeKey(roomId, MAX_UNICODE, MAX_UNICODE, MAX_UNICODE), + true, + true + ); + this._store.delete(range); + } + async getForTargetAndType(roomId: string, targetId: string, relType: string): Promise { // exclude both keys as they are theoretical min and max, // but we should't have a match for just the room id, or room id with max