From e097ac1fa7c7b5bdaa4edb63e6e14e3ca27c69a3 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Fri, 15 Aug 2014 17:26:49 -0400 Subject: [PATCH 1/2] latest templates.js --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4d819ab281..9a9d9ba20f 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "validator": "~3.16.1", "winston": "~0.7.2", "xregexp": "~2.0.0", - "templates.js": "0.0.10" + "templates.js": "0.0.12" }, "devDependencies": { "mocha": "~1.13.0" From a9ca035e1e3d54fc457569196116871bfc8c3ba5 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Fri, 15 Aug 2014 18:15:10 -0400 Subject: [PATCH 2/2] gotto check read after each pass --- src/topics/unread.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/topics/unread.js b/src/topics/unread.js index 2754fa9a88..871d2043e7 100644 --- a/src/topics/unread.js +++ b/src/topics/unread.js @@ -49,19 +49,21 @@ module.exports = function(Topics) { return !read[index]; }); - unreadTids.push.apply(unreadTids, newtids); + privileges.topics.filter('read', newtids, uid, function(err, newtids) { + if (err) { + return next(err); + } + unreadTids.push.apply(unreadTids, newtids); - start = stop + 1; - stop = start + 19; + start = stop + 1; + stop = start + 19; - next(); + next(); + }); }); }); }, function(err) { - if (err) { - return callback(err); - } - privileges.topics.filter('read', unreadTids, uid, callback); + callback(err, unreadTids); }); };