mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-06-17 20:51:05 +02:00
filter deleted topics on popular
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user