Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 9d60613

Browse files
committed
Add more better comments
1 parent 6d0f561 commit 9d60613

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

synapse/rest/client/v1/room.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,17 +350,18 @@ async def inherit_depth_from_prev_ids(self, prev_event_ids) -> int:
350350
return depth
351351

352352
def _create_insertion_event_dict(self, sender: str, origin_server_ts: int):
353-
"""
354-
Creates an event dict for an "insertion" event with the proper fields
353+
"""Creates an event dict for an "insertion" event with the proper fields
355354
and a random chunk ID.
355+
356356
Args:
357357
sender: The event author MXID
358358
origin_server_ts: Timestamp when the event was sent
359+
359360
Returns:
360361
Tuple of event ID and stream ordering position
361362
"""
362363

363-
next_chunk_id = random_string(64)
364+
next_chunk_id = random_string(8)
364365
insertion_event = {
365366
"type": EventTypes.MSC2716_INSERTION,
366367
"sender": sender,
@@ -481,8 +482,13 @@ async def on_POST(self, request, room_id):
481482
if chunk_id_from_query:
482483
# TODO: Verify the chunk_id_from_query corresponds to an insertion event
483484
pass
484-
# Otherwise, create an insertion event to be based off of and connect
485-
# to as a starting point.
485+
# Otherwise, create an insertion event to act as a starting point.
486+
#
487+
# We don't always have an insertion event to start hanging more history
488+
# off of (ideally there would be one in the main DAG, but that's not the
489+
# case if we're wanting to add history to e.g. existing rooms without
490+
# an insertion event), in which case we just create a new insertion event
491+
# that can then get pointed to by a "marker" event later.
486492
else:
487493
base_insertion_event = self._create_insertion_event_dict(
488494
sender=requester.user.to_string(),

0 commit comments

Comments
 (0)