filter deleted topics on popular

v1.18.x
Barış Soner Uşaklı 10 years ago
parent 749ce5f8e5
commit f3d1e96c24

@ -34,10 +34,12 @@ module.exports = function(Topics) {
function getTopics(tids, uid, count, callback) {
async.waterfall([
function(next) {
Topics.getTopicsFields(tids, ['tid', 'postcount'], next);
Topics.getTopicsFields(tids, ['tid', 'postcount', 'deleted'], next);
},
function(topics, next) {
tids = topics.sort(function(a, b) {
tids = topics.filter(function(topic) {
return topic && parseInt(topic.deleted, 10) !== 1;
}).sort(function(a, b) {
return b.postcount - a.postcount;
}).slice(0, count).map(function(topic) {
return topic.tid;

Loading…
Cancel
Save