mirror of
https://github.com/matrix-construct/construct
synced 2024-11-26 08:42:34 +01:00
modules/client/rooms/context: Provide better pagination tokens in response.
This commit is contained in:
parent
48055345ea
commit
59973705bb
1 changed files with 18 additions and 6 deletions
|
@ -125,12 +125,18 @@ get__context(client &client,
|
||||||
for(size_t i(0); i < limit && before; --before, ++i)
|
for(size_t i(0); i < limit && before; --before, ++i)
|
||||||
{
|
{
|
||||||
const m::event &event{*before};
|
const m::event &event{*before};
|
||||||
if(!visible(event, request.user_id))
|
|
||||||
break;
|
|
||||||
|
|
||||||
start = at<"event_id"_>(event);
|
start = at<"event_id"_>(event);
|
||||||
|
if(!visible(event, request.user_id))
|
||||||
|
continue;
|
||||||
|
|
||||||
array.append(event);
|
array.append(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(before)
|
||||||
|
--before;
|
||||||
|
|
||||||
|
if(before)
|
||||||
|
start = before.event_id();
|
||||||
}
|
}
|
||||||
|
|
||||||
json::stack::member
|
json::stack::member
|
||||||
|
@ -153,12 +159,18 @@ get__context(client &client,
|
||||||
for(size_t i(0); i < limit && after; ++after, ++i)
|
for(size_t i(0); i < limit && after; ++after, ++i)
|
||||||
{
|
{
|
||||||
const m::event &event{*after};
|
const m::event &event{*after};
|
||||||
if(!visible(event, request.user_id))
|
|
||||||
break;
|
|
||||||
|
|
||||||
end = at<"event_id"_>(event);
|
end = at<"event_id"_>(event);
|
||||||
|
if(!visible(event, request.user_id))
|
||||||
|
continue;
|
||||||
|
|
||||||
array.append(event);
|
array.append(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(after)
|
||||||
|
++after;
|
||||||
|
|
||||||
|
if(after)
|
||||||
|
end = after.event_id();
|
||||||
}
|
}
|
||||||
|
|
||||||
json::stack::member
|
json::stack::member
|
||||||
|
|
Loading…
Reference in a new issue