getLatestUndeletedPid will return string #1884

This commit is contained in:
barisusakli
2014-07-24 03:30:13 -04:00
parent 73e9a7fec0
commit bc2f7339ee
2 changed files with 9 additions and 1 deletions

View File

@@ -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);

View File

@@ -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);
});
});
};