Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/18898.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support [MSC4169](https://github.com/matrix-org/matrix-spec-proposals/pull/4169) for backwards-compatible redaction sending using the `/send` endpoint. Contributed by @SpiritCroc @ Beeper.
3 changes: 3 additions & 0 deletions synapse/config/experimental.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,9 @@ def read_config(
# MSC4133: Custom profile fields
self.msc4133_enabled: bool = experimental.get("msc4133_enabled", False)

# MSC4169: Backwards-compatible redaction sending using `/send`
self.msc4169_enabled: bool = experimental.get("msc4169_enabled", False)

# MSC4210: Remove legacy mentions
self.msc4210_enabled: bool = experimental.get("msc4210_enabled", False)

Expand Down
9 changes: 9 additions & 0 deletions synapse/handlers/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,15 @@ async def create_and_send_nonmember_event(

if room_version.updated_redaction_rules:
redacts = event_dict["content"].get("redacts")
elif self.hs.config.experimental.msc4169_enabled:
# 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"].pop(
"redacts", None
)
if redacts and "redacts" not in event_dict:
event_dict["redacts"] = redacts
else:
redacts = event_dict.get("redacts")

Expand Down
2 changes: 2 additions & 0 deletions synapse/rest/client/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ async def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
"uk.tcpip.msc4133": self.config.experimental.msc4133_enabled,
# MSC4155: Invite filtering
"org.matrix.msc4155": self.config.experimental.msc4155_enabled,
# MSC4169: Backwards-compatible redaction sending useing `/send`
"com.beeper.msc4169": self.config.experimental.msc4169_enabled,
},
},
)
Expand Down
Loading