mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-01 13:52:46 +00:00
Send-to-device/sync tweaks (#2630)
* Always delete send to device messages * Omit empty to_device * Tweak /sync response to omit empty values
This commit is contained in:
parent
03ddd98f5e
commit
e930959e49
3 changed files with 29 additions and 29 deletions
|
@ -39,21 +39,13 @@ func (p *SendToDeviceStreamProvider) IncrementalSync(
|
|||
return from
|
||||
}
|
||||
|
||||
if len(events) > 0 {
|
||||
// Clean up old send-to-device messages from before this stream position.
|
||||
if err := p.DB.CleanSendToDeviceUpdates(req.Context, req.Device.UserID, req.Device.ID, from); err != nil {
|
||||
req.Log.WithError(err).Error("p.DB.CleanSendToDeviceUpdates failed")
|
||||
return from
|
||||
}
|
||||
|
||||
// Add the updates into the sync response.
|
||||
for _, event := range events {
|
||||
// skip ignored user events
|
||||
if _, ok := req.IgnoredUsers.List[event.Sender]; ok {
|
||||
continue
|
||||
}
|
||||
req.Response.ToDevice.Events = append(req.Response.ToDevice.Events, event.SendToDeviceEvent)
|
||||
// Add the updates into the sync response.
|
||||
for _, event := range events {
|
||||
// skip ignored user events
|
||||
if _, ok := req.IgnoredUsers.List[event.Sender]; ok {
|
||||
continue
|
||||
}
|
||||
req.Response.ToDevice.Events = append(req.Response.ToDevice.Events, event.SendToDeviceEvent)
|
||||
}
|
||||
|
||||
return lastPos
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue