Skip to content
Snippets Groups Projects
Unverified Commit 787af4a1 authored by Richard van der Hoff's avatar Richard van der Hoff Committed by GitHub
Browse files

Host `cache_joined_hosts_for_event` to caller (#10986)

`_check_event_auth` is only called in two places, and only one of those sets
`send_on_behalf_of`. Warming the cache isn't really part of auth anyway, so
moving it out makes a lot more sense.
parent d099535d
No related branches found
No related tags found
No related merge requests found
Clean up some of the federation event authentication code for clarity.
......@@ -356,6 +356,11 @@ class FederationEventHandler:
)
# all looks good, we can persist the event.
# First, precalculate the joined hosts so that the federation sender doesn't
# need to.
await self._event_creation_handler.cache_joined_hosts_for_event(event, context)
await self._run_push_actions_and_persist_event(event, context)
return event, context
......@@ -1299,17 +1304,10 @@ class FederationEventHandler:
except AuthError as e:
logger.warning("Failed auth resolution for %r because %s", event, e)
context.rejected = RejectedReason.AUTH_ERROR
return context
if not context.rejected:
await self._check_for_soft_fail(event, state, backfilled, origin=origin)
await self._maybe_kick_guest_users(event)
# If we are going to send this event over federation we precaclculate
# the joined hosts.
if event.internal_metadata.get_send_on_behalf_of():
await self._event_creation_handler.cache_joined_hosts_for_event(
event, context
)
await self._check_for_soft_fail(event, state, backfilled, origin=origin)
await self._maybe_kick_guest_users(event)
return context
......
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