This commit is contained in:
Barış Soner Uşaklı
2015-04-17 12:32:00 -04:00
parent 1eee970ebb
commit f71c82f653

View File

@@ -149,8 +149,8 @@ function filterAndSort(pids, data, callback) {
}
function getMatchedPosts(pids, data, callback) {
var postFields = ['pid', 'tid', 'timestamp'];
var topicFields = [];
var postFields = ['pid', 'tid', 'timestamp', 'deleted'];
var topicFields = ['deleted'];
var categoryFields = [];
if (data.replies) {
@@ -180,7 +180,9 @@ function getMatchedPosts(pids, data, callback) {
db.getObjectsFields(keys, postFields, next);
},
function(_posts, next) {
posts = _posts;
posts = _posts.filter(function(post) {
return post && parseInt(post.deleted, 10) !== 1;
});
async.parallel({
users: function(next) {
@@ -194,10 +196,6 @@ function getMatchedPosts(pids, data, callback) {
}
},
topics: function(next) {
if (!topicFields.length) {
return next();
}
var topics;
async.waterfall([
function(next) {
@@ -268,6 +266,10 @@ function getMatchedPosts(pids, data, callback) {
}
});
posts = posts.filter(function(post) {
return post && post.topic && parseInt(post.topic.deleted, 10) !== 1;
});
next(null, posts);
}
], callback);