aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFChannel <>2022-06-25 21:01:12 -0700
committerFChannel <>2022-06-25 21:01:12 -0700
commit29df6cc944fb4928c2900bbf4ccc8a026dc2f867 (patch)
treec266662aa8cd8bb038b4d7ead32e0dfa0d23b775
parentc2de9971e9d5f1408083f0d131818e16430238d2 (diff)
this was not neededv0.1.0
-rw-r--r--route/routes/actor.go51
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