This commit is contained in:
Julian Lam
2014-01-14 19:01:12 -05:00
parent facacc65aa
commit b3f23d41d3
2 changed files with 49 additions and 51 deletions

View File

@@ -426,24 +426,30 @@ var db = require('./database'),
return callback(err);
}
if (pids && pids.length) {
plugins.fireHook('filter:post.getTopic', pids, function(err, posts) {
if(err) {
return callback(err);
}
if (posts && posts.length) {
Posts.getPostsByPids(pids, function(err, posts) {
plugins.fireHook('action:post.gotTopic', posts);
callback(null, posts);
});
} else {
callback(null, []);
}
async.filter(pids, function(pid, next) {
postTools.privileges(pid, 0, function(privileges) {
next(privileges.read);
});
} else {
callback(null, []);
}
}, function(pids) {
if (pids && pids.length) {
plugins.fireHook('filter:post.getTopic', pids, function(err, posts) {
if(err) {
return callback(err);
}
if (posts && posts.length) {
Posts.getPostsByPids(pids, function(err, posts) {
plugins.fireHook('action:post.gotTopic', posts);
callback(null, posts);
});
} else {
callback(null, []);
}
});
} else {
callback(null, []);
}
});
});
}