Use @mariusor's suggestions for idiomatic go-ap usage
This commit is contained in:
parent
f7da251c5d
commit
cf6aed386d
|
@ -39,7 +39,7 @@ func TestActivityPubPerson(t *testing.T) {
|
||||||
err := person.UnmarshalJSON(body)
|
err := person.UnmarshalJSON(body)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
assert.Equal(t, ap.ActivityVocabularyType("Person"), person.Type)
|
assert.Equal(t, ap.PersonType, person.Type)
|
||||||
assert.Equal(t, username, person.Name.String())
|
assert.Equal(t, username, person.Name.String())
|
||||||
keyID := person.GetID().String()
|
keyID := person.GetID().String()
|
||||||
assert.Regexp(t, fmt.Sprintf("activitypub/user/%s$", username), keyID)
|
assert.Regexp(t, fmt.Sprintf("activitypub/user/%s$", username), keyID)
|
||||||
|
|
|
@ -51,8 +51,8 @@ func Person(ctx *context.APIContext) {
|
||||||
}
|
}
|
||||||
person.Name = name
|
person.Name = name
|
||||||
|
|
||||||
person.Inbox = ap.Item(ap.IRI(link + "/inbox"))
|
ap.Inbox.AddTo(person)
|
||||||
person.Outbox = ap.Item(ap.IRI(link + "/outbox"))
|
ap.Outbox.AddTo(person)
|
||||||
|
|
||||||
person.PublicKey.ID = ap.IRI(link + "#main-key")
|
person.PublicKey.ID = ap.IRI(link + "#main-key")
|
||||||
person.PublicKey.Owner = ap.IRI(link)
|
person.PublicKey.Owner = ap.IRI(link)
|
||||||
|
|
Loading…
Reference in New Issue