diff options
author | FChannel <> | 2022-06-25 21:01:12 -0700 |
---|---|---|
committer | FChannel <> | 2022-06-25 21:01:12 -0700 |
commit | 29df6cc944fb4928c2900bbf4ccc8a026dc2f867 (patch) | |
tree | c266662aa8cd8bb038b4d7ead32e0dfa0d23b775 /route/routes/actor.go | |
parent | c2de9971e9d5f1408083f0d131818e16430238d2 (diff) |
this was not neededv0.1.0
Diffstat (limited to 'route/routes/actor.go')
-rw-r--r-- | route/routes/actor.go | 51 |
1 files changed, 11 insertions, 40 deletions
diff --git a/route/routes/actor.go b/route/routes/actor.go index 28c81e3..7cc11ae 100644 --- a/route/routes/actor.go +++ b/route/routes/actor.go @@ -381,50 +381,21 @@ func ActorPost(ctx *fiber.Ctx) error { return ctx.Redirect(config.Domain+"/"+actor.Name+"/"+util.ShortURL(actor.Outbox, OP)+"#"+util.ShortURL(actor.Outbox, inReplyTo), http.StatusMovedPermanently) } - var data route.PageData - - re = regexp.MustCompile("f(\\w|[!@#$%^&*<>])+-(\\w|[!@#$%^&*<>])+") - - if re.MatchString(ctx.Path()) { // if non local actor post - name := activitypub.GetActorFollowNameFromPath(ctx.Path()) - - followActors, err := actor.GetFollowFromName(name) - if err != nil { - return util.MakeError(err, "PostGet") - } + collection, err := obj.GetCollectionFromPath() - followCollection, err := activitypub.GetActorsFollowPostFromId(followActors, postId) - if err != nil { - return util.MakeError(err, "PostGet") - } - - if len(followCollection.OrderedItems) > 0 { - data.Board.InReplyTo = followCollection.OrderedItems[0].Id - data.Posts = append(data.Posts, followCollection.OrderedItems[0]) - - actor, err := activitypub.FingerActor(data.Board.InReplyTo) - if err != nil { - return util.MakeError(err, "PostGet") - } - - data.Board.Post.Actor = actor.Id - } - } else { - obj := activitypub.ObjectBase{Id: inReplyTo} - collection, err := obj.GetCollectionFromPath() + if err != nil { + return ctx.Status(404).Render("404", fiber.Map{}) + } - if err != nil { - return ctx.Status(404).Render("404", fiber.Map{}) - } + var data route.PageData - if collection.Actor.Id != "" { - data.Board.Post.Actor = collection.Actor.Id - data.Board.InReplyTo = inReplyTo - } + if collection.Actor.Id != "" { + data.Board.Post.Actor = collection.Actor.Id + data.Board.InReplyTo = inReplyTo + } - if len(collection.OrderedItems) > 0 { - data.Posts = append(data.Posts, collection.OrderedItems[0]) - } + if len(collection.OrderedItems) > 0 { + data.Posts = append(data.Posts, collection.OrderedItems[0]) } data.Board.Name = actor.Name |