Implement MarshallJSON for Star activity

This commit is contained in:
bom 2023-11-10 16:08:15 +01:00 committed by Michael Jerger
parent a1885a5767
commit 43014ca473
2 changed files with 16 additions and 11 deletions

View file

@ -52,3 +52,15 @@ func StarNew(id ap.ID, ob ap.ID) *Star {
func AddStar(ctx *context.APIContext) {
}
func (a Star) MarshalJSON() ([]byte, error) {
b := make([]byte, 0)
ap.JSONWrite(&b, '{')
ap.JSONWriteStringProp(&b, "source", string(a.Source))
if !ap.JSONWriteActivityValue(&b, a.Activity) {
return nil, nil
}
ap.JSONWrite(&b, '}')
return b, nil
}