only load postData for main post

This commit is contained in:
Barış Soner Uşaklı
2023-06-14 22:12:37 -04:00
parent 0b2feb9e45
commit 73c808683f

View File

@@ -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 = [
{