0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-28 19:58:53 +02:00

modules/m_event: Conditionally add prev_content to events sent to clients.

This commit is contained in:
Jason Volk 2019-03-11 16:15:46 -07:00
parent c416be8398
commit 9f8b915317

View file

@ -494,6 +494,24 @@ ircd::m::append(json::stack::object &object,
object.append(event);
if(json::get<"state_key"_>(event) && has_event_idx)
{
const auto prev_idx
{
room::state::prev(*opts.event_idx)
};
if(prev_idx)
m::get(std::nothrow, prev_idx, "content", [&object]
(const json::object &content)
{
json::stack::member
{
object, "prev_content", content
};
});
}
if(!has_event_idx && !txnid_idx)
return;