-
Notifications
You must be signed in to change notification settings - Fork 743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix back pagination conduit #5168
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Back pagination not working on conduit |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,14 +67,25 @@ internal class TokenChunkEventPersistor @Inject constructor( | |
.awaitTransaction { realm -> | ||
Timber.v("Start persisting ${receivedChunk.events.size} events in $roomId towards $direction") | ||
|
||
/** | ||
* As per spec | ||
* if no further events are available (either because we have reached the start of the timeline, | ||
* or because the user does not have permission to see any more events), the end property is omitted from the response. | ||
* Synapse is not omitting it and EA was relying on it | ||
*/ | ||
val chunkEnd = if (receivedChunk.events.isEmpty()) { | ||
receivedChunk.start | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ReceivedChunk.start should be the same as the from param, so we will be blocked too, no? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the 'start' is set but 'end' is unset (=null?). Probably chunkEnd=null causes these problems in Element Android |
||
} else { | ||
receivedChunk.end | ||
} | ||
val nextToken: String? | ||
val prevToken: String? | ||
if (direction == PaginationDirection.FORWARDS) { | ||
nextToken = receivedChunk.end | ||
nextToken = chunkEnd | ||
prevToken = receivedChunk.start | ||
} else { | ||
nextToken = receivedChunk.start | ||
prevToken = receivedChunk.end | ||
prevToken = chunkEnd | ||
} | ||
|
||
val existingChunk = ChunkEntity.find(realm, roomId, prevToken = prevToken, nextToken = nextToken) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking events.is_empty is wrong here. There may be events, but if those are the 'last' events in the room, 'end' will not be set.