mirror of
https://github.com/matrix-construct/construct
synced 2024-11-26 08:42:34 +01:00
modules/client/notifications: Improve iteration finished condition; minor branch unexpect.
This commit is contained in:
parent
00980b547e
commit
967c3109dc
1 changed files with 4 additions and 3 deletions
|
@ -112,6 +112,7 @@ ircd::m::get_notifications(client &client,
|
|||
};
|
||||
|
||||
size_t count(0);
|
||||
bool finished(true);
|
||||
event::idx next_token(0);
|
||||
{
|
||||
json::stack::array array
|
||||
|
@ -119,7 +120,7 @@ ircd::m::get_notifications(client &client,
|
|||
top, "notifications"
|
||||
};
|
||||
|
||||
notifications.for_each(opts, [&]
|
||||
finished = notifications.for_each(opts, [&]
|
||||
(const event::idx ¬e_idx, const json::object ¬e)
|
||||
{
|
||||
assert(note_idx);
|
||||
|
@ -145,7 +146,7 @@ ircd::m::get_notifications(client &client,
|
|||
event_idx, std::nothrow
|
||||
};
|
||||
|
||||
if(!event.valid)
|
||||
if(unlikely(!event.valid))
|
||||
return true;
|
||||
|
||||
json::stack::object object
|
||||
|
@ -217,7 +218,7 @@ ircd::m::get_notifications(client &client,
|
|||
});
|
||||
}
|
||||
|
||||
if(next_token != opts.from)
|
||||
if(!finished)
|
||||
json::stack::member
|
||||
{
|
||||
top, "next_token", json::value
|
||||
|
|
Loading…
Reference in a new issue