0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 18:22:50 +01:00

ircd:Ⓜ️:event::append: Move prev_content to unsigned (since v1.2 "no known server impl...")

This commit is contained in:
Jason Volk 2023-02-22 10:35:33 -08:00
parent 9c856c4f34
commit bb84740517

View file

@ -218,6 +218,18 @@ ircd::m::event::append::append(json::stack::object &object,
0UL
};
const bool query_prev_state
{
opts.query_prev_state && has_event_idx && is_state
};
const auto prev_state_idx
{
query_prev_state?
room::state::prev(*opts.event_idx):
0UL
};
#if defined(RB_DEBUG) && 0
if(!has_client_txnid && !txnid_idx && sender_is_user && opts.query_txnid)
log::dwarning
@ -235,28 +247,6 @@ ircd::m::event::append::append(json::stack::object &object,
object, "event_id", event.event_id
};
const bool query_prev_state
{
has_event_idx && opts.query_prev_state && is_state
};
if(query_prev_state)
{
const auto prev_idx
{
room::state::prev(*opts.event_idx)
};
m::get(std::nothrow, prev_idx, "content", [&object]
(const json::object &content)
{
json::stack::member
{
object, "prev_content", content
};
});
}
// Get the list of properties to send to the client so we can strip
// the remaining and save b/w
// TODO: m::filter
@ -340,6 +330,16 @@ ircd::m::event::append::append(json::stack::object &object,
};
});
if(prev_state_idx)
m::get(std::nothrow, prev_state_idx, "content", [&unsigned_]
(const json::object &content)
{
json::stack::member
{
unsigned_, "prev_content", content
};
});
if(unlikely(event_append_info))
log::info
{