From 3099d57f24dc6665074df08bf210a6958abb3a45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 28 Apr 2023 14:06:02 -0400 Subject: [PATCH] feat: #11431 add joindate/postcount/reputation to user add lastposttime to topic --- public/language/en-GB/global.json | 1 + src/posts/queue.js | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/public/language/en-GB/global.json b/public/language/en-GB/global.json index 9e6ea31aee..2fd5e724bf 100644 --- a/public/language/en-GB/global.json +++ b/public/language/en-GB/global.json @@ -74,6 +74,7 @@ "posts": "Posts", "x-posts": "%1 posts", "x-topics": "%1 topics", + "x-reputation": "%1 reputation", "best": "Best", "controversial": "Controversial", "votes": "Votes", diff --git a/src/posts/queue.js b/src/posts/queue.js index 24cc3a311c..7cfdb462d8 100644 --- a/src/posts/queue.js +++ b/src/posts/queue.js @@ -32,7 +32,9 @@ module.exports = function (Posts) { } }); const uids = postData.map(data => data && data.uid); - const userData = await user.getUsersFields(uids, ['username', 'userslug', 'picture']); + const userData = await user.getUsersFields(uids, [ + 'username', 'userslug', 'picture', 'joindate', 'postcount', 'reputation', + ]); postData.forEach((postData, index) => { if (postData) { postData.user = userData[index]; @@ -46,7 +48,7 @@ module.exports = function (Posts) { postData = postData.filter(p => p.id === filter.id); } if (options.metadata) { - await Promise.all(postData.map(p => addMetaData(p))); + await Promise.all(postData.map(addMetaData)); } // Filter by tid if present @@ -71,7 +73,7 @@ module.exports = function (Posts) { if (postData.data.cid) { postData.topic = { cid: parseInt(postData.data.cid, 10) }; } else if (postData.data.tid) { - postData.topic = await topics.getTopicFields(postData.data.tid, ['title', 'cid']); + postData.topic = await topics.getTopicFields(postData.data.tid, ['title', 'cid', 'lastposttime']); } postData.category = await categories.getCategoryData(postData.topic.cid); const result = await plugins.hooks.fire('filter:parse.post', { postData: postData.data });