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 --- route/util.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'route/util.go') diff --git a/route/util.go b/route/util.go index 838961e..9a2de75 100644 --- a/route/util.go +++ b/route/util.go @@ -373,4 +373,17 @@ func TemplateFunctions(engine *html.Engine) { return returnString }) + + engine.AddFunc("parseLink", func(board activitypub.Actor, link string) string { + var obj = activitypub.ObjectBase{ + Id: link, + } + + var OP string + if OP, _ = obj.GetOP(); OP == obj.Id { + return board.Name + "/" + util.ShortURL(board.Outbox, obj.Id) + } + + return board.Name + "/" + util.ShortURL(board.Outbox, OP) + "#" + util.ShortURL(board.Outbox, link) + }) } -- cgit v1.2.3