Fix computation of next public rooms batch

This commit is contained in:
Brendan Abolivier 2017-08-16 17:29:18 +01:00
parent 90ea505dbe
commit 1cdea0fd02
No known key found for this signature in database
GPG key ID: 8EF1500759F70623

View file

@ -70,8 +70,9 @@ func GetPublicRooms(
if offset > 0 {
response.PrevBatch = strconv.Itoa(int(offset) - 1)
}
if response.Estimate > int64(limit) {
response.NextBatch = strconv.Itoa(int(offset) + int(limit))
nextIndex := int(offset) + int(limit)
if response.Estimate > int64(nextIndex) {
response.NextBatch = strconv.Itoa(nextIndex)
}
if response.Chunk, err = publicRoomDatabase.GetPublicRooms(offset, limit, request.Filter.SearchTerms); err != nil {