Skip to content
Snippets Groups Projects
Commit c64c3bb4 authored by Erik Johnston's avatar Erik Johnston
Browse files

Fix how we check for self redaction

parent 8df88b5f
No related branches found
No related tags found
No related merge requests found
......@@ -729,10 +729,24 @@ class EventCreationHandler(object):
assert not self.config.worker_app
if ratelimit:
is_admin_redaction = (
event.type == EventTypes.Redaction
and event.sender != requester.user.to_string()
)
# We check if this is a room admin redacting an event so that we
# can apply different ratelimiting. We do this by simply checking
# its 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
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment