From 60752f58ab0eade30e88c1e98ad530a4b151586e Mon Sep 17 00:00:00 2001 From: FChannel <> Date: Sat, 4 Jun 2022 11:55:19 -0700 Subject: redirect to OP thread if not OP --- activitypub/object.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'activitypub/object.go') 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 -- cgit v1.2.3