From 0e5f280327b09b242974f5c2ab33494d14c829e8 Mon Sep 17 00:00:00 2001 From: Baris Usakli Date: Fri, 28 Jun 2013 11:36:41 -0400 Subject: [PATCH] fixed categories read notification bug --- src/categories.js | 2 ++ src/posts.js | 6 +++--- src/topics.js | 11 +++++++---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/categories.js b/src/categories.js index a165bfaadf..aa4cc61411 100644 --- a/src/categories.js +++ b/src/categories.js @@ -352,6 +352,8 @@ var RDB = require('./redis.js'), Categories.hasReadCategories(cids, current_user, function(read_data) { has_read = read_data; + console.log(cids, read_data); + console.log(current_user); generateCategories(); }); diff --git a/src/posts.js b/src/posts.js index 9d6d6abcc3..6abee53d40 100644 --- a/src/posts.js +++ b/src/posts.js @@ -186,11 +186,11 @@ marked.setOptions({ RDB.del('tid:' + tid + ':read_by_uid'); // let everybody know there is an unread post Posts.get_cid_by_pid(pid, function(cid) { - RDB.del('cid:' + cid + ':read_by_uid'); + RDB.del('cid:' + cid + ':read_by_uid', function(err, data) { + topics.markAsRead(tid, uid); + }); RDB.zadd('categories:recent_posts:cid:' + cid, Date.now(), pid); - - topics.markAsRead(tid, uid); }); diff --git a/src/topics.js b/src/topics.js index fc46c1114e..2b712bfb33 100644 --- a/src/topics.js +++ b/src/topics.js @@ -373,8 +373,6 @@ marked.setOptions({ } }); - Topics.markAsRead(tid, uid); - // User Details - move this out later RDB.lpush('uid:' + uid + ':topics', tid); @@ -386,8 +384,13 @@ marked.setOptions({ }); // let everyone know that there is an unread topic in this category - RDB.del('cid:' + category_id + ':read_by_uid'); - + RDB.del('cid:' + category_id + ':read_by_uid', function(err, data) { + console.log('deleted'); + Topics.markAsRead(tid, uid); + }); + + + RDB.zadd(schema.topics().recent, Date.now(), tid); //RDB.zadd('topics:active', tid);