Merge branch 'forgejo-federated-star' of codeberg.org:meissa/forgejo into forgejo-federated-star

forgejo-federated-star
Michael Jerger 7 months ago
commit 874664ad76

@ -4,6 +4,7 @@
package forgefed package forgefed
import ( import (
"code.gitea.io/gitea/modules/context"
ap "github.com/go-ap/activitypub" ap "github.com/go-ap/activitypub"
) )
@ -25,21 +26,29 @@ var KnownSourceTypes = SourceTypes{
ForgejoSourceType, ForgejoSourceType,
} }
// Star activity for adding a star to an repository // Star activity data type
// swagger:model // swagger: model
type Star struct { type Star struct {
// swagger:ignore // swagger:ignore
ap.Activity 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"` 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 { func StarNew(id ap.ID, ob ap.ID) *Star {
a := ap.ActivityNew(id, StarType, ob) a := ap.ActivityNew(id, StarType, ob)
// TODO: is this not handeld by ActivityNew?? o := Star{Activity: *a, Source: ForgejoSourceType}
a.Type = StarType
o := Star{Activity: *a}
o.Source = ForgejoSourceType
return &o return &o
} }
func AddStar(ctx *context.APIContext) {
}

Loading…
Cancel
Save