v1.18.x
Barış Soner Uşaklı 10 years ago
parent 1eee970ebb
commit f71c82f653

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

Loading…
Cancel
Save