mirror of
https://github.com/matrix-construct/construct
synced 2024-06-09 21:48:55 +02:00
modules/federation/send_join: Respond with the state and chain prior to the join.
This commit is contained in:
parent
7d5247d1ca
commit
5d73109f0d
|
@ -14,8 +14,6 @@ static void
|
|||
send_join__response(client &,
|
||||
const m::resource::request &,
|
||||
const m::event &,
|
||||
const m::room::state &,
|
||||
const m::room::auth::chain &,
|
||||
json::stack::object &out);
|
||||
|
||||
static m::resource::response
|
||||
|
@ -143,27 +141,20 @@ put__send_join(client &client,
|
|||
|
||||
const m::event signed_event
|
||||
{
|
||||
signed_event_json
|
||||
signed_event_json, event_id
|
||||
};
|
||||
|
||||
m::vm::opts vmopts
|
||||
{
|
||||
.node_id = request.node_id,
|
||||
.fetch = false,
|
||||
};
|
||||
|
||||
m::vm::opts vmopts;
|
||||
vmopts.fetch = false;
|
||||
vmopts.json_source = true;
|
||||
m::vm::eval eval
|
||||
{
|
||||
signed_event, vmopts
|
||||
};
|
||||
|
||||
const m::room::state state
|
||||
{
|
||||
room_id
|
||||
};
|
||||
|
||||
const m::room::auth::chain auth_chain
|
||||
{
|
||||
m::head_idx(room_id)
|
||||
};
|
||||
|
||||
m::resource::response::chunked response
|
||||
{
|
||||
client, http::OK
|
||||
|
@ -190,7 +181,7 @@ put__send_join(client &client,
|
|||
top
|
||||
};
|
||||
|
||||
send_join__response(client, request, signed_event, state, auth_chain, data);
|
||||
send_join__response(client, request, signed_event, data);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
@ -200,7 +191,7 @@ put__send_join(client &client,
|
|||
};
|
||||
|
||||
// Top element is the object
|
||||
send_join__response(client, request, signed_event, state, auth_chain, top);
|
||||
send_join__response(client, request, signed_event, top);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
@ -208,8 +199,6 @@ void
|
|||
send_join__response(client &client,
|
||||
const m::resource::request &request,
|
||||
const m::event &event,
|
||||
const m::room::state &state,
|
||||
const m::room::auth::chain &auth_chain,
|
||||
json::stack::object &data)
|
||||
{
|
||||
const bool omit_members
|
||||
|
@ -217,6 +206,32 @@ send_join__response(client &client,
|
|||
request.query.get("omit_members", false)
|
||||
};
|
||||
|
||||
const auto prev_state_idx
|
||||
{
|
||||
m::room::state::prev(m::index(event.event_id))
|
||||
};
|
||||
|
||||
const auto prev_state_id
|
||||
{
|
||||
m::event_id(prev_state_idx)
|
||||
};
|
||||
|
||||
// The room prior to this join.
|
||||
const m::room room
|
||||
{
|
||||
at<"room_id"_>(event), prev_state_id
|
||||
};
|
||||
|
||||
const m::room::state state
|
||||
{
|
||||
room
|
||||
};
|
||||
|
||||
const m::room::auth::chain auth_chain
|
||||
{
|
||||
prev_state_idx
|
||||
};
|
||||
|
||||
// auth_chain
|
||||
if(request.query.get<bool>("auth_chain", true))
|
||||
{
|
||||
|
@ -289,7 +304,7 @@ send_join__response(client &client,
|
|||
|
||||
const m::room::origins origins
|
||||
{
|
||||
state.room_id
|
||||
room
|
||||
};
|
||||
|
||||
origins.for_each([&servers_a]
|
||||
|
|
Loading…
Reference in a new issue