File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -458,6 +458,13 @@ func _sendAndTestMessageHistory(
458458 firstEventIndex , lastEventIndex ,
459459 )
460460
461+ // Keep paginating until we reach the start of the room (no `end` property is
462+ // returned).
463+ //
464+ // > Note that an empty `chunk` does not necessarily imply that no more events are
465+ // > available. Clients should continue to paginate until no `end` property is returned.
466+ // >
467+ // > https://spec.matrix.org/v1.16/client-server-api/#get_matrixclientv3roomsroomidmessages
461468 endTokenRes := gjson .GetBytes (messagesResBody , "end" )
462469 // "`end`: If no further events are available (either because we have reached the
463470 // start of the timeline, or because the user does not have permission to see
@@ -466,12 +473,6 @@ func _sendAndTestMessageHistory(
466473 break
467474 }
468475 fromToken = endTokenRes .Str
469-
470- // Or if we don't see any more events, we will assume that we reached the
471- // start of the room. No more to paginate.
472- if len (actualEventIDsFromRequest ) == 0 {
473- break
474- }
475476 }
476477
477478 // Put them in chronological order to match the expected list
You can’t perform that action at this time.
0 commit comments