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.
This commit is contained in:
Erik Johnston 2019-09-11 10:46:38 +01:00
parent 5e9b05d7da
commit 54ce81c86d
4 changed files with 55 additions and 11 deletions

View file

@ -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)