This commit is contained in:
Neil Alexander 2021-01-13 10:24:11 +00:00
parent be9ee18233
commit 0231199cc8
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
2 changed files with 45 additions and 63 deletions

View file

@ -74,6 +74,10 @@ func newSyncRequest(req *http.Request, device userapi.Device, syncDB storage.Dat
if f != nil {
filter = *f
}
limit := filter.Room.Timeline.Limit
if limit == 0 {
limit = DefaultTimelineLimit
}
// TODO: Additional query params: set_presence, filter
logger := util.GetLogger(req.Context()).WithFields(logrus.Fields{
@ -81,20 +85,20 @@ func newSyncRequest(req *http.Request, device userapi.Device, syncDB storage.Dat
"device_id": device.ID,
"since": since,
"timeout": timeout,
"limit": filter.Room.Timeline.Limit,
"limit": limit,
})
return &types.SyncRequest{
Context: req.Context(), //
Log: logger, //
Device: &device, //
Response: types.NewResponse(), // Populated by all streams
Filter: filter, //
Since: since, //
Timeout: timeout, //
Limit: filter.Room.Timeline.Limit, //
Rooms: make(map[string]string), // Populated by the PDU stream
WantFullState: wantFullState, //
Context: req.Context(), //
Log: logger, //
Device: &device, //
Response: types.NewResponse(), // Populated by all streams
Filter: filter, //
Since: since, //
Timeout: timeout, //
Limit: limit, //
Rooms: make(map[string]string), // Populated by the PDU stream
WantFullState: wantFullState, //
}, nil
}