Fix build errors and start working on constructing outbox activities for the various action types
This commit is contained in:
parent
721b734049
commit
fa72294f64
3 changed files with 14 additions and 9 deletions
|
@ -14,7 +14,7 @@ import (
|
||||||
func FederatedUserNew(name string, IRI ap.IRI) error {
|
func FederatedUserNew(name string, IRI ap.IRI) error {
|
||||||
user := &user_model.User{
|
user := &user_model.User{
|
||||||
Name: name,
|
Name: name,
|
||||||
Email: name,
|
Email: name, // TODO: change this to something else to prevent collisions with normal users
|
||||||
LoginType: auth.Federated,
|
LoginType: auth.Federated,
|
||||||
Website: IRI.String(),
|
Website: IRI.String(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,12 +152,17 @@ func PersonOutbox(ctx *context.APIContext) {
|
||||||
|
|
||||||
outbox := ap.OrderedCollectionNew(ap.IRI(link + "/outbox"))
|
outbox := ap.OrderedCollectionNew(ap.IRI(link + "/outbox"))
|
||||||
for _, action := range feed {
|
for _, action := range feed {
|
||||||
if action.OpType == models.ActionCommentIssue {
|
// TODO: There are 26 action types! This is going to take quite a while to implement...
|
||||||
log.Debug("action", action)
|
log.Debug("action", action)
|
||||||
activity := ap.Note{Type: ap.NoteType, Content: ap.NaturalLanguageValuesNew()}
|
var activity ap.ObjectOrLink
|
||||||
activity.Content.Set("en", ap.Content(action.Content))
|
switch action.OpType {
|
||||||
outbox.OrderedItems.Append(activity)
|
case models.ActionCreateRepo:
|
||||||
|
activity = ap.Create{Type: ap.CreateType}//, Object: forgefed.RepositoryNew()}
|
||||||
|
case models.ActionRenameRepo:
|
||||||
|
activity = ap.Move{Type: ap.MoveType}//, Object: forgefed.RepositoryNew()}
|
||||||
|
// etc
|
||||||
}
|
}
|
||||||
|
outbox.OrderedItems.Append(activity)
|
||||||
}
|
}
|
||||||
outbox.TotalItems = uint(len(outbox.OrderedItems))
|
outbox.TotalItems = uint(len(outbox.OrderedItems))
|
||||||
|
|
||||||
|
@ -183,7 +188,7 @@ func PersonFollowing(ctx *context.APIContext) {
|
||||||
|
|
||||||
link := strings.TrimSuffix(setting.AppURL, "/") + "/api/v1/activitypub/user/" + ctx.ContextUser.Name
|
link := strings.TrimSuffix(setting.AppURL, "/") + "/api/v1/activitypub/user/" + ctx.ContextUser.Name
|
||||||
|
|
||||||
users, err := user_model.GetUserFollowing(ctx.ContextUser, utils.GetListOptions(ctx))
|
users, _, err := user_model.GetUserFollowing(ctx, ctx.ContextUser, ctx.Doer, utils.GetListOptions(ctx))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ServerError("GetUserFollowing", err)
|
ctx.ServerError("GetUserFollowing", err)
|
||||||
return
|
return
|
||||||
|
@ -220,7 +225,7 @@ func PersonFollowers(ctx *context.APIContext) {
|
||||||
|
|
||||||
link := strings.TrimSuffix(setting.AppURL, "/") + "/api/v1/activitypub/user/" + ctx.ContextUser.Name
|
link := strings.TrimSuffix(setting.AppURL, "/") + "/api/v1/activitypub/user/" + ctx.ContextUser.Name
|
||||||
|
|
||||||
users, err := user_model.GetUserFollowers(ctx.ContextUser, utils.GetListOptions(ctx))
|
users, _, err := user_model.GetUserFollowers(ctx, ctx.ContextUser, ctx.Doer, utils.GetListOptions(ctx))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ServerError("GetUserFollowers", err)
|
ctx.ServerError("GetUserFollowers", err)
|
||||||
return
|
return
|
||||||
|
|
|
@ -180,7 +180,7 @@ func RepoFollowers(ctx *context.APIContext) {
|
||||||
|
|
||||||
link := strings.TrimSuffix(setting.AppURL, "/") + "/api/v1/activitypub/repo/" + ctx.ContextUser.Name + "/" + ctx.Repo.Repository.Name
|
link := strings.TrimSuffix(setting.AppURL, "/") + "/api/v1/activitypub/repo/" + ctx.ContextUser.Name + "/" + ctx.Repo.Repository.Name
|
||||||
|
|
||||||
users, err := user_model.GetUserFollowers(ctx.ContextUser, utils.GetListOptions(ctx))
|
users, _, err := user_model.GetUserFollowers(ctx, ctx.ContextUser, ctx.Doer, utils.GetListOptions(ctx))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ServerError("GetUserFollowers", err)
|
ctx.ServerError("GetUserFollowers", err)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Reference in a new issue