Node.js based forum software built for the modern web
only load postData for main post
Barış Soner Uşaklı73c808683fb4
diff --git a/src/controllers/topics.js b/src/controllers/topics.jsindex 33877ba11a..7840c35277 100644--- a/src/controllers/topics.js+++ b/src/controllers/topics.js@@ -206,9 +206,10 @@ async function addTags(topicData, req, res) {}description = description.replace(/\n/g, ' ');- const mainPost = postIndex === 0 && postAtIndex ?- postAtIndex :- await topics.getMainPost(topicData.tid, req.uid);+ let mainPost = topicData.posts.find(p => parseInt(p.index, 10) === 0);+ if (!mainPost) {+ mainPost = await posts.getPostData(topicData.mainPid);+ }res.locals.metaTags = [{