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:
@@ -20,7 +20,7 @@ type Activity struct {
|
|||||||
func NewCreateActivity(o *Object) *Activity {
|
func NewCreateActivity(o *Object) *Activity {
|
||||||
a := Activity{
|
a := Activity{
|
||||||
BaseObject: BaseObject{
|
BaseObject: BaseObject{
|
||||||
Context: []string{
|
Context: []interface{}{
|
||||||
"https://www.w3.org/ns/activitystreams",
|
"https://www.w3.org/ns/activitystreams",
|
||||||
},
|
},
|
||||||
ID: o.ID + "/activity",
|
ID: o.ID + "/activity",
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import "fmt"
|
|||||||
|
|
||||||
type (
|
type (
|
||||||
BaseObject struct {
|
BaseObject struct {
|
||||||
Context []string `json:"@context,omitempty"`
|
Context []interface{} `json:"@context,omitempty"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
PublicKey struct {
|
PublicKey struct {
|
||||||
@@ -33,7 +33,7 @@ type OrderedCollection struct {
|
|||||||
func NewOrderedCollection(accountRoot, collType string, items int) *OrderedCollection {
|
func NewOrderedCollection(accountRoot, collType string, items int) *OrderedCollection {
|
||||||
oc := OrderedCollection{
|
oc := OrderedCollection{
|
||||||
BaseObject: BaseObject{
|
BaseObject: BaseObject{
|
||||||
Context: []string{
|
Context: []interface{}{
|
||||||
"https://www.w3.org/ns/activitystreams",
|
"https://www.w3.org/ns/activitystreams",
|
||||||
},
|
},
|
||||||
ID: accountRoot + "/" + collType,
|
ID: accountRoot + "/" + collType,
|
||||||
@@ -57,7 +57,7 @@ type OrderedCollectionPage struct {
|
|||||||
func NewOrderedCollectionPage(accountRoot, collType string, items, page int) *OrderedCollectionPage {
|
func NewOrderedCollectionPage(accountRoot, collType string, items, page int) *OrderedCollectionPage {
|
||||||
ocp := OrderedCollectionPage{
|
ocp := OrderedCollectionPage{
|
||||||
BaseObject: BaseObject{
|
BaseObject: BaseObject{
|
||||||
Context: []string{
|
Context: []interface{}{
|
||||||
"https://www.w3.org/ns/activitystreams",
|
"https://www.w3.org/ns/activitystreams",
|
||||||
},
|
},
|
||||||
ID: fmt.Sprintf("%s/%s?page=%d", accountRoot, collType, page),
|
ID: fmt.Sprintf("%s/%s?page=%d", accountRoot, collType, page),
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ func NewPerson(accountRoot string) *Person {
|
|||||||
p := Person{
|
p := Person{
|
||||||
BaseObject: BaseObject{
|
BaseObject: BaseObject{
|
||||||
Type: "Person",
|
Type: "Person",
|
||||||
Context: []string{
|
Context: []interface{}{
|
||||||
"https://www.w3.org/ns/activitystreams",
|
"https://www.w3.org/ns/activitystreams",
|
||||||
},
|
},
|
||||||
ID: accountRoot,
|
ID: accountRoot,
|
||||||
|
|||||||
Reference in New Issue
Block a user