Skip to content

Commit

Permalink
Add omitempty to all power level fields
Browse files Browse the repository at this point in the history
Users and events shouldn't be omitted, but in this case empty means
null, which is not valid either.
  • Loading branch information
tulir committed Dec 30, 2021
1 parent c1b2329 commit bd6990e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions event/powerlevels.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`

Expand Down

0 comments on commit bd6990e

Please sign in to comment.