Skip to content

Node.js based forum software built for the modern web

omg I don't know what I am doing

Julian Lama078f73e849b
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);
+ });
});
}
});