From eb6801290b90e400b2c00c9275d6f90a2d3baad4 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Wed, 17 Apr 2024 19:37:32 +0200 Subject: [PATCH] Document copy_redacts --- src/service/pdu.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/service/pdu.rs b/src/service/pdu.rs index a10573b..b5c9598 100644 --- a/src/service/pdu.rs +++ b/src/service/pdu.rs @@ -97,6 +97,14 @@ impl PduEvent { Ok(()) } + /// Copies the `redacts` property of the event to the `content` dict + /// + /// This follows the specification's + /// [recommendation](https://spec.matrix.org/v1.10/rooms/v11/#moving-the-redacts-property-of-mroomredaction-events-to-a-content-property): + /// + /// > For backwards-compatibility with older clients, servers should add a redacts + /// > property to the top level of m.room.redaction events in when serving such events + /// > over the Client-Server API. pub fn copy_redacts(&self) -> (Option>, Box) { if self.kind == TimelineEventType::RoomRedaction { if let Ok(mut content) =