mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 14:12:47 +00:00
Rudimentary pagination of rooms in the rooms filter
This commit is contained in:
parent
ce112cf21b
commit
10c41a7a18
8 changed files with 185 additions and 13 deletions
|
@ -69,6 +69,18 @@ func newSyncRequest(req *http.Request, device userapi.Device, syncDB storage.Dat
|
|||
}
|
||||
}
|
||||
|
||||
switch req.URL.Query().Get("paginate_by") {
|
||||
case "latest":
|
||||
offset, _ := strconv.Atoi(req.URL.Query().Get("offset"))
|
||||
count, _ := strconv.Atoi(req.URL.Query().Get("count"))
|
||||
rooms, err := syncDB.GetPaginatedRooms(req.Context(), device.UserID, offset, count)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("syncDB.GetPaginatedRooms: %w", err)
|
||||
}
|
||||
filter.Room.Rooms = rooms
|
||||
logrus.Warnf("Filtering by rooms: %v", rooms)
|
||||
}
|
||||
|
||||
logger := util.GetLogger(req.Context()).WithFields(logrus.Fields{
|
||||
"user_id": device.UserID,
|
||||
"device_id": device.ID,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue