@ -244,7 +244,7 @@ var user = require('./../user.js'),
});
app.get('/topics', function (req, res) {
topics.getAllTopics(10, null, function (topics) {
topics.getAllTopics(10, null, function (err, topics) {
res.json({
topics: topics,
notopics: topics.length === 0
@ -43,7 +43,7 @@ var path = require('path'),
},
function(next) {
var topicUrls = [];
topics.getAllTopics(null, null, function(topics) {
topics.getAllTopics(null, null, function(err, topics) {
topics.forEach(function(topic) {
if (topic.deleted !== '1') {
topicUrls.push({
@ -588,6 +588,10 @@ var RDB = require('./redis.js'),
Topics.getAllTopics = function(limit, after, callback) {
RDB.smembers('topics:tid', function(err, tids) {
if(err) {
return callback(err, null);
}
var topics = [],
numTids, x;
@ -623,7 +627,7 @@ var RDB = require('./redis.js'),
next();
}, function(err) {
callback(topics);
callback(err, topics);
@ -861,7 +861,7 @@ module.exports.init = function(io) {
socket.on('api:admin.topics.getMore', function(data, callback) {
topics.getAllTopics(data.limit, data.after, function(topics) {
topics.getAllTopics(data.limit, data.after, function(err, topics) {
callback(JSON.stringify(topics));