From fbedf994db5766a055da129217d3940f1336f4ab Mon Sep 17 00:00:00 2001 From: timedout Date: Mon, 21 Sep 2026 06:17:57 +0100 Subject: [PATCH] fix: Don't unnecessarily embed prev_content in `populate_unsigned` --- src/core/matrix/pdu/unsigned.rs | 5 +++++ src/service/rooms/timeline/append.rs | 7 ------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/core/matrix/pdu/unsigned.rs b/src/core/matrix/pdu/unsigned.rs index 5b0facdd0..0177b0fae 100644 --- a/src/core/matrix/pdu/unsigned.rs +++ b/src/core/matrix/pdu/unsigned.rs @@ -53,6 +53,11 @@ impl Pdu { if let Some(prev_content) = prev_content { unsigned.insert("prev_content".to_owned(), to_raw_value(&prev_content)?); + // TODO(nex): prev_sender is still inserted in append.rs because + // only the prev *content* is passed to this function. + // I think ideally passing the actual direct `UnsignedContext` to + // this function instead of unpacking its parameters would be the + // proper solution, especially since every callsite has one } if let Some(redacted_because) = redacted_because { unsigned.remove("org.continuwuity.redacted_by"); diff --git a/src/service/rooms/timeline/append.rs b/src/service/rooms/timeline/append.rs index 89c4da17f..527d79845 100644 --- a/src/service/rooms/timeline/append.rs +++ b/src/service/rooms/timeline/append.rs @@ -336,13 +336,6 @@ impl super::Service { else { return; }; - unsigned.insert( - "prev_content".to_owned(), - CanonicalJsonValue::Object( - utils::to_canonical_object(prev_state.get_content_as_value()) - .expect("Failed to convert prev_content into canonical JSON object"), - ), - ); unsigned.insert( String::from("prev_sender"), CanonicalJsonValue::String(prev_state.sender().to_string()),