Forgot preferredUsername property

This commit is contained in:
Marius Orcsik 2019-12-19 19:54:33 +01:00
parent ed094c68d6
commit 147cc84d20
No known key found for this signature in database
GPG key ID: 889CE8E4FB2D877A

View file

@ -215,13 +215,13 @@ func (p PublicKey) MarshalJSON() ([]byte, error) {
notEmpty := true
write(&b, '{')
if v, err := p.ID.MarshalJSON(); err == nil && len(v) > 0 {
notEmpty = !writeProp(&b, "id", v)
notEmpty = !writeProp(&b, "id", v)
}
if p.Owner != nil {
notEmpty = writeIRIProp(&b, "owner", p.Owner) || notEmpty
notEmpty = writeIRIProp(&b, "owner", p.Owner) || notEmpty
}
if len(p.PublicKeyPem) > 0 {
notEmpty = writeIRIProp(&b, "publicKeyPem", p.Owner) || notEmpty
notEmpty = writeIRIProp(&b, "publicKeyPem", p.Owner) || notEmpty
}
if notEmpty {
@ -392,34 +392,37 @@ func (a Actor) MarshalJSON() ([]byte, error) {
write(&b, '{')
OnObject(a, func(o *Object) error {
notEmpty = writeObject(&b, *o)
notEmpty = writeObject(&b, *o)
return nil
})
if a.Inbox != nil {
notEmpty = writeItemProp(&b, "inbox", a.Inbox) || notEmpty
notEmpty = writeItemProp(&b, "inbox", a.Inbox) || notEmpty
}
if a.Outbox != nil {
notEmpty = writeItemProp(&b, "outbox", a.Outbox) || notEmpty
notEmpty = writeItemProp(&b, "outbox", a.Outbox) || notEmpty
}
if a.Following != nil {
notEmpty = writeItemProp(&b, "following", a.Following) || notEmpty
notEmpty = writeItemProp(&b, "following", a.Following) || notEmpty
}
if a.Followers != nil {
notEmpty = writeItemProp(&b, "followers", a.Followers) || notEmpty
notEmpty = writeItemProp(&b, "followers", a.Followers) || notEmpty
}
if a.Liked != nil {
notEmpty = writeItemProp(&b, "liked", a.Liked) || notEmpty
notEmpty = writeItemProp(&b, "liked", a.Liked) || notEmpty
}
if a.PreferredUsername != nil {
notEmpty = writeNaturalLanguageProp(&b, "preferredUsername", a.PreferredUsername) || notEmpty
}
if a.Endpoints != nil {
if v, err := a.Endpoints.MarshalJSON(); err == nil && len(v) > 0 {
notEmpty = writeProp(&b, "endpoints", v) || notEmpty
notEmpty = writeProp(&b, "endpoints", v) || notEmpty
}
}
if len(a.Streams) > 0 {
writePropName(&b, "streams")
writePropName(&b, "streams")
lNotEmpty := true
for _, ss := range a.Streams {
lNotEmpty = writeItemCollection(&b, ss) || lNotEmpty
lNotEmpty = writeItemCollection(&b, ss) || lNotEmpty
}
notEmpty = lNotEmpty || notEmpty
}
@ -476,22 +479,22 @@ func (e Endpoints) MarshalJSON() ([]byte, error) {
write(&b, '{')
if e.OauthAuthorizationEndpoint != nil {
notEmpty = writeItemProp(&b, "oauthAuthorizationEndpoint", e.OauthAuthorizationEndpoint) || notEmpty
notEmpty = writeItemProp(&b, "oauthAuthorizationEndpoint", e.OauthAuthorizationEndpoint) || notEmpty
}
if e.OauthTokenEndpoint != nil {
notEmpty = writeItemProp(&b, "oauthTokenEndpoint", e.OauthTokenEndpoint) || notEmpty
notEmpty = writeItemProp(&b, "oauthTokenEndpoint", e.OauthTokenEndpoint) || notEmpty
}
if e.ProvideClientKey != nil {
notEmpty = writeItemProp(&b, "provideClientKey", e.ProvideClientKey) || notEmpty
notEmpty = writeItemProp(&b, "provideClientKey", e.ProvideClientKey) || notEmpty
}
if e.SignClientKey != nil {
notEmpty = writeItemProp(&b, "signClientKey", e.SignClientKey) || notEmpty
notEmpty = writeItemProp(&b, "signClientKey", e.SignClientKey) || notEmpty
}
if e.SharedInbox != nil {
notEmpty = writeItemProp(&b, "sharedInbox", e.SharedInbox) || notEmpty
notEmpty = writeItemProp(&b, "sharedInbox", e.SharedInbox) || notEmpty
}
if e.UploadMedia != nil {
notEmpty = writeItemProp(&b, "uploadMedia", e.UploadMedia) || notEmpty
notEmpty = writeItemProp(&b, "uploadMedia", e.UploadMedia) || notEmpty
}
if notEmpty {
write(&b, '}')