You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-08-07 21:23:00 +03:00
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:
@@ -234,11 +234,16 @@ describe("<PinnedMessagesCard />", () => {
|
||||
});
|
||||
|
||||
// Make the responses available
|
||||
cli.relations.mockImplementation((roomId, eventId, relationType, eventType) => {
|
||||
cli.relations.mockImplementation((roomId, eventId, relationType, eventType, { from }) => {
|
||||
if (eventId === poll.getId() && relationType === RelationType.Reference) {
|
||||
switch (eventType) {
|
||||
case M_POLL_RESPONSE.name: return { events: responses };
|
||||
case M_POLL_END.name: return { events: [end] };
|
||||
case M_POLL_RESPONSE.name:
|
||||
// Paginate the results, for added challenge
|
||||
return (from === "page2") ?
|
||||
{ events: responses.slice(2) } :
|
||||
{ events: responses.slice(0, 2), nextBatch: "page2" };
|
||||
case M_POLL_END.name:
|
||||
return { events: [end] };
|
||||
}
|
||||
}
|
||||
return { events: [] };
|
||||
|
Reference in New Issue
Block a user