add fragmentId to methods that need it in timeline store
This commit is contained in:
parent
53cdabb459
commit
783f39c378
1 changed files with 12 additions and 6 deletions
|
@ -105,23 +105,29 @@ export default class RoomTimelineStore {
|
||||||
|
|
||||||
/** Looks up the last `amount` entries in the timeline for `roomId`.
|
/** Looks up the last `amount` entries in the timeline for `roomId`.
|
||||||
* @param {string} roomId
|
* @param {string} roomId
|
||||||
|
* @param {number} fragmentId
|
||||||
* @param {number} amount
|
* @param {number} amount
|
||||||
* @return {Promise<Entry[]>} a promise resolving to an array with 0 or more entries, in ascending order.
|
* @return {Promise<Entry[]>} a promise resolving to an array with 0 or more entries, in ascending order.
|
||||||
*/
|
*/
|
||||||
async lastEvents(roomId, amount) {
|
async lastEvents(roomId, fragmentId, amount) {
|
||||||
return this.eventsBefore(roomId, SortKey.maxKey, amount);
|
const sortKey = SortKey.maxKey;
|
||||||
|
sortKey.fragmentId = fragmentId;
|
||||||
|
return this.eventsBefore(roomId, sortKey, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Looks up the first `amount` entries in the timeline for `roomId`.
|
/** Looks up the first `amount` entries in the timeline for `roomId`.
|
||||||
* @param {string} roomId
|
* @param {string} roomId
|
||||||
|
* @param {number} fragmentId
|
||||||
* @param {number} amount
|
* @param {number} amount
|
||||||
* @return {Promise<Entry[]>} a promise resolving to an array with 0 or more entries, in ascending order.
|
* @return {Promise<Entry[]>} a promise resolving to an array with 0 or more entries, in ascending order.
|
||||||
*/
|
*/
|
||||||
async firstEvents(roomId, amount) {
|
async firstEvents(roomId, fragmentId, amount) {
|
||||||
return this.eventsAfter(roomId, SortKey.minKey, amount);
|
const sortKey = SortKey.minKey;
|
||||||
|
sortKey.fragmentId = fragmentId;
|
||||||
|
return this.eventsAfter(roomId, sortKey, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Looks up `amount` entries after `sortKey` in the timeline for `roomId`.
|
/** Looks up `amount` entries after `sortKey` in the timeline for `roomId` within the same fragment.
|
||||||
* The entry for `sortKey` is not included.
|
* The entry for `sortKey` is not included.
|
||||||
* @param {string} roomId
|
* @param {string} roomId
|
||||||
* @param {SortKey} sortKey
|
* @param {SortKey} sortKey
|
||||||
|
@ -133,7 +139,7 @@ export default class RoomTimelineStore {
|
||||||
return this._timelineStore.selectLimit(idbRange, amount);
|
return this._timelineStore.selectLimit(idbRange, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Looks up `amount` entries before `sortKey` in the timeline for `roomId`.
|
/** Looks up `amount` entries before `sortKey` in the timeline for `roomId` within the same fragment.
|
||||||
* The entry for `sortKey` is not included.
|
* The entry for `sortKey` is not included.
|
||||||
* @param {string} roomId
|
* @param {string} roomId
|
||||||
* @param {SortKey} sortKey
|
* @param {SortKey} sortKey
|
||||||
|
|
Reference in a new issue