Skip to content

Node.js based forum software built for the modern web

refactoring topics to be stored as a set per category, instead of a list

Julian Lam858337c63369
diff --git a/src/topics.js b/src/topics.js
index e06b0458fd..bf6c0a7086 100644
--- a/src/topics.js
+++ b/src/topics.js
@@ -20,7 +20,7 @@ var RDB = require('./redis.js'),
//build a proper wrapper for this and move it into above function later
var range_var = (category_id) ? 'categories:' + category_id + ':tid' : 'topics:tid';
- RDB.lrange(range_var, start, end, function(tids) {
+ RDB.db.smembers(range_var, function(err, tids) {
var title = [],
uid = [],
timestamp = [],
@@ -116,7 +116,6 @@ var RDB = require('./redis.js'),
});
- //} else callback({'category_id': category_id, 'topics': []});
});
}
@@ -150,7 +149,7 @@ var RDB = require('./redis.js'),
if (category_id) {
- RDB.lpush('categories:' + category_id + ':tid', tid);
+ RDB.db.sadd('categories:' + category_id + ':tid', tid);
}
var slug = tid + '/' + utils.slugify(title);