crypto: Preserve the relationship info while decrypting events.

master
Damir Jelić 2020-12-04 14:50:45 +01:00
parent 9eb17e757c
commit 3f41e5071b
1 changed files with 15 additions and 0 deletions

View File

@ -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::<Raw<AnySyncRoomEvent>>(decrypted_value)?,
message_index,