Skip to content
Merged
1 change: 1 addition & 0 deletions changelog.d/18898.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix error trying to send redaction events using the `/send` API in room versions prior to v11. Contributed by @SpiritCroc @ Beeper.
9 changes: 8 additions & 1 deletion synapse/handlers/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,14 @@ async def create_and_send_nonmember_event(
if room_version.updated_redaction_rules:
redacts = event_dict["content"].get("redacts")
else:
redacts = event_dict.get("redacts")
# Legacy room versions need the "redacts" field outside of the event's
# content. However clients may still send it within the content, so copy
# the field if necessary for compatibility.
redacts = event_dict.get("redacts") or event_dict["content"].get(
"redacts"
)
if redacts and "redacts" not in event_dict:
event_dict["redacts"] = redacts

is_admin_redaction = await self.is_admin_redaction(
event_type=event_dict["type"],
Expand Down
Loading