From 1b6bdc33077a96cbf8c14c5e0b1993b4edb19a6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Fri, 4 Dec 2020 14:50:45 +0100 Subject: [PATCH] crypto: Preserve the relationship info while decrypting events. --- .../src/olm/group_sessions/inbound.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/matrix_sdk_crypto/src/olm/group_sessions/inbound.rs b/matrix_sdk_crypto/src/olm/group_sessions/inbound.rs index 5d6036ab..121a9017 100644 --- a/matrix_sdk_crypto/src/olm/group_sessions/inbound.rs +++ b/matrix_sdk_crypto/src/olm/group_sessions/inbound.rs @@ -309,6 +309,21 @@ impl InboundGroupSession { serde_json::to_value(&event.unsigned).unwrap_or_default(), ); + if let Some(decrypted_content) = decrypted_object + .get_mut("content") + .map(|c| c.as_object_mut()) + .flatten() + { + if !decrypted_content.contains_key("m.relates_to") { + if let Some(relation) = &content.relates_to { + decrypted_content.insert( + "m.relates_to".to_owned(), + serde_json::to_value(relation).unwrap_or_default(), + ); + } + } + } + Ok(( serde_json::from_value::>(decrypted_value)?, message_index,