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

Commit

Permalink
Revert "Don't return end from /messages if there are no more even…
Browse files Browse the repository at this point in the history
…ts (matrix-org#12903)"

This reverts commit c4f548e.

This is because Tchap clients currently rely on this bug for message
pagination.
  • Loading branch information
babolivier committed Dec 8, 2022
1 parent 677e258 commit a383907
Showing 1 changed file with 10 additions and 21 deletions.
31 changes: 10 additions & 21 deletions synapse/handlers/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,29 +526,18 @@ async def get_messages(

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

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

if event_filter:
events = await event_filter.filter(events)

if not use_admin_priviledge:
events = await filter_events_for_client(
self._storage_controllers,
user_id,
events,
is_peeking=(member_event_id is None),
)
if not use_admin_priviledge:
events = await filter_events_for_client(
self._storage_controllers,
user_id,
events,
is_peeking=(member_event_id is None),
)

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

0 comments on commit a383907

Please sign in to comment.