summary refs log tree commit diff
path: root/synapse/handlers
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/handlers
parentReduce device lists replication traffic. (#17333) (diff)
downloadsynapse-7a11c0ac4fd3bab42d6edb17593c9d7ed8371001.tar.xz
Add support for MSC3823 - Account Suspension Part 2 (#17255)
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/message.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py
index 16d01efc67..5aa48230ec 100644
--- a/synapse/handlers/message.py
+++ b/synapse/handlers/message.py
@@ -642,6 +642,17 @@ class EventCreationHandler:
         """
         await self.auth_blocking.check_auth_blocking(requester=requester)
 
+        if event_dict["type"] == EventTypes.Message:
+            requester_suspended = await self.store.get_user_suspended_status(
+                requester.user.to_string()
+            )
+            if requester_suspended:
+                raise SynapseError(
+                    403,
+                    "Sending messages while account is suspended is not allowed.",
+                    Codes.USER_ACCOUNT_SUSPENDED,
+                )
+
         if event_dict["type"] == EventTypes.Create and event_dict["state_key"] == "":
             room_version_id = event_dict["content"]["room_version"]
             maybe_room_version_obj = KNOWN_ROOM_VERSIONS.get(room_version_id)