Refactor some canonical JSON code

This commit is contained in:
Jonas Platte 2021-05-08 02:13:01 +02:00
parent a0457000ff
commit af6fea3d4e
No known key found for this signature in database
GPG key ID: 7D261D771D915378
2 changed files with 28 additions and 33 deletions

View file

@ -213,7 +213,10 @@ impl PduEvent {
pub fn convert_to_outgoing_federation_event(
mut pdu_json: CanonicalJsonObject,
) -> Raw<ruma::events::pdu::Pdu> {
if let Some(CanonicalJsonValue::Object(unsigned)) = pdu_json.get_mut("unsigned") {
if let Some(unsigned) = pdu_json
.get_mut("unsigned")
.and_then(|val| val.as_object_mut())
{
unsigned.remove("transaction_id");
}