From 1fe35e14a57dad5d1cdba945ff627ce844b9ae46 Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Sat, 9 Dec 2023 14:53:40 +0100 Subject: [PATCH] mv our actor code to forgefed --- models/{activitypub => forgefed}/actor.go | 3 ++- models/{activitypub => forgefed}/actor_test.go | 2 +- routers/api/v1/activitypub/repository.go | 3 +-- 3 files changed, 4 insertions(+), 4 deletions(-) rename models/{activitypub => forgefed}/actor.go (98%) rename models/{activitypub => forgefed}/actor_test.go (99%) diff --git a/models/activitypub/actor.go b/models/forgefed/actor.go similarity index 98% rename from models/activitypub/actor.go rename to models/forgefed/actor.go index 13f349faf9..8599bbfd5e 100644 --- a/models/activitypub/actor.go +++ b/models/forgefed/actor.go @@ -1,7 +1,7 @@ // Copyright 2023 The forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT -package activitypub +package forgefed import ( "fmt" @@ -94,6 +94,7 @@ func (value PersonId) Validate() []string { return result } +// TODO: Move valid-parts to valid package /* IsValid concatenates the error messages with newlines and returns them if there are any */ diff --git a/models/activitypub/actor_test.go b/models/forgefed/actor_test.go similarity index 99% rename from models/activitypub/actor_test.go rename to models/forgefed/actor_test.go index 4162c2411b..897580e0a0 100644 --- a/models/activitypub/actor_test.go +++ b/models/forgefed/actor_test.go @@ -1,7 +1,7 @@ // Copyright 2023 The forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT -package activitypub +package forgefed import ( "testing" diff --git a/routers/api/v1/activitypub/repository.go b/routers/api/v1/activitypub/repository.go index b3c88f786e..b89a1d2fe0 100644 --- a/routers/api/v1/activitypub/repository.go +++ b/routers/api/v1/activitypub/repository.go @@ -11,7 +11,6 @@ import ( "strings" "time" - "code.gitea.io/gitea/models/activitypub" "code.gitea.io/gitea/models/db" "code.gitea.io/gitea/models/forgefed" repo_model "code.gitea.io/gitea/models/repo" @@ -239,7 +238,7 @@ func RepositoryInbox(ctx *context.APIContext) { log.Info("RepositoryInbox: Activity.Source: %v, Activity.Actor %v, Activity.Actor.Id %v", activity.Source, activity.Actor, activity.Actor.GetID().String()) // parse actorId - actorId, err := activitypub.NewPersonId(activity.Actor.GetID().String(), string(activity.Source)) + actorId, err := forgefed.NewPersonId(activity.Actor.GetID().String(), string(activity.Source)) if err != nil { ctx.ServerError("Validate actorId", err) return