aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTill <2353100+S7evinK@users.noreply.github.com>2022-11-04 15:39:09 +0100
committerGitHub <noreply@github.com>2022-11-04 15:39:09 +0100
commitefe28db631bd07240dea53280d8c8f2ecc20684a (patch)
tree669b81c11d5b4a0880e8fd57f3e4ea813332c2ee
parentb13cb43785aa0a392d644ffc4901dc3111616a21 (diff)
Update `latestPosition` when getting reversed room delta (#2860)
Regression test added in https://github.com/matrix-org/complement/pull/551 Should fix https://github.com/matrix-org/dendrite/issues/2514?
-rw-r--r--syncapi/streams/stream_pdu.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/syncapi/streams/stream_pdu.go b/syncapi/streams/stream_pdu.go
index b21be6c5..65ca8e2a 100644
--- a/syncapi/streams/stream_pdu.go
+++ b/syncapi/streams/stream_pdu.go
@@ -264,6 +264,9 @@ func (p *PDUStreamProvider) addRoomDeltaToResponse(
// Work out what the highest stream position is for all of the events in this
// room that were returned.
latestPosition := r.To
+ if r.Backwards {
+ latestPosition = r.From
+ }
updateLatestPosition := func(mostRecentEventID string) {
var pos types.StreamPosition
if _, pos, err = snapshot.PositionInTopology(ctx, mostRecentEventID); err == nil {