From 20ce00f43476705462a37c76026313db9f529a62 Mon Sep 17 00:00:00 2001 From: Azareal Date: Sun, 15 Mar 2020 12:00:29 +1000 Subject: [PATCH] avoid unneccesary OGDesc allocs --- routes/topic.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/routes/topic.go b/routes/topic.go index cbaa26b7..48dae755 100644 --- a/routes/topic.go +++ b/routes/topic.go @@ -75,10 +75,12 @@ func ViewTopic(w http.ResponseWriter, r *http.Request, user c.User, header *c.He } topic.ContentLines = strings.Count(topic.Content, "\n") - if len(topic.Content) > 200 { - header.OGDesc = topic.Content[:197] + "..." - } else { - header.OGDesc = topic.Content + if !user.Loggedin && user.LastAgent != c.Semrush { + if len(topic.Content) > 200 { + header.OGDesc = topic.Content[:197] + "..." + } else { + header.OGDesc = topic.Content + } } var parseSettings *c.ParseSettings