Paginate responses to pinned polls (#8025)
* Paginate responses to pinned polls Signed-off-by: Robin Townsend <robin@robin.town> * Test that pinned polls display paginated responses Signed-off-by: Robin Townsend <robin@robin.town>
This commit is contained in:
parent
e96d9157a9
commit
3608fdb2ae
2 changed files with 18 additions and 9 deletions
|
@ -80,18 +80,22 @@ export default class PinnedEventTile extends React.Component<IProps> {
|
|||
await Promise.all(
|
||||
[M_POLL_RESPONSE.name, M_POLL_RESPONSE.altName, M_POLL_END.name, M_POLL_END.altName]
|
||||
.map(async eventType => {
|
||||
const { events } = await this.context.relations(
|
||||
roomId, eventId, RelationType.Reference, eventType,
|
||||
);
|
||||
|
||||
const relations = new Relations(RelationType.Reference, eventType, room);
|
||||
relations.setTargetEvent(this.props.event);
|
||||
|
||||
if (!this.relations.has(RelationType.Reference)) {
|
||||
this.relations.set(RelationType.Reference, new Map<string, Relations>());
|
||||
}
|
||||
this.relations.get(RelationType.Reference).set(eventType, relations);
|
||||
|
||||
relations.setTargetEvent(this.props.event);
|
||||
events.forEach(event => relations.addEvent(event));
|
||||
let nextBatch: string | undefined;
|
||||
do {
|
||||
const page = await this.context.relations(
|
||||
roomId, eventId, RelationType.Reference, eventType, { from: nextBatch },
|
||||
);
|
||||
nextBatch = page.nextBatch;
|
||||
page.events.forEach(event => relations.addEvent(event));
|
||||
} while (nextBatch);
|
||||
}),
|
||||
);
|
||||
} catch (err) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue