aboutsummaryrefslogtreecommitdiff
path: root/routers/api/v1/activitypub/create.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1/activitypub/create.go')
-rw-r--r--routers/api/v1/activitypub/create.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/routers/api/v1/activitypub/create.go b/routers/api/v1/activitypub/create.go
index 591671c0c..4b0ba5edf 100644
--- a/routers/api/v1/activitypub/create.go
+++ b/routers/api/v1/activitypub/create.go
@@ -119,7 +119,7 @@ func createPersonFromIRI(ctx context.Context, personIRI ap.IRI) error {
if err != nil {
return err
}
- return ap.On(object, func(p *ap.Person) error {
+ return ap.OnActor(object, func(p *ap.Person) error {
return createPerson(ctx, p)
})
}
@@ -128,16 +128,21 @@ func createPersonFromIRI(ctx context.Context, personIRI ap.IRI) error {
func createRepository(ctx context.Context, repository *forgefed.Repository) error {
user, err := user_model.GetUserByIRI(ctx, repository.AttributedTo.GetLink().String())
if user_model.IsErrUserNotExist(err) {
+ // TODO: This should probably return the created user too
err := createPersonFromIRI(ctx, repository.AttributedTo.GetLink())
if err != nil {
return err
}
+ user, err = user_model.GetUserByIRI(ctx, repository.AttributedTo.GetLink().String())
+ if err != nil {
+ return err
+ }
} else if err != nil {
return err
}
// Check if repo exists
- _, err = repo_model.GetRepositoryByOwnerAndName(ctx, user.Name, repository.Name.String())
+ _, err = repo_model.GetRepositoryByIRI(ctx, repository.GetLink().String())
if !repo_model.IsErrRepoNotExist(err) {
return err
}