Skip to content

Node.js based forum software built for the modern web

filter deleted topics on popular

Barış Soner Uşaklıf3d1e96c2455
diff --git a/src/topics/popular.js b/src/topics/popular.js
index ce2182cabf..a1149914fc 100644
--- a/src/topics/popular.js
+++ b/src/topics/popular.js
@@ -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;