summary refs log tree commit diff
path: root/synapse/handlers/message.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2019-09-18 13:55:25 +0100
committerRichard van der Hoff <richard@matrix.org>2019-09-18 13:55:25 +0100
commit7b61e6f5d63d3723b368ad5f126bf89ff460c8c3 (patch)
tree82ec1b50431786edfaf12f6bc22814455b3d9a5e /synapse/handlers/message.py
parentRevert "Fix m.federate bug" (diff)
parentfix sample config (diff)
downloadsynapse-7b61e6f5d63d3723b368ad5f126bf89ff460c8c3.tar.xz
Merge branch 'develop' into matrix-org-hotfixes
Diffstat (limited to 'synapse/handlers/message.py')
-rw-r--r--synapse/handlers/message.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py

index efb1cea579..2650880044 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py
@@ -729,7 +729,27 @@ class EventCreationHandler(object): assert not self.config.worker_app if ratelimit: - yield self.base_handler.ratelimit(requester) + # We check if this is a room admin redacting an event so that we + # can apply different ratelimiting. We do this by simply checking + # it's not a self-redaction (to avoid having to look up whether the + # user is actually admin or not). + is_admin_redaction = False + if event.type == EventTypes.Redaction: + original_event = yield self.store.get_event( + event.redacts, + check_redacted=False, + get_prev_content=False, + allow_rejected=False, + allow_none=True, + ) + + is_admin_redaction = ( + original_event and event.sender != original_event.sender + ) + + yield self.base_handler.ratelimit( + requester, is_admin_redaction=is_admin_redaction + ) yield self.base_handler.maybe_kick_guest_users(event, context)