diff --git a/src/categories.js b/src/categories.js index 4a1e0fcef7..f4becdb4c2 100644 --- a/src/categories.js +++ b/src/categories.js @@ -2,6 +2,7 @@ var db = require('./database'), posts = require('./posts'), utils = require('./../public/src/utils'), user = require('./user'), + Groups = require('./groups'), topics = require('./topics'), plugins = require('./plugins'), CategoryTools = require('./categoryTools'), @@ -186,10 +187,10 @@ var db = require('./database'), }; Categories.getModerators = function(cid, callback) { - db.getSetMembers('cid:' + cid + ':moderators', function(err, mods) { + Groups.getByGroupName('cid:' + cid + ':moderators', {}, function(err, groupObj) { if (!err) { - if (mods && mods.length) { - user.getMultipleUserFields(mods, ['uid', 'username', 'userslug', 'picture'], function(err, moderators) { + if (groupObj.members && groupObj.members.length) { + user.getMultipleUserFields(groupObj.members, ['uid', 'username', 'userslug', 'picture'], function(err, moderators) { callback(err, moderators); }); } else { @@ -198,7 +199,6 @@ var db = require('./database'), } else { callback(err, null); } - }); }; diff --git a/src/routes/debug.js b/src/routes/debug.js index b25d00a894..56a97bb894 100644 --- a/src/routes/debug.js +++ b/src/routes/debug.js @@ -74,13 +74,9 @@ var DebugRoute = function(app) { }); app.get('/test', function(req, res) { - - var db = require('./../database'); - - db.getSortedSetRevRange('topics:recent', 0 , -1, function(err, tids) { - res.json(tids); - }); - + // categories.getModerators(1, function(err, mods) { + // res.json(mods); + // }) }); }); diff --git a/src/user.js b/src/user.js index 66fe6b2934..b7a73de988 100644 --- a/src/user.js +++ b/src/user.js @@ -753,11 +753,11 @@ var bcrypt = require('bcryptjs'), }; User.isModerator = function(uid, cid, callback) { - db.isSetMember('cid:' + cid + ':moderators', uid, function(err, exists) { + groups.isMemberByGroupName(uid, 'cid:' + cid + ':moderators', function(err, isMember) { if(err) { return calback(err); } - callback(err, exists); + callback(err, isMember); }); };