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:
parent
c416be8398
commit
9f8b915317
1 changed files with 18 additions and 0 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue