diff options
author | Till <2353100+S7evinK@users.noreply.github.com> | 2022-08-09 10:40:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-09 10:40:46 +0200 |
commit | e930959e4911453ec51bba0b1469f4b15c594f32 (patch) | |
tree | 6f07656c580df59c927985069d2875f78f9880d5 /syncapi/types/types.go | |
parent | 03ddd98f5e6582f5aacaee643ddd53506ccfec50 (diff) |
Send-to-device/sync tweaks (#2630)
* Always delete send to device messages
* Omit empty to_device
* Tweak /sync response to omit empty values
Diffstat (limited to 'syncapi/types/types.go')
-rw-r--r-- | syncapi/types/types.go | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/syncapi/types/types.go b/syncapi/types/types.go index 159fa08b..39b085d9 100644 --- a/syncapi/types/types.go +++ b/syncapi/types/types.go @@ -21,9 +21,10 @@ import ( "strconv" "strings" - "github.com/matrix-org/dendrite/roomserver/api" "github.com/matrix-org/gomatrixserverlib" "github.com/tidwall/gjson" + + "github.com/matrix-org/dendrite/roomserver/api" ) var ( @@ -330,23 +331,23 @@ type Response struct { NextBatch StreamingToken `json:"next_batch"` AccountData struct { Events []gomatrixserverlib.ClientEvent `json:"events,omitempty"` - } `json:"account_data"` + } `json:"account_data,omitempty"` Presence struct { Events []gomatrixserverlib.ClientEvent `json:"events,omitempty"` - } `json:"presence"` + } `json:"presence,omitempty"` Rooms struct { - Join map[string]JoinResponse `json:"join"` - Peek map[string]JoinResponse `json:"peek"` - Invite map[string]InviteResponse `json:"invite"` - Leave map[string]LeaveResponse `json:"leave"` - } `json:"rooms"` + Join map[string]JoinResponse `json:"join,omitempty"` + Peek map[string]JoinResponse `json:"peek,omitempty"` + Invite map[string]InviteResponse `json:"invite,omitempty"` + Leave map[string]LeaveResponse `json:"leave,omitempty"` + } `json:"rooms,omitempty"` ToDevice struct { - Events []gomatrixserverlib.SendToDeviceEvent `json:"events"` - } `json:"to_device"` + Events []gomatrixserverlib.SendToDeviceEvent `json:"events,omitempty"` + } `json:"to_device,omitempty"` DeviceLists struct { Changed []string `json:"changed,omitempty"` Left []string `json:"left,omitempty"` - } `json:"device_lists"` + } `json:"device_lists,omitempty"` DeviceListsOTKCount map[string]int `json:"device_one_time_keys_count,omitempty"` } |