diff --git a/src/service/rooms/timeline/create.rs b/src/service/rooms/timeline/create.rs index d76090b31..2f33db721 100644 --- a/src/service/rooms/timeline/create.rs +++ b/src/service/rooms/timeline/create.rs @@ -190,9 +190,17 @@ pub async fn create_event( } } } + let redacts = match redacts { + // If this isn't a real redaction event, there's no redacts field. + | _ if event_type != TimelineEventType::RoomRedaction || state_key.is_some() => None, + // If the redaction is itself in the event content, we don't set the top-level field. + | Some(_) if room_version_rules.redaction.content_field_redacts => None, + // Otherwise, we do if it's present + | other => other, + }; let pdu = PduEvent { - event_id: ruma::event_id!("$thiswillbefilledinlater").into(), + event_id: ruma::owned_event_id!("$thiswillbefilledinlater"), room_id: room_id.map(ToOwned::to_owned), sender: sender.to_owned(), origin: None,