mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-17 11:11:04 +01:00
getLatestUndeletedPid will return string #1884
This commit is contained in:
@@ -53,11 +53,19 @@ module.exports = function(Categories) {
|
||||
results.tids = results.tids.concat(results.pinnedTids);
|
||||
|
||||
async.map(results.tids, topics.getLatestUndeletedPid, function(err, topicPids) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
pids = pids.concat(topicPids).filter(function(pid, index, array) {
|
||||
return !!pid && array.indexOf(pid) === index;
|
||||
});
|
||||
|
||||
posts.getPostSummaryByPids(pids, {stripTags: true}, function(err, posts) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
posts = posts.sort(function(a, b) {
|
||||
return parseInt(b.timestamp, 10) - parseInt(a.timestamp, 10);
|
||||
}).slice(0, count);
|
||||
|
||||
@@ -157,7 +157,7 @@ module.exports = function(Topics) {
|
||||
next(parseInt(deleted, 10) === 0);
|
||||
});
|
||||
}, function(pid) {
|
||||
callback(null, pid ? pid : null);
|
||||
callback(null, pid ? pid.toString() : null);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user