Skip to content

Commit

Permalink
modules/m_event: Conditionally add prev_content to events sent to cli…
Browse files Browse the repository at this point in the history
…ents.
  • Loading branch information
jevolk committed Mar 11, 2019
1 parent c416be8 commit 9f8b915
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions modules/m_event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 9f8b915

Please sign in to comment.