a huge frickin' number of changes for #2887. This is part of #2463

This commit is contained in:
Julian Lam
2015-03-25 15:42:15 -04:00
parent 815ea88fa5
commit 9b84a887d3
10 changed files with 299 additions and 129 deletions

View File

@@ -271,7 +271,15 @@ var async = require('async'),
};
Groups.getGroupFields = function(groupName, fields, callback) {
db.getObjectFields('group:' + groupName, fields, callback);
Groups.getMultipleGroupFields([groupName], fields, function(err, groups) {
callback(err, groups ? groups[0] : null);
});
};
Groups.getMultipleGroupFields = function(groups, fields, callback) {
db.getObjectsFields(groups.map(function(group) {
return 'group:' + group;
}), fields, callback);
};
Groups.setGroupField = function(groupName, field, value, callback) {
@@ -306,6 +314,12 @@ var async = require('async'),
db.getSortedSetRevRange('group:' + groupName + ':members', start, end, callback);
};
Groups.getMembersOfGroups = function(groupNames, callback) {
db.getSortedSetsMembers(groupNames.map(function(name) {
return 'group:' + name + ':members';
}), callback);
};
Groups.isMember = function(uid, groupName, callback) {
if (!uid || parseInt(uid, 10) <= 0) {
return callback(null, false);