aboutsummaryrefslogtreecommitdiff
path: root/activitypub
diff options
context:
space:
mode:
authorFChannel <>2022-06-04 11:55:19 -0700
committerFChannel <>2022-06-19 12:53:29 -0700
commit60752f58ab0eade30e88c1e98ad530a4b151586e (patch)
tree421b06b577250ff13f40bf05773332beea857523 /activitypub
parent89795236377c1db1821c7ccbbc48a94562a70995 (diff)
redirect to OP thread if not OP
Diffstat (limited to 'activitypub')
-rw-r--r--activitypub/object.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/activitypub/object.go b/activitypub/object.go
index f2241b7..4682832 100644
--- a/activitypub/object.go
+++ b/activitypub/object.go
@@ -54,6 +54,18 @@ func (obj ObjectBase) CheckIfOP() (bool, error) {
return true, nil
}
+func (obj ObjectBase) GetOP() (string, error) {
+ var id string
+
+ query := `select id from replies where inreplyto='' and id in (select inreplyto from replies where id=$1)`
+
+ if err := config.DB.QueryRow(query, obj.Id).Scan(&id); err != nil {
+ return obj.Id, nil
+ }
+
+ return id, nil
+}
+
func (obj ObjectBase) CreatePreview() *NestedObjectBase {
var nPreview NestedObjectBase