summary refs log tree commit diff
path: root/synapse/rest/client/room.py
diff options
context:
space:
mode:
authorShay <hillerys@element.io>2024-06-24 06:21:22 -0700
committerGitHub <noreply@github.com>2024-06-24 14:21:22 +0100
commit7a11c0ac4fd3bab42d6edb17593c9d7ed8371001 (patch)
tree379871363c060013772bb212ed24000ad06b958a /synapse/rest/client/room.py
parentReduce device lists replication traffic. (#17333) (diff)
downloadsynapse-7a11c0ac4fd3bab42d6edb17593c9d7ed8371001.tar.xz
Add support for MSC3823 - Account Suspension Part 2 (#17255)
Diffstat (limited to 'synapse/rest/client/room.py')
-rw-r--r--synapse/rest/client/room.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/synapse/rest/client/room.py b/synapse/rest/client/room.py

index bd65cf4b83..903c74f6d8 100644 --- a/synapse/rest/client/room.py +++ b/synapse/rest/client/room.py
@@ -1120,6 +1120,20 @@ class RoomRedactEventRestServlet(TransactionRestServlet): ) -> Tuple[int, JsonDict]: content = parse_json_object_from_request(request) + requester_suspended = await self._store.get_user_suspended_status( + requester.user.to_string() + ) + + if requester_suspended: + event = await self._store.get_event(event_id, allow_none=True) + if event: + if event.sender != requester.user.to_string(): + raise SynapseError( + 403, + "You can only redact your own events while account is suspended.", + Codes.USER_ACCOUNT_SUSPENDED, + ) + # Ensure the redacts property in the content matches the one provided in # the URL. room_version = await self._store.get_room_version(room_id)