mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-28 01:03:10 -06:00
NOTSPEC: Re-add iOS end of topology
This commit is contained in:
parent
1fe673e11d
commit
75291c6f4e
|
|
@ -390,16 +390,21 @@ func (r *messagesReq) filterHistoryVisible(events []*gomatrixserverlib.HeaderedE
|
||||||
func (r *messagesReq) getStartEnd(events []*gomatrixserverlib.HeaderedEvent) (start, end types.TopologyToken, err error) {
|
func (r *messagesReq) getStartEnd(events []*gomatrixserverlib.HeaderedEvent) (start, end types.TopologyToken, err error) {
|
||||||
if r.backwardOrdering {
|
if r.backwardOrdering {
|
||||||
start = *r.from
|
start = *r.from
|
||||||
|
if events[len(events)-1].Type() == gomatrixserverlib.MRoomCreate {
|
||||||
|
// NOTSPEC: We've hit the beginning of the room so there's really nowhere
|
||||||
|
// else to go. This seems to fix Riot iOS from looping on /messages endlessly.
|
||||||
|
end = types.TopologyToken{}
|
||||||
|
} else {
|
||||||
end, err = r.db.EventPositionInTopology(
|
end, err = r.db.EventPositionInTopology(
|
||||||
r.ctx, events[0].EventID(),
|
r.ctx, events[0].EventID(),
|
||||||
)
|
)
|
||||||
|
|
||||||
// A stream/topological position is a cursor located between two events.
|
// A stream/topological position is a cursor located between two events.
|
||||||
// While they are identified in the code by the event on their right (if
|
// While they are identified in the code by the event on their right (if
|
||||||
// we consider a left to right chronological order), tokens need to refer
|
// we consider a left to right chronological order), tokens need to refer
|
||||||
// to them by the event on their left, therefore we need to decrement the
|
// to them by the event on their left, therefore we need to decrement the
|
||||||
// end position we send in the response if we're going backward.
|
// end position we send in the response if we're going backward.
|
||||||
end.Decrement()
|
end.Decrement()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
start = *r.from
|
start = *r.from
|
||||||
end, err = r.db.EventPositionInTopology(
|
end, err = r.db.EventPositionInTopology(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue