forked from mystiq/hydrogen-web
Merge pull request #524 from vector-im/bwindels/fix-492
clear relations for room when forgetting room
This commit is contained in:
commit
dcb08f5266
2 changed files with 12 additions and 0 deletions
|
@ -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);
|
||||
|
|
|
@ -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<RelationEntry[]> {
|
||||
// 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
|
||||
|
|
Loading…
Reference in a new issue