diff options
author | H. Shay <hillerys@element.io> | 2022-11-08 11:44:36 -0800 |
---|---|---|
committer | H. Shay <hillerys@element.io> | 2022-11-08 11:44:36 -0800 |
commit | 9602493c13eb1abbeeb702cbe3ed14b3a737eea6 (patch) | |
tree | 1f40f3c2743653318ff18138459a0bad937e828b /synapse/handlers/room.py | |
parent | lint (diff) | |
parent | Merge branch 'develop' into shay/batch_state_groups (diff) | |
download | synapse-9602493c13eb1abbeeb702cbe3ed14b3a737eea6.tar.xz |
Merge branch 'shay/batch_state_groups' of https://github.com/matrix-org/synapse into shay/batch_state_groups
Diffstat (limited to 'synapse/handlers/room.py')
-rw-r--r-- | synapse/handlers/room.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py index 984f4ad5af..7e6d6490aa 100644 --- a/synapse/handlers/room.py +++ b/synapse/handlers/room.py @@ -1077,6 +1077,19 @@ class RoomCreationHandler: for_batch: bool, **kwargs: Any, ) -> Tuple[EventBase, synapse.events.snapshot.EventContext]: + """ + Creates an event and associated event context. + Args: + etype: the type of event to be created + content: content of the event + for_batch: whether the event is being created for batch persisting. If + bool for_batch is true, this will create an event using the prev_event_ids, + and will create an event context for the event using the parameters state_map + and current_state_group, thus these parameters must be provided in this + case if for_batch is True. The subsequently created event and context + are suitable for being batched up and bulk persisted to the database + with other similarly created events. + """ nonlocal depth nonlocal prev_event @@ -1141,6 +1154,14 @@ class RoomCreationHandler: ) current_state_group = event_to_state_group[member_event_id] + # we need the state group of the membership event as it is the current state group + event_to_state = ( + await self._storage_controllers.state.get_state_group_for_events( + [member_event_id] + ) + ) + current_state_group = event_to_state[member_event_id] + events_to_send = [] # We treat the power levels override specially as this needs to be one # of the first events that get sent into a room. |