Review
This commit is contained in:
parent
d7abff31f6
commit
b085ce37a6
2 changed files with 4 additions and 5 deletions
|
@ -30,19 +30,18 @@ var KnownSourceTypes = SourceTypes{
|
||||||
// swagger:model
|
// swagger:model
|
||||||
type Star struct {
|
type Star struct {
|
||||||
// swagger:ignore
|
// swagger:ignore
|
||||||
Activity ap.Activity
|
ap.Activity
|
||||||
// Source identifies the system which generated this activity. Exactly 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"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// StarNew initializes a Star type activity
|
// StarNew initializes a Star type activity
|
||||||
func StarNew(id ap.ID, ob ap.ID) *Star { // ToDo: Currently this function is not used anywhere, so we don't create stars?
|
func StarNew(id ap.ID, ob ap.ID) *Star { // ToDo: May be used later in creating signed activities
|
||||||
a := ap.ActivityNew(id, StarType, ob)
|
a := ap.ActivityNew(id, StarType, ob)
|
||||||
o := Star{Activity: *a, Source: ForgejoSourceType}
|
o := Star{Activity: *a, Source: ForgejoSourceType}
|
||||||
return &o
|
return &o
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToDo: should Star be *Star?
|
|
||||||
func (a Star) MarshalJSON() ([]byte, error) {
|
func (a Star) MarshalJSON() ([]byte, error) {
|
||||||
b := make([]byte, 0)
|
b := make([]byte, 0)
|
||||||
ap.JSONWrite(&b, '{')
|
ap.JSONWrite(&b, '{')
|
||||||
|
|
|
@ -897,11 +897,11 @@ func Routes() *web.Route {
|
||||||
}, context_service.UserIDAssignmentAPI())
|
}, context_service.UserIDAssignmentAPI())
|
||||||
m.Group("/repository-id/{repository-id}", func() {
|
m.Group("/repository-id/{repository-id}", func() {
|
||||||
m.Get("", activitypub.Repository)
|
m.Get("", activitypub.Repository)
|
||||||
m.Post("/inbox", // ToDo: We may want a m.Patch method here, as we are not replacing stars
|
m.Post("/inbox", // ToDo: Post or Put?
|
||||||
// TODO: bind ativities here
|
// TODO: bind ativities here
|
||||||
bind(forgefed.Star{}),
|
bind(forgefed.Star{}),
|
||||||
//activitypub.ReqHTTPSignature(),
|
//activitypub.ReqHTTPSignature(),
|
||||||
activitypub.RepositoryInbox) // ToDo: We may need to use another method to add a star to the repo
|
activitypub.RepositoryInbox)
|
||||||
}, context_service.RepositoryIDAssignmentAPI())
|
}, context_service.RepositoryIDAssignmentAPI())
|
||||||
}, tokenRequiresScopes(auth_model.AccessTokenScopeCategoryActivityPub))
|
}, tokenRequiresScopes(auth_model.AccessTokenScopeCategoryActivityPub))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue