diff options
author | Shay <hillerys@element.io> | 2022-05-20 01:54:12 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-20 09:54:12 +0100 |
commit | 71e8afe34d2103c5ccc9f2d1c99587d14b2acc56 (patch) | |
tree | 38ca83b911323cd5312165467e2b8bf077987d2a /synapse/handlers/message.py | |
parent | Fix `RetryDestinationLimiter` re-starting finished log contexts (#12803) (diff) | |
download | synapse-71e8afe34d2103c5ccc9f2d1c99587d14b2acc56.tar.xz |
Update EventContext `get_current_event_ids` and `get_prev_event_ids` to accept state filters and update calls where possible (#12791)
Diffstat (limited to 'synapse/handlers/message.py')
-rw-r--r-- | synapse/handlers/message.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py index 0951b9c71f..e566ff1f8e 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py @@ -634,7 +634,9 @@ class EventCreationHandler: # federation as well as those created locally. As of room v3, aliases events # can be created by users that are not in the room, therefore we have to # tolerate them in event_auth.check(). - prev_state_ids = await context.get_prev_state_ids() + prev_state_ids = await context.get_prev_state_ids( + StateFilter.from_types([(EventTypes.Member, None)]) + ) prev_event_id = prev_state_ids.get((EventTypes.Member, event.sender)) prev_event = ( await self.store.get_event(prev_event_id, allow_none=True) @@ -761,7 +763,9 @@ class EventCreationHandler: # This can happen due to out of band memberships return None - prev_state_ids = await context.get_prev_state_ids() + prev_state_ids = await context.get_prev_state_ids( + StateFilter.from_types([(event.type, None)]) + ) prev_event_id = prev_state_ids.get((event.type, event.state_key)) if not prev_event_id: return None @@ -1547,7 +1551,11 @@ class EventCreationHandler: "Redacting MSC2716 events is not supported in this room version", ) - prev_state_ids = await context.get_prev_state_ids() + event_types = event_auth.auth_types_for_event(event.room_version, event) + prev_state_ids = await context.get_prev_state_ids( + StateFilter.from_types(event_types) + ) + auth_events_ids = self._event_auth_handler.compute_auth_events( event, prev_state_ids, for_verification=True ) |