mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-07 15:03:09 -06:00
Move "redacts" to "content.redacts"
This commit is contained in:
parent
db83789654
commit
9172814e1e
|
|
@ -141,6 +141,18 @@ func ToClientEvent(se gomatrixserverlib.PDU, format ClientEventFormat, userIDFor
|
||||||
Redacts: se.Redacts(),
|
Redacts: se.Redacts(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RoomVersion V11 moved the "redacts" field to "content", so add it there as well
|
||||||
|
// For compatibility with older clients, we keep the "redacts" top-level field.
|
||||||
|
// TODO: At which point do we remove "redacts" from the top-level?
|
||||||
|
if se.Type() == spec.MRoomRedaction && se.Version() == gomatrixserverlib.RoomVersionV11 && ce.Redacts != "" {
|
||||||
|
v11content, err := sjson.SetBytes(ce.Content, "content.redacts", ce.Redacts)
|
||||||
|
if err != nil {
|
||||||
|
logrus.WithError(err).Warn("failed to set content.redacts")
|
||||||
|
} else {
|
||||||
|
ce.Content = v11content
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch format {
|
switch format {
|
||||||
case FormatAll:
|
case FormatAll:
|
||||||
ce.RoomID = se.RoomID().String()
|
ce.RoomID = se.RoomID().String()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue