diff --git a/src/categories.js b/src/categories.js index a000eff251..539a643f80 100644 --- a/src/categories.js +++ b/src/categories.js @@ -312,17 +312,12 @@ var privileges = require('./privileges'); Categories.filterIgnoringUids = function(cid, uids, callback) { async.waterfall([ function (next){ - Categories.getIgnorers(cid, 0, -1, next); + db.sortedSetScores('cid:' + cid + ':ignorers', uids, next); }, - function (ignorerUids, next){ - if (!ignorerUids.length) { - return next(null, uids); - } - - var readingUids = uids.filter(function(uid) { - return ignorerUids.indexOf(uid.toString()) === -1; + function (scores, next) { + var readingUids = uids.filter(function(uid, index) { + return uid && !!scores[index]; }); - next(null, readingUids); } ], callback); diff --git a/src/topics/follow.js b/src/topics/follow.js index 7b4054ac03..42143b5641 100644 --- a/src/topics/follow.js +++ b/src/topics/follow.js @@ -181,20 +181,15 @@ module.exports = function(Topics) { db.getSetMembers('tid:' + tid + ':ignorers', callback); }; - Topics.filterIgnoringUids = function(tid, uids, callback){ + Topics.filterIgnoringUids = function(tid, uids, callback) { async.waterfall([ function (next){ - Topics.getIgnorers(tid, next); + db.isSetMembers('tid:' + tid + ':ignorers', uids, next); }, - function (ignorerUids, next){ - if (!ignorerUids.length) { - return next(null, uids); - } - - var readingUids = uids.filter(function(uid) { - return ignorerUids.indexOf(uid.toString()) === -1; + function (isMembers, next){ + var readingUids = uids.filter(function(uid, index) { + return uid && isMembers[index]; }); - next(null, readingUids); } ], callback);