summary refs log tree commit diff
path: root/synapse/handlers/message.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-09-11 10:46:38 +0100
committerErik Johnston <erik@matrix.org>2019-09-11 10:46:38 +0100
commit54ce81c86d163b883df67b97540426759a9f6363 (patch)
treeceedd9e9bf3f685789a0bbdf950aa359429cfbac /synapse/handlers/message.py
parentMerge pull request #6011 from matrix-org/anoa/fix_3pid_validation (diff)
downloadsynapse-54ce81c86d163b883df67b97540426759a9f6363.tar.xz
Allow use of different ratelimits for admin redactions.
This is useful to allow room admins to quickly deal with a large number
of abusive messages.
Diffstat (limited to 'synapse/handlers/message.py')
-rw-r--r--synapse/handlers/message.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py
index 111f7c7e2f..184170ef8b 100644
--- a/synapse/handlers/message.py
+++ b/synapse/handlers/message.py
@@ -729,7 +729,13 @@ class EventCreationHandler(object):
         assert not self.config.worker_app
 
         if ratelimit:
-            yield self.base_handler.ratelimit(requester)
+            is_admin_redaction = (
+                event.type == EventTypes.Redaction
+                and event.sender != requester.user.to_string()
+            )
+            yield self.base_handler.ratelimit(
+                requester, is_admin_redaction=is_admin_redaction
+            )
 
         yield self.base_handler.maybe_kick_guest_users(event, context)