diff --git a/src/categories.js b/src/categories.js index c9c9bf02b6..61c55a0e28 100644 --- a/src/categories.js +++ b/src/categories.js @@ -128,7 +128,7 @@ var RDB = require('./redis.js'), } function hasReadTopic(next) { - topics.hasReadTopics([topicData.tid], current_user, function(hasRead) { + topics.hasReadTopic(topicData.tid, current_user, function(hasRead) { next(null, hasRead); }); } diff --git a/src/topics.js b/src/topics.js index 541db1f43d..9c3cd48cb2 100644 --- a/src/topics.js +++ b/src/topics.js @@ -245,6 +245,18 @@ marked.setOptions({ }); } + Topics.hasReadTopic = function(tid, uid, callback) { + RDB.sismember(schema.topics(tid).read_by_uid, uid, function(err, hasRead) { + if(err === null) { + callback(hasRead); + } + else { + console.log(err); + callback(false); + } + }); + } + Topics.getTeasers = function(tids, callback) { var requests = []; if (Array.isArray(tids)) {