mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 22:15:48 +01:00
pass on mainPid
This commit is contained in:
@@ -216,7 +216,7 @@ var async = require('async'),
|
|||||||
|
|
||||||
async.parallel({
|
async.parallel({
|
||||||
mainPost: function(next) {
|
mainPost: function(next) {
|
||||||
Topics.getMainPost(tid, uid, next);
|
getMainPosts([topicData.mainPid], uid, next);
|
||||||
},
|
},
|
||||||
posts: function(next) {
|
posts: function(next) {
|
||||||
Topics.getTopicPosts(tid, set, start, end, uid, reverse, next);
|
Topics.getTopicPosts(tid, set, start, end, uid, reverse, next);
|
||||||
@@ -230,7 +230,7 @@ var async = require('async'),
|
|||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
topicData.posts = results.mainPost ? [results.mainPost].concat(results.posts) : results.posts;
|
topicData.posts = Array.isArray(results.mainPost) && results.mainPost.length ? [results.mainPost[0]].concat(results.posts) : results.posts;
|
||||||
topicData.category = results.category;
|
topicData.category = results.category;
|
||||||
topicData.thread_tools = results.threadTools;
|
topicData.thread_tools = results.threadTools;
|
||||||
topicData.tags = results.tags;
|
topicData.tags = results.tags;
|
||||||
@@ -262,6 +262,11 @@ var async = require('async'),
|
|||||||
return topic ? topic.mainPid : null;
|
return topic ? topic.mainPid : null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
getMainPosts(mainPids, uid, callback);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
function getMainPosts(mainPids, uid, callback) {
|
||||||
posts.getPostsByPids(mainPids, uid, function(err, postData) {
|
posts.getPostsByPids(mainPids, uid, function(err, postData) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
@@ -273,8 +278,7 @@ var async = require('async'),
|
|||||||
});
|
});
|
||||||
Topics.addPostData(postData, uid, callback);
|
Topics.addPostData(postData, uid, callback);
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
};
|
|
||||||
|
|
||||||
Topics.getTopicField = function(tid, field, callback) {
|
Topics.getTopicField = function(tid, field, callback) {
|
||||||
db.getObjectField('topic:' + tid, field, callback);
|
db.getObjectField('topic:' + tid, field, callback);
|
||||||
|
|||||||
Reference in New Issue
Block a user