Fix parsing @context property

Previously this would fail if the @context property also contained
something other than a string, like Mastodon does.
This commit is contained in:
Matt Baer
2018-08-03 00:21:06 +02:00
parent 2b398e3b5a
commit 50824cd75a
3 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ type Activity struct {
func NewCreateActivity(o *Object) *Activity {
a := Activity{
BaseObject: BaseObject{
Context: []string{
Context: []interface{}{
"https://www.w3.org/ns/activitystreams",
},
ID: o.ID + "/activity",
+3 -3
View File
@@ -4,7 +4,7 @@ import "fmt"
type (
BaseObject struct {
Context []string `json:"@context,omitempty"`
Context []interface{} `json:"@context,omitempty"`
Type string `json:"type"`
ID string `json:"id"`
}
@@ -33,7 +33,7 @@ type OrderedCollection struct {
func NewOrderedCollection(accountRoot, collType string, items int) *OrderedCollection {
oc := OrderedCollection{
BaseObject: BaseObject{
Context: []string{
Context: []interface{}{
"https://www.w3.org/ns/activitystreams",
},
ID: accountRoot + "/" + collType,
@@ -57,7 +57,7 @@ type OrderedCollectionPage struct {
func NewOrderedCollectionPage(accountRoot, collType string, items, page int) *OrderedCollectionPage {
ocp := OrderedCollectionPage{
BaseObject: BaseObject{
Context: []string{
Context: []interface{}{
"https://www.w3.org/ns/activitystreams",
},
ID: fmt.Sprintf("%s/%s?page=%d", accountRoot, collType, page),
+1 -1
View File
@@ -18,7 +18,7 @@ func NewPerson(accountRoot string) *Person {
p := Person{
BaseObject: BaseObject{
Type: "Person",
Context: []string{
Context: []interface{}{
"https://www.w3.org/ns/activitystreams",
},
ID: accountRoot,