mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-02-28 05:43:01 +00:00
Properly cut out join and leave events
This commit is contained in:
parent
810dd7842c
commit
9e4fd0157f
1 changed files with 5 additions and 4 deletions
|
@ -991,7 +991,7 @@ func (d *Database) getLeaveResponseForCompleteSync(
|
|||
}
|
||||
break
|
||||
} else if membership == gomatrixserverlib.Leave {
|
||||
leaveEventIndex = i - 1
|
||||
leaveEventIndex = i
|
||||
}
|
||||
|
||||
if joinEventIndex != -1 && leaveEventIndex != -1 {
|
||||
|
@ -999,11 +999,12 @@ func (d *Database) getLeaveResponseForCompleteSync(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We can assume that if the person joined, they also left and will only show the events between (inclusive)
|
||||
if joinEventIndex != -1 && leaveEventIndex != -1 {
|
||||
// cut all events earlier than the join (but not the join itself)
|
||||
// and cut all events after the person left
|
||||
recentStreamEvents = recentStreamEvents[joinEventIndex:leaveEventIndex]
|
||||
// cut all events earlier the join (exclude the join itself too)
|
||||
// and cut all events after the person left (exclude the leave itself too)
|
||||
recentStreamEvents = recentStreamEvents[joinEventIndex+1 : leaveEventIndex]
|
||||
limited = false // so clients know not to try to backpaginate
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue