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

Commit a383907

Browse files
committedDec 8, 2022
Revert "Don't return end from /messages if there are no more events (matrix-org#12903)"
This reverts commit c4f548e. This is because Tchap clients currently rely on this bug for message pagination.
1 parent 677e258 commit a383907

File tree

1 file changed

+10
-21
lines changed

1 file changed

+10
-21
lines changed
 

Diff for: ‎synapse/handlers/pagination.py

+10-21
Original file line numberDiff line numberDiff line change
@@ -526,29 +526,18 @@ async def get_messages(
526526

527527
next_token = from_token.copy_and_replace(StreamKeyType.ROOM, next_key)
528528

529-
# if no events are returned from pagination, that implies
530-
# we have reached the end of the available events.
531-
# In that case we do not return end, to tell the client
532-
# there is no need for further queries.
533-
if not events:
534-
return {
535-
"chunk": [],
536-
"start": await from_token.to_string(self.store),
537-
}
529+
if events:
530+
if event_filter:
531+
events = await event_filter.filter(events)
538532

539-
if event_filter:
540-
events = await event_filter.filter(events)
541-
542-
if not use_admin_priviledge:
543-
events = await filter_events_for_client(
544-
self._storage_controllers,
545-
user_id,
546-
events,
547-
is_peeking=(member_event_id is None),
548-
)
533+
if not use_admin_priviledge:
534+
events = await filter_events_for_client(
535+
self._storage_controllers,
536+
user_id,
537+
events,
538+
is_peeking=(member_event_id is None),
539+
)
549540

550-
# if after the filter applied there are no more events
551-
# return immediately - but there might be more in next_token batch
552541
if not events:
553542
return {
554543
"chunk": [],

0 commit comments

Comments
 (0)
This repository has been archived.