diff --git a/syncapi/sync/requestpool.go b/syncapi/sync/requestpool.go index 8c65d5637..69efd8aa8 100644 --- a/syncapi/sync/requestpool.go +++ b/syncapi/sync/requestpool.go @@ -15,8 +15,6 @@ package sync import ( - "encoding/json" - "fmt" "net/http" "time" @@ -126,10 +124,6 @@ func (rp *RequestPool) OnIncomingSyncRequest(req *http.Request, device *authtype if !syncData.IsEmpty() || hasTimedOut { logger.WithField("next", syncData.NextBatch).WithField("timed_out", hasTimedOut).Info("Responding") - - j, _ := json.MarshalIndent(syncData, "", " ") - fmt.Println(string(j)) - return util.JSONResponse{ Code: http.StatusOK, JSON: syncData, diff --git a/syncapi/types/types.go b/syncapi/types/types.go index dd2147175..1797b63a0 100644 --- a/syncapi/types/types.go +++ b/syncapi/types/types.go @@ -247,20 +247,19 @@ func NewJoinResponse() *JoinResponse { // InviteResponse represents a /sync response for a room which is under the 'invite' key. type InviteResponse struct { InviteState struct { - Events json.RawMessage `json:"events,omitempty"` - } `json:"invite_state,omitempty"` + Events []json.RawMessage `json:"events"` + } `json:"invite_state"` } // NewInviteResponse creates an empty response with initialised arrays. func NewInviteResponse(ev gomatrixserverlib.HeaderedEvent) *InviteResponse { res := InviteResponse{} + res.InviteState.Events = []json.RawMessage{} var unsigned struct { - InviteRoomState json.RawMessage `json:"invite_room_state"` + InviteRoomState []json.RawMessage `json:"invite_room_state"` } if err := json.Unmarshal(ev.Unsigned(), &unsigned); err == nil { - if len(unsigned.InviteRoomState) > 0 { - res.InviteState.Events = unsigned.InviteRoomState - } + res.InviteState.Events = append(res.InviteState.Events, unsigned.InviteRoomState...) } return &res }