started #961, first pass

v1.18.x
Julian Lam 11 years ago
parent d2bed7791c
commit e176abae50

@ -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);
}
});
};

@ -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);
// })
});
});

@ -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);
});
};

Loading…
Cancel
Save