mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 19:46:01 +01:00
ACP groups delete calls generic groups socket listener now, #2588
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user