From bd6990e249040f84605ecd2fb996409c5969173d Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Thu, 30 Dec 2021 12:26:06 +0200 Subject: [PATCH] Add omitempty to all power level fields Users and events shouldn't be omitted, but in this case empty means null, which is not valid either. --- event/powerlevels.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/event/powerlevels.go b/event/powerlevels.go index 3cac9cd7..266591d0 100644 --- a/event/powerlevels.go +++ b/event/powerlevels.go @@ -16,12 +16,12 @@ import ( // https://matrix.org/docs/spec/client_server/r0.6.0#m-room-power-levels type PowerLevelsEventContent struct { usersLock sync.RWMutex `json:"-"` - Users map[id.UserID]int `json:"users"` - UsersDefault int `json:"users_default"` + Users map[id.UserID]int `json:"users,omitempty"` + UsersDefault int `json:"users_default,omitempty"` eventsLock sync.RWMutex `json:"-"` - Events map[string]int `json:"events"` - EventsDefault int `json:"events_default"` + Events map[string]int `json:"events,omitempty"` + EventsDefault int `json:"events_default,omitempty"` StateDefaultPtr *int `json:"state_default,omitempty"`