diff --git a/src/categories.js b/src/categories.js index 01c831c5af..479bd29d41 100644 --- a/src/categories.js +++ b/src/categories.js @@ -74,6 +74,7 @@ var RDB = require('./redis.js'), categoryData.moderator_block_class = results[1].length > 0 ? '' : 'none'; categoryData.moderators = results[1]; categoryData.active_users = results[2]; + categoryData.show_sidebar = categoryData.topics.length > 0 ? 'show':'hidden'; callback(null, categoryData); }); } @@ -234,6 +235,26 @@ var RDB = require('./redis.js'), }); } + Categories.moveActiveUsers = function(tid, oldCid, cid, callback) { + topics.getUids(tid, function(err, uids) { + if(!err && uids) { + function updateUser(uid) { + Categories.addActiveUser(cid, uid); + Categories.isUserActiveIn(oldCid, uid, function(err, active) { + + if(!err && !active) { + Categories.removeActiveUser(oldCid, uid); + } + }); + } + + for(var i=0; i