2 files changed, 12 insertions, 0 deletions
diff --git a/synapse/api/room_versions.py b/synapse/api/room_versions.py
index a747a40814..9e6f26ff0a 100644
--- a/synapse/api/room_versions.py
+++ b/synapse/api/room_versions.py
@@ -81,6 +81,9 @@ class RoomVersion:
msc2716_historical: bool
# MSC2716: Adds support for redacting "insertion", "chunk", and "marker" events
msc2716_redactions: bool
+ # MSC2174: Move the "redacts" key from the top-level of the event to the content
+ # MSC2244: Adds support for a "redacts" array of event IDs in an event's content
+ msc2174_msc2244_redactions: bool
class RoomVersions:
diff --git a/synapse/rest/client/room.py b/synapse/rest/client/room.py
index 90355e44b2..4bb9fea260 100644
--- a/synapse/rest/client/room.py
+++ b/synapse/rest/client/room.py
@@ -875,6 +875,9 @@ class RoomRedactEventRestServlet(TransactionRestServlet):
self.event_creation_handler = hs.get_event_creation_handler()
self.auth = hs.get_auth()
+ # MSC2244 (mass redactions) and MSC2174 (move 'redacts' into event content)
+ self._msc2174_msc2244_enabled = hs.config.experimental.msc2174_msc2244_enabled
+
def register(self, http_server: HttpServer) -> None:
PATTERNS = "/rooms/(?P<room_id>[^/]*)/redact/(?P<event_id>[^/]*)"
register_txn_path(self, PATTERNS, http_server)
@@ -889,6 +892,12 @@ class RoomRedactEventRestServlet(TransactionRestServlet):
requester = await self.auth.get_user_by_req(request)
content = parse_json_object_from_request(request)
+ if self._msc2174_msc2244_enabled:
+ # Include a "redacts" array in the *event content* that contains the
+ # event ID to redact in accordance with MSC2244.
+ # The top-level "redacts" key is kept for backwards compatibility.
+ content["redacts"] = [event_id]
+
try:
(
event,
|