aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db/database.go14
-rw-r--r--route/routes/actor.go3
2 files changed, 16 insertions, 1 deletions
diff --git a/db/database.go b/db/database.go
index 46297ec..7f1149a 100644
--- a/db/database.go
+++ b/db/database.go
@@ -417,3 +417,17 @@ func InitInstance() error {
return nil
}
+
+func GetPostIDFromNum(num string) (string, error) {
+ var postID string
+
+ query := `select id from activitystream where id like $1`
+ if err := config.DB.QueryRow(query, "%"+num).Scan(&postID); err != nil {
+ query = `select id from cacheactivitystream where id like $1`
+ if err := config.DB.QueryRow(query, "%"+num).Scan(&postID); err != nil {
+ return "", util.MakeError(err, "GetPostIDFromNum")
+ }
+ }
+
+ return postID, nil
+}
diff --git a/route/routes/actor.go b/route/routes/actor.go
index f5bfb4c..c35e57a 100644
--- a/route/routes/actor.go
+++ b/route/routes/actor.go
@@ -13,6 +13,7 @@ import (
"github.com/FChannel0/FChannel-Server/activitypub"
"github.com/FChannel0/FChannel-Server/config"
+ "github.com/FChannel0/FChannel-Server/db"
"github.com/FChannel0/FChannel-Server/post"
"github.com/FChannel0/FChannel-Server/route"
"github.com/FChannel0/FChannel-Server/util"
@@ -373,7 +374,7 @@ func ActorPost(ctx *fiber.Ctx) error {
re := regexp.MustCompile("\\w+$")
postId := re.FindString(ctx.Path())
- inReplyTo := actor.Id + "/" + postId
+ inReplyTo, _ := db.GetPostIDFromNum(postId)
// check if actually OP if not redirect to op to get full thread
var obj = activitypub.ObjectBase{Id: inReplyTo}