EventIndex: Correctly populate events on initial fill requests.
This commit is contained in:
parent
a0599dedf0
commit
735ba4fd33
2 changed files with 11 additions and 1 deletions
|
@ -98,7 +98,7 @@ const FilePanel = createReactClass({
|
||||||
|
|
||||||
if (client.isRoomEncrypted(roomId) && eventIndex !== null) {
|
if (client.isRoomEncrypted(roomId) && eventIndex !== null) {
|
||||||
const timeline = timelineSet.getLiveTimeline();
|
const timeline = timelineSet.getLiveTimeline();
|
||||||
await eventIndex.populateFileTimeline(timelineSet, timeline, room, 1);
|
await eventIndex.populateFileTimeline(timelineSet, timeline, room, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState({ timelineSet: timelineSet });
|
this.setState({ timelineSet: timelineSet });
|
||||||
|
|
|
@ -476,6 +476,16 @@ export default class EventIndex {
|
||||||
fromEvent = null, direction = EventTimeline.BACKWARDS) {
|
fromEvent = null, direction = EventTimeline.BACKWARDS) {
|
||||||
const matrixEvents = await this.loadFileEvents(room, limit, fromEvent, direction);
|
const matrixEvents = await this.loadFileEvents(room, limit, fromEvent, direction);
|
||||||
|
|
||||||
|
// If this is a normal fill request, not a pagination request, we need
|
||||||
|
// to get our events in the BACKWARDS direction but populate them in the
|
||||||
|
// forwards direction.
|
||||||
|
// This needs to happen because a fill request might come with an
|
||||||
|
// exisitng timeline e.g. if you close and re-open the FilePanel.
|
||||||
|
if (fromEvent === null) {
|
||||||
|
matrixEvents.reverse();
|
||||||
|
direction = direction == EventTimeline.BACKWARDS ? EventTimeline.FORWARDS: EventTimeline.BACKWARDS;
|
||||||
|
}
|
||||||
|
|
||||||
// Add the events to the live timeline of the file panel.
|
// Add the events to the live timeline of the file panel.
|
||||||
matrixEvents.forEach(e => {
|
matrixEvents.forEach(e => {
|
||||||
if (!timelineSet.eventIdToTimeline(e.getId())) {
|
if (!timelineSet.eventIdToTimeline(e.getId())) {
|
||||||
|
|
Loading…
Reference in a new issue