|
|
@ -556,31 +556,27 @@ var async = require('async'),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Groups.destroy = function(groupName, callback) {
|
|
|
|
Groups.destroy = function(groupName, callback) {
|
|
|
|
async.parallel([
|
|
|
|
Groups.get(groupName, {}, function(err, groupObj) {
|
|
|
|
async.apply(db.delete, 'group:' + groupName),
|
|
|
|
plugins.fireHook('action:group.destroy', groupObj);
|
|
|
|
async.apply(db.setRemove, 'groups', groupName),
|
|
|
|
|
|
|
|
async.apply(db.delete, 'group:' + groupName + ':members'),
|
|
|
|
async.parallel([
|
|
|
|
async.apply(db.delete, 'group:' + groupName + ':pending'),
|
|
|
|
async.apply(db.delete, 'group:' + groupName),
|
|
|
|
async.apply(db.delete, 'group:' + groupName + ':owners'),
|
|
|
|
async.apply(db.setRemove, 'groups', groupName),
|
|
|
|
function(next) {
|
|
|
|
async.apply(db.delete, 'group:' + groupName + ':members'),
|
|
|
|
db.getSetMembers('groups', function(err, groups) {
|
|
|
|
async.apply(db.delete, 'group:' + groupName + ':pending'),
|
|
|
|
if (err) {
|
|
|
|
async.apply(db.delete, 'group:' + groupName + ':owners'),
|
|
|
|
return next(err);
|
|
|
|
function(next) {
|
|
|
|
}
|
|
|
|
db.getSetMembers('groups', function(err, groups) {
|
|
|
|
async.each(groups, function(group, next) {
|
|
|
|
if (err) {
|
|
|
|
db.setRemove('group:' + group + ':members', groupName, next);
|
|
|
|
return next(err);
|
|
|
|
}, next);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
async.each(groups, function(group, next) {
|
|
|
|
}
|
|
|
|
db.setRemove('group:' + group + ':members', groupName, next);
|
|
|
|
], function(err) {
|
|
|
|
}, next);
|
|
|
|
if (!err) {
|
|
|
|
});
|
|
|
|
plugins.fireHook('action:group.destroy', {
|
|
|
|
}
|
|
|
|
name: groupName
|
|
|
|
], callback);
|
|
|
|
});
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
callback(err);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Groups.join = function(groupName, uid, callback) {
|
|
|
|
Groups.join = function(groupName, uid, callback) {
|
|
|
|