diff options
author | FChannel <> | 2022-06-04 11:55:19 -0700 |
---|---|---|
committer | FChannel <> | 2022-06-19 12:53:29 -0700 |
commit | 60752f58ab0eade30e88c1e98ad530a4b151586e (patch) | |
tree | 421b06b577250ff13f40bf05773332beea857523 /activitypub/object.go | |
parent | 89795236377c1db1821c7ccbbc48a94562a70995 (diff) |
redirect to OP thread if not OP
Diffstat (limited to 'activitypub/object.go')
-rw-r--r-- | activitypub/object.go | 12 |
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 |