Move "redacts" key to "content" in redaction events in v11 rooms
This commit is contained in:
parent
d39d30008a
commit
a3b8eea9b4
1 changed files with 32 additions and 3 deletions
|
@ -404,9 +404,38 @@ impl Service {
|
|||
|
||||
match pdu.kind {
|
||||
TimelineEventType::RoomRedaction => {
|
||||
if let Some(redact_id) = &pdu.redacts {
|
||||
self.redact_pdu(redact_id, pdu)?;
|
||||
}
|
||||
let room_version_id = self
|
||||
.get_room_version(&pdu.room_id)?
|
||||
.expect("Got RoomRedaction in a room of unknown version");
|
||||
match room_version_id {
|
||||
RoomVersionId::V1
|
||||
| RoomVersionId::V2
|
||||
| RoomVersionId::V3
|
||||
| RoomVersionId::V4
|
||||
| RoomVersionId::V5
|
||||
| RoomVersionId::V6
|
||||
| RoomVersionId::V7
|
||||
| RoomVersionId::V8
|
||||
| RoomVersionId::V9
|
||||
| RoomVersionId::V10 => {
|
||||
if let Some(redact_id) = &pdu.redacts {
|
||||
self.redact_pdu(redact_id, pdu)?;
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
#[derive(Deserialize)]
|
||||
struct Redaction {
|
||||
redacts: Option<OwnedEventId>,
|
||||
}
|
||||
let content = serde_json::from_str::<Redaction>(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)?;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
TimelineEventType::SpaceChild => {
|
||||
if let Some(_state_key) = &pdu.state_key {
|
||||
|
|
Loading…
Add table
Reference in a new issue