mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 07:41:23 +01:00
feat(pdu): copy top level redact to content and vice versa
This commit is contained in:
parent
92817213d5
commit
7a7c09785e
4 changed files with 41 additions and 23 deletions
|
|
@ -399,15 +399,16 @@ impl Service {
|
|||
}
|
||||
}
|
||||
RoomVersionId::V11 => {
|
||||
let content = serde_json::from_str::<RoomRedactionEventContent>(pdu.content.get())
|
||||
.map_err(|_| {
|
||||
Error::bad_database("Invalid content in redaction pdu.")
|
||||
})?;
|
||||
let content =
|
||||
serde_json::from_str::<RoomRedactionEventContent>(pdu.content.get())
|
||||
.map_err(|_| {
|
||||
Error::bad_database("Invalid content in redaction pdu.")
|
||||
})?;
|
||||
if let Some(redact_id) = &content.redacts {
|
||||
self.redact_pdu(redact_id, pdu)?;
|
||||
}
|
||||
}
|
||||
_ => unreachable!("Validity of room version already checked")
|
||||
_ => unreachable!("Validity of room version already checked"),
|
||||
};
|
||||
}
|
||||
TimelineEventType::SpaceChild => {
|
||||
|
|
@ -1015,10 +1016,7 @@ impl Service {
|
|||
let mut pdu = self
|
||||
.get_pdu_from_id(&pdu_id)?
|
||||
.ok_or_else(|| Error::bad_database("PDU ID points to invalid PDU."))?;
|
||||
let room_version_id = services()
|
||||
.rooms
|
||||
.state
|
||||
.get_room_version(&pdu.room_id)?;
|
||||
let room_version_id = services().rooms.state.get_room_version(&pdu.room_id)?;
|
||||
pdu.redact(room_version_id, reason)?;
|
||||
self.replace_pdu(
|
||||
&pdu_id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue