0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 18:22:50 +01:00

modules/client/sync/rooms/timeline: Conditional prev_batch; minor cleanup.

This commit is contained in:
Jason Volk 2019-09-17 18:11:41 -07:00
parent c77353fd9c
commit fe8f9ee611

View file

@ -209,18 +209,19 @@ ircd::m::sync::room_timeline_polylog(data &data)
_room_timeline_polylog_events(data, *data.room, limited, ret)
};
// prev_batch
json::stack::member
{
*data.out, "prev_batch", string_view{prev}
};
// limited
json::stack::member
{
*data.out, "limited", json::value{limited}
};
// prev_batch
if(likely(prev))
json::stack::member
{
*data.out, "prev_batch", string_view{prev}
};
return ret;
}
@ -278,17 +279,12 @@ ircd::m::sync::_room_timeline_polylog_events(data &data,
if(i > 0)
for(++it; it && i > -1; ++it, --i)
{
const m::event::idx &event_idx
{
it.event_idx()
};
const m::event &event
{
*it
};
ret |= _room_timeline_append(data, array, event_idx, event);
ret |= _room_timeline_append(data, array, it.event_idx(), event);
}
return m::event_id(event_idx, std::nothrow);