mirror of
https://github.com/matrix-construct/construct
synced 2024-11-16 15:00:51 +01:00
modules/federation/send_join: Add non-spec query parameters to return ids only.
This commit is contained in:
parent
ba00228a8d
commit
6ac41d99ac
1 changed files with 38 additions and 0 deletions
|
@ -174,6 +174,29 @@ put__send_join(client &client,
|
||||||
}});
|
}});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// auth_chain_ids (non-spec)
|
||||||
|
if(request.query.get<bool>("auth_chain_ids", false))
|
||||||
|
{
|
||||||
|
json::stack::array auth_chain_a
|
||||||
|
{
|
||||||
|
data, "auth_chain_ids"
|
||||||
|
};
|
||||||
|
|
||||||
|
auth_chain.for_each(m::event::closure_idx_bool{[&auth_chain_a]
|
||||||
|
(const m::event::idx &event_idx)
|
||||||
|
{
|
||||||
|
const auto &event_id
|
||||||
|
{
|
||||||
|
m::event_id(event_idx, std::nothrow)
|
||||||
|
};
|
||||||
|
|
||||||
|
if(event_id)
|
||||||
|
auth_chain_a.append(event_id);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}});
|
||||||
|
}
|
||||||
|
|
||||||
// state
|
// state
|
||||||
if(request.query.get<bool>("state", true))
|
if(request.query.get<bool>("state", true))
|
||||||
{
|
{
|
||||||
|
@ -189,6 +212,21 @@ put__send_join(client &client,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// state_ids (non-spec)
|
||||||
|
if(request.query.get<bool>("state_ids", false))
|
||||||
|
{
|
||||||
|
json::stack::array state_ids
|
||||||
|
{
|
||||||
|
data, "state_ids"
|
||||||
|
};
|
||||||
|
|
||||||
|
state.for_each(m::event::id::closure{[&state_ids]
|
||||||
|
(const m::event::id &event_id)
|
||||||
|
{
|
||||||
|
state_ids.append(event_id);
|
||||||
|
}});
|
||||||
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue