From 0b8aa3105ce8677590b17b6289412ae84d181829 Mon Sep 17 00:00:00 2001 From: erik Date: Tue, 26 Mar 2024 15:28:11 +0100 Subject: [PATCH] Create object manually --- models/forgefed/activity.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/models/forgefed/activity.go b/models/forgefed/activity.go index 4fb0fac148..a03ab86a66 100644 --- a/models/forgefed/activity.go +++ b/models/forgefed/activity.go @@ -6,6 +6,7 @@ package forgefed import ( "time" + "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/validation" ap "github.com/go-ap/activitypub" @@ -23,8 +24,13 @@ func NewForgeLike(actorIRI string, objectIRI string) (ForgeLike, error) { result := ForgeLike{} result.Type = ap.LikeType // ToDo: Would validating the source by Actor.Type field make sense? - result.Actor = ap.ActorNew(ap.IRI(actorIRI), "ForgejoUser") // Thats us, a User - result.Object = ap.ObjectNew(ap.ActivityVocabularyType(objectIRI)) // Thats them, a Repository + object := new(ap.Object) + object.ID = ap.IRI(objectIRI) + object.URL = ap.IRI(objectIRI) + + result.Actor = ap.ActorNew(ap.IRI(actorIRI), "ForgejoUser") // Thats us, a User + result.Object = object // Thats them, a Repository + log.Info("Object is: %v", object) result.StartTime = time.Now() if valid, err := validation.IsValid(result); !valid { return ForgeLike{}, err