Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #6630 from SimonBrandner/fix/filepanel-e2e-paginat…
Browse files Browse the repository at this point in the history
…ion/18415

Fix FilePanel pagination in E2EE rooms
  • Loading branch information
jryans committed Aug 18, 2021
2 parents fabeb28 + f5cbc9f commit f68309f
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions src/indexing/EventIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { Room } from 'matrix-js-sdk/src/models/room';
import { MatrixEvent } from 'matrix-js-sdk/src/models/event';
import { EventTimelineSet } from 'matrix-js-sdk/src/models/event-timeline-set';
import { RoomState } from 'matrix-js-sdk/src/models/room-state';
import { TimelineWindow } from 'matrix-js-sdk/src/timeline-window';
import { TimelineIndex, TimelineWindow } from 'matrix-js-sdk/src/timeline-window';
import { sleep } from "matrix-js-sdk/src/utils";
import { IResultRoomEvents } from "matrix-js-sdk/src/@types/search";

Expand Down Expand Up @@ -859,13 +859,27 @@ export default class EventIndex extends EventEmitter {
return Promise.resolve(true);
}

const paginationMethod = async (timelineWindow, timeline, room, direction, limit) => {
const timelineSet = timelineWindow._timelineSet;
const token = timeline.timeline.getPaginationToken(direction);

const ret = await this.populateFileTimeline(timelineSet, timeline.timeline, room, limit, token, direction);
const paginationMethod = async (
timelineWindow: TimelineWindow,
timelineIndex: TimelineIndex,
room: Room,
direction: Direction,
limit: number,
) => {
const timeline = timelineIndex.timeline;
const timelineSet = timeline.getTimelineSet();
const token = timeline.getPaginationToken(direction);

const ret = await this.populateFileTimeline(
timelineSet,
timeline,
room,
limit,
token,
direction,
);

timeline.pendingPaginate = null;
timelineIndex.pendingPaginate = null;
timelineWindow.extend(direction, limit);

return ret;
Expand Down

0 comments on commit f68309f

Please sign in to comment.