Node.js based forum software built for the modern web
fix(posts/queue): populate crosspost topic, author, and content metadata
Julian Lam5bc47cb10ae3
diff --git a/src/posts/queue.js b/src/posts/queue.jsindex c323244363..ed0b9f22d6 100644--- a/src/posts/queue.js+++ b/src/posts/queue.js@@ -80,7 +80,27 @@ module.exports = function (Posts) {}postData.topic = { cid: 0 };if (postData.data.crosspostCid) {- postData.topic = { cid: parseInt(postData.data.crosspostCid, 10) };+ if (postData.data.tid) {+ const topicData = await topics.getTopicFields(postData.data.tid, ['title', 'timestamp', 'uid', 'mainPid', 'cid', 'lastposttime']);+ postData.topic = topicData;+ postData.data.title = topicData.title || '';+ if (topicData.uid) {+ const authorData = await user.getUsersFields([topicData.uid], [+ 'username', 'userslug', 'picture', 'icon:bgColor', 'joindate', 'postcount', 'reputation',+ ]);+ if (authorData && authorData[0]) {+ postData.user = authorData[0];+ }+ }+ if (topicData.mainPid) {+ const firstPost = await Posts.getPostFields(topicData.mainPid, ['content']);+ if (firstPost) {+ postData.data.content = firstPost.content || '';+ }+ }+ } else {+ postData.topic = { cid: parseInt(postData.data.crosspostCid, 10) };+ }} else if (postData.data.cid) {postData.topic = { cid: parseInt(postData.data.cid, 10) };} else if (postData.data.tid) {