From a078f73e849b922b67a9b9302e4aef48bd9a6f11 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Mon, 23 Dec 2013 22:06:53 -0500 Subject: [PATCH] omg I don't know what I am doing --- src/topics.js | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/topics.js b/src/topics.js index b2757514b2..4efe8c002a 100644 --- a/src/topics.js +++ b/src/topics.js @@ -353,14 +353,25 @@ var async = require('async'), return parseInt(read[index], 10) === 0; }); - unreadTids.push.apply(unreadTids, newtids); + // Filter out topics that belong to categories that this user cannot access + async.filter(newtids, function(tid, next) { + threadTools.privileges(tid, uid, function(err, privileges) { + if (!err && privileges.read) { + next(true); + } else { + next(false); + } + }); + }, function(newtids) { + unreadTids.push.apply(unreadTids, newtids); - if(continueCondition()) { - start = stop + 1; - stop = start + 19; - } + if(continueCondition()) { + start = stop + 1; + stop = start + 19; + } - callback(null); + callback(null); + }); }); } });