mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-06 22:43:10 -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(),
|
||||
}
|
||||
|
||||
// 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 {
|
||||
case FormatAll:
|
||||
ce.RoomID = se.RoomID().String()
|
||||
|
|
|
|||
Loading…
Reference in a new issue