mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 22:15:48 +01:00
closes #5994
This commit is contained in:
@@ -125,6 +125,8 @@ module.exports = function (Topics) {
|
||||
|
||||
if (params.filter === 'watched') {
|
||||
Topics.filterWatchedTids(tids, uid, next);
|
||||
} else if (params.filter === 'unreplied') {
|
||||
Topics.filterUnrepliedTids(tids, next);
|
||||
} else {
|
||||
next(null, tids);
|
||||
}
|
||||
@@ -390,4 +392,18 @@ module.exports = function (Topics) {
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
Topics.filterUnrepliedTids = function (tids, callback) {
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
db.sortedSetScores('topics:posts', tids, next);
|
||||
},
|
||||
function (scores, next) {
|
||||
tids = tids.filter(function (tid, index) {
|
||||
return tid && scores[index] <= 1;
|
||||
});
|
||||
next(null, tids);
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user