make sure queries don't run into other rooms

This commit is contained in:
Bruno Windels 2019-02-16 02:54:02 +01:00
parent c60840bae9
commit 03ef98e668

View file

@ -14,12 +14,12 @@ export default class RoomTimelineStore {
}
eventsAfter(roomId, sortKey, amount) {
const range = IDBKeyRange.lowerBound([roomId, sortKey.buffer], true);
const range = IDBKeyRange.bound([roomId, sortKey.buffer], [roomId, SortKey.maxKey.buffer], true, false);
return this._timelineStore.selectLimit(range, amount);
}
async eventsBefore(roomId, sortKey, amount) {
const range = IDBKeyRange.upperBound([roomId, sortKey.buffer], true);
const range = IDBKeyRange.bound([roomId, SortKey.minKey.buffer], [roomId, sortKey.buffer], false, true);
const events = await this._timelineStore.selectLimitReverse(range, amount);
events.reverse(); // because we fetched them backwards
return events;