mirror of
https://gitlab.com/famedly/conduit.git
synced 2025-01-19 04:30:10 +00:00
Move "redacts" key to "content" in redaction events in v11 rooms
This commit is contained in:
parent
d39d30008a
commit
a3b8eea9b4
@ -404,9 +404,38 @@ impl Service {
|
|||||||
|
|
||||||
match pdu.kind {
|
match pdu.kind {
|
||||||
TimelineEventType::RoomRedaction => {
|
TimelineEventType::RoomRedaction => {
|
||||||
if let Some(redact_id) = &pdu.redacts {
|
let room_version_id = self
|
||||||
self.redact_pdu(redact_id, pdu)?;
|
.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 => {
|
TimelineEventType::SpaceChild => {
|
||||||
if let Some(_state_key) = &pdu.state_key {
|
if let Some(_state_key) = &pdu.state_key {
|
||||||
|
Loading…
Reference in New Issue
Block a user