mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-17 03:43:11 -06:00
Really don't send nulls for invite state
This commit is contained in:
parent
8d86aa93a8
commit
fa618e76b6
|
|
@ -254,13 +254,15 @@ type InviteResponse struct {
|
||||||
// NewInviteResponse creates an empty response with initialised arrays.
|
// NewInviteResponse creates an empty response with initialised arrays.
|
||||||
func NewInviteResponse(ev gomatrixserverlib.HeaderedEvent) *InviteResponse {
|
func NewInviteResponse(ev gomatrixserverlib.HeaderedEvent) *InviteResponse {
|
||||||
res := InviteResponse{}
|
res := InviteResponse{}
|
||||||
res.InviteState.Events = json.RawMessage{'[', ']'}
|
|
||||||
var unsigned struct {
|
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 err := json.Unmarshal(ev.Unsigned(), &unsigned); err == nil {
|
||||||
res.InviteState.Events = unsigned.InviteRoomState
|
res.InviteState.Events = unsigned.InviteRoomState
|
||||||
}
|
}
|
||||||
|
if res.InviteState.Events == nil {
|
||||||
|
res.InviteState.Events = json.RawMessage{'[', ']'}
|
||||||
|
}
|
||||||
return &res
|
return &res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue