From d1e2ae9598bf7538cdab0902b3c509d18a6f9bbf Mon Sep 17 00:00:00 2001 From: Marius Orcsik Date: Sun, 23 Dec 2018 17:09:48 +0100 Subject: [PATCH] Added icon and image properties to object unmarshalling --- activitystreams/object.go | 2 ++ activitystreams/object_test.go | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/activitystreams/object.go b/activitystreams/object.go index 12a2014..9159a89 100644 --- a/activitystreams/object.go +++ b/activitystreams/object.go @@ -541,6 +541,8 @@ func (o *Object) UnmarshalJSON(data []byte) error { o.InReplyTo = getAPItem(data, "inReplyTo") o.Published = getAPTime(data, "published") o.StartTime = getAPTime(data, "startTime") + o.Icon = getAPItem(data, "icon") + o.Image = getAPItem(data, "image") o.Updated = getAPTime(data, "updated") to := getAPItems(data, "to") if to != nil { diff --git a/activitystreams/object_test.go b/activitystreams/object_test.go index 0855d05..ed9d038 100644 --- a/activitystreams/object_test.go +++ b/activitystreams/object_test.go @@ -330,6 +330,12 @@ func validateEmptyObject(o Object, t *testing.T) { if o.URL != nil { t.Errorf("Unmarshalled object %T should have empty URL, received %v", o, o.URL) } + if o.Icon != nil { + t.Errorf("Unmarshalled object %T should have empty Icon, received %v", o, o.Icon) + } + if o.Image != nil { + t.Errorf("Unmarshalled object %T should have empty Image, received %v", o, o.Image) + } if !o.Published.IsZero() { t.Errorf("Unmarshalled object %T should have empty Published, received %q", o, o.Published) }