adjust query for finding all state events of a type

we were looking for state events with state key between \0 and \u10FFFF
but an empty state key is also valid and would come before \0,
so allow empty state keys at the beginning of the range and include them
in the result by opening the lower bound.
This commit is contained in:
Bruno Windels 2022-11-10 14:08:34 +01:00
parent 68707d3963
commit 32835e26b9

View File

@ -43,9 +43,9 @@ export class RoomStateStore {
getAllForType(roomId: string, type: string): Promise<RoomStateEntry[]> { getAllForType(roomId: string, type: string): Promise<RoomStateEntry[]> {
const range = this._roomStateStore.IDBKeyRange.bound( const range = this._roomStateStore.IDBKeyRange.bound(
encodeKey(roomId, type, MIN_UNICODE), encodeKey(roomId, type, ""),
encodeKey(roomId, type, MAX_UNICODE), encodeKey(roomId, type, MAX_UNICODE),
true, false,
true true
); );
return this._roomStateStore.selectAll(range); return this._roomStateStore.selectAll(range);