From 86a3221563aca3bdf4cbcad57a92dbf461025879 Mon Sep 17 00:00:00 2001 From: Anthony Wang Date: Fri, 10 Jun 2022 11:04:07 -0500 Subject: [PATCH] Fix CI errors by adding @context to Person() and making sure types match --- integrations/api_activitypub_person_test.go | 6 +++--- routers/api/v1/activitypub/person.go | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/integrations/api_activitypub_person_test.go b/integrations/api_activitypub_person_test.go index d6aff2079f..c7c4be5ee6 100644 --- a/integrations/api_activitypub_person_test.go +++ b/integrations/api_activitypub_person_test.go @@ -38,9 +38,9 @@ func TestActivityPubPerson(t *testing.T) { err := person.UnmarshalJSON(resp.Body.Bytes()) assert.NoError(t, err) - assert.Equal(t, "Person", person.Type) - assert.Equal(t, username, person.Name) - keyID := person.ID.String() + assert.Equal(t, ap.ActivityVocabularyType("Person"), person.Type) + assert.Equal(t, username, person.Name.String()) + keyID := person.GetID().String() assert.Regexp(t, fmt.Sprintf("activitypub/user/%s$", username), keyID) assert.Regexp(t, fmt.Sprintf("activitypub/user/%s/outbox$", username), person.Outbox.GetID().String()) assert.Regexp(t, fmt.Sprintf("activitypub/user/%s/inbox$", username), person.Inbox.GetID().String()) diff --git a/routers/api/v1/activitypub/person.go b/routers/api/v1/activitypub/person.go index 4bd77c0b47..a6a8b7a20e 100644 --- a/routers/api/v1/activitypub/person.go +++ b/routers/api/v1/activitypub/person.go @@ -75,6 +75,8 @@ func Person(ctx *context.APIContext) { ctx.Error(http.StatusInternalServerError, "Unmarshall", err) } + jsonmap["@context"] = "https://www.w3.org/ns/activitystreams" + ctx.JSON(http.StatusOK, jsonmap) }