ACP groups delete calls generic groups socket listener now, #2588

v1.18.x
Julian Lam 10 years ago
parent 08e883de44
commit 765975e667

@ -102,12 +102,14 @@ define('admin/manage/groups', [
case 'delete':
bootbox.confirm('Are you sure you wish to delete this group?', function(confirm) {
if (confirm) {
socket.emit('admin.groups.delete', groupName, function(err, data) {
socket.emit('groups.delete', {
groupName: groupName
}, function(err, data) {
if(err) {
return app.alertError(err.message);
}
ajaxify.go('admin/manage/groups');
ajaxify.refresh();
});
}
});

@ -15,10 +15,6 @@ Groups.create = function(socket, data, callback) {
}, callback);
};
Groups.delete = function(socket, groupName, callback) {
groups.destroy(groupName, callback);
};
Groups.get = function(socket, groupName, callback) {
groups.get(groupName, {
expand: true

@ -101,4 +101,18 @@ SocketGroups.update = function(socket, data, callback) {
});
};
SocketGroups.delete = function(socket, data, callback) {
if(!data) {
return callback(new Error('[[error:invalid-data]]'));
}
groups.ownership.isOwner(socket.uid, data.groupName, function(err, isOwner) {
if (!isOwner) {
return callback(new Error('[[error:no-privileges]]'));
}
groups.destroy(data.groupName, callback);
});
};
module.exports = SocketGroups;

Loading…
Cancel
Save