From fb648070720b3955f47f25c381be36d6ee7e3579 Mon Sep 17 00:00:00 2001 From: erik Date: Thu, 9 Nov 2023 14:24:19 +0100 Subject: [PATCH 1/2] Clearer wording, fix typos --- modules/forgefed/star.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/forgefed/star.go b/modules/forgefed/star.go index e34c67e7d9..5dfb255f67 100644 --- a/modules/forgefed/star.go +++ b/modules/forgefed/star.go @@ -25,12 +25,12 @@ var KnownSourceTypes = SourceTypes{ ForgejoSourceType, } -// Star activity for adding a star to an repository +// Star activity data type // swagger:model type Star struct { // swagger: ignore ap.Activity - // Source identifies the system generated this Activity. Exact one value has to be specified. + // Source identifies the system which generated this activity. Exactly one value has to be specified. Source SourceType `jsonld:"source,omitempty"` } From 0650fa031f4686ce330d564184bb826b125c3b3e Mon Sep 17 00:00:00 2001 From: erik Date: Thu, 9 Nov 2023 15:38:55 +0100 Subject: [PATCH 2/2] WIP Add star to swagger --- modules/forgefed/star.go | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/modules/forgefed/star.go b/modules/forgefed/star.go index 5dfb255f67..ff1c55fdc8 100644 --- a/modules/forgefed/star.go +++ b/modules/forgefed/star.go @@ -4,6 +4,7 @@ package forgefed import ( + "code.gitea.io/gitea/modules/context" ap "github.com/go-ap/activitypub" ) @@ -26,20 +27,26 @@ var KnownSourceTypes = SourceTypes{ } // Star activity data type -// swagger:model type Star struct { - // swagger: ignore ap.Activity // Source identifies the system which generated this activity. Exactly one value has to be specified. Source SourceType `jsonld:"source,omitempty"` } -// RepositoryNew initializes a Repository type actor +// Infos needed to star a repo +type StarRepo struct { + StargazerID int `json:"Stargazer"` + RepoID int `json:"RepoToStar"` +} + +// StarNew initializes a Star type activity +// Guess: no return value needed, we may need to add the star to the context func StarNew(id ap.ID, ob ap.ID) *Star { a := ap.ActivityNew(id, StarType, ob) - // TODO: is this not handeld by ActivityNew?? - a.Type = StarType - o := Star{Activity: *a} - o.Source = ForgejoSourceType + o := Star{Activity: *a, Source: ForgejoSourceType} return &o } + +func AddStar(ctx *context.APIContext) { + +}