mirror of
https://github.com/matrix-construct/construct
synced 2024-10-01 05:08:59 +02:00
ircd:Ⓜ️:vm: Fix dependence on room_id without bypass mechanism in injector.
This commit is contained in:
parent
9973c80916
commit
16f1ba2b11
2 changed files with 16 additions and 2 deletions
|
@ -63,4 +63,6 @@ struct ircd::m::room::head
|
||||||
head(const m::room &room)
|
head(const m::room &room)
|
||||||
:room{room}
|
:room{room}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
head() = default;
|
||||||
};
|
};
|
||||||
|
|
|
@ -283,6 +283,11 @@ ircd::m::vm::inject(eval &eval,
|
||||||
is_room_create && contents.has("room_version")?
|
is_room_create && contents.has("room_version")?
|
||||||
string_view{contents.at("room_version")}:
|
string_view{contents.at("room_version")}:
|
||||||
|
|
||||||
|
// If this is an EDU or some kind of feature without a room_id then
|
||||||
|
// we'll leave this blank.
|
||||||
|
!eval.room_id?
|
||||||
|
string_view{}:
|
||||||
|
|
||||||
// Make a query to find the version. The version string will be hosted
|
// Make a query to find the version. The version string will be hosted
|
||||||
// by the stack buffer.
|
// by the stack buffer.
|
||||||
m::version(room_version_buf, room{eval.room_id}, std::nothrow)
|
m::version(room_version_buf, room{eval.room_id}, std::nothrow)
|
||||||
|
@ -292,7 +297,6 @@ ircd::m::vm::inject(eval &eval,
|
||||||
// event iov being injected. This is the inverse of the above satisfying
|
// event iov being injected. This is the inverse of the above satisfying
|
||||||
// the case where the room_id is supplied via the reference, not the iov;
|
// the case where the room_id is supplied via the reference, not the iov;
|
||||||
// in the end we want that reference in both places.
|
// in the end we want that reference in both places.
|
||||||
assert(eval.room_id);
|
|
||||||
const json::iov::add room_id_
|
const json::iov::add room_id_
|
||||||
{
|
{
|
||||||
event, eval.room_id && !event.has("room_id"),
|
event, eval.room_id && !event.has("room_id"),
|
||||||
|
@ -344,6 +348,7 @@ ircd::m::vm::inject(eval &eval,
|
||||||
!is_room_create
|
!is_room_create
|
||||||
&& opts.prop_mask.has("prev_events")
|
&& opts.prop_mask.has("prev_events")
|
||||||
&& !event.has("prev_events")
|
&& !event.has("prev_events")
|
||||||
|
&& eval.room_id
|
||||||
};
|
};
|
||||||
|
|
||||||
// The buffer we'll be composing the prev_events JSON array into.
|
// The buffer we'll be composing the prev_events JSON array into.
|
||||||
|
@ -357,7 +362,13 @@ ircd::m::vm::inject(eval &eval,
|
||||||
// Conduct the prev_events composition into our buffer. This sub returns
|
// Conduct the prev_events composition into our buffer. This sub returns
|
||||||
// a finished json::array in our buffer as well as a depth integer for
|
// a finished json::array in our buffer as well as a depth integer for
|
||||||
// the event which will be using the references.
|
// the event which will be using the references.
|
||||||
const room::head head{room{eval.room_id}};
|
const room::head head
|
||||||
|
{
|
||||||
|
add_prev_events?
|
||||||
|
room::head{room{eval.room_id}}:
|
||||||
|
room::head{}
|
||||||
|
};
|
||||||
|
|
||||||
const auto &[prev_events, depth]
|
const auto &[prev_events, depth]
|
||||||
{
|
{
|
||||||
add_prev_events?
|
add_prev_events?
|
||||||
|
@ -403,6 +414,7 @@ ircd::m::vm::inject(eval &eval,
|
||||||
!is_room_create
|
!is_room_create
|
||||||
&& opts.prop_mask.has("auth_events")
|
&& opts.prop_mask.has("auth_events")
|
||||||
&& !event.has("auth_events")
|
&& !event.has("auth_events")
|
||||||
|
&& eval.room_id
|
||||||
};
|
};
|
||||||
|
|
||||||
// The auth_events have more deterministic properties.
|
// The auth_events have more deterministic properties.
|
||||||
|
|
Loading…
Reference in a new issue