diff --git a/public/src/forum/admin/groups.js b/public/src/forum/admin/groups.js index 8546b53c4f..66ac114fa9 100644 --- a/public/src/forum/admin/groups.js +++ b/public/src/forum/admin/groups.js @@ -62,13 +62,13 @@ define(function() { listEl.on('click', 'button[data-action]', function() { var el = $(this), action = el.attr('data-action'), - gid = el.parents('li[data-gid]').attr('data-gid'); + groupName = el.parents('li[data-groupname]').attr('data-groupname'); switch (action) { case 'delete': bootbox.confirm('Are you sure you wish to delete this group?', function(confirm) { if (confirm) { - socket.emit('admin.groups.delete', gid, function(err, data) { + socket.emit('admin.groups.delete', groupName, function(err, data) { if(err) { return app.alertError(err.message); } @@ -79,7 +79,7 @@ define(function() { }); break; case 'members': - socket.emit('admin.groups.get', gid, function(err, groupObj) { + socket.emit('admin.groups.get', groupName, function(err, groupObj) { var formEl = detailsModal.find('form'), nameEl = formEl.find('#change-group-name'), descEl = formEl.find('#change-group-desc'), @@ -100,7 +100,7 @@ define(function() { } } - detailsModal.attr('data-gid', groupObj.gid); + detailsModal.attr('data-groupname', groupObj.name); detailsModal.modal('show'); }); break; @@ -146,7 +146,7 @@ define(function() { searchResults.on('click', 'li[data-uid]', function() { var userLabel = $(this), uid = parseInt(userLabel.attr('data-uid')), - gid = detailsModal.attr('data-gid'), + groupName = detailsModal.attr('data-groupname'), members = []; groupMembersEl.find('li[data-uid]').each(function() { @@ -155,7 +155,7 @@ define(function() { if (members.indexOf(uid) === -1) { socket.emit('admin.groups.join', { - gid: gid, + groupName: groupName, uid: uid }, function(err, data) { if (!err) { @@ -167,14 +167,14 @@ define(function() { groupMembersEl.on('click', 'li[data-uid]', function() { var uid = $(this).attr('data-uid'), - gid = detailsModal.attr('data-gid'); + groupName = detailsModal.attr('data-groupname'); socket.emit('admin.groups.get', gid, function(err, groupObj){ if (!err){ bootbox.confirm('Are you sure you want to remove this user?', function(confirm) { if (confirm){ socket.emit('admin.groups.leave', { - gid: gid, + groupName: groupName, uid: uid }, function(err, data) { if (!err) { @@ -191,10 +191,10 @@ define(function() { var formEl = detailsModal.find('form'), nameEl = formEl.find('#change-group-name'), descEl = formEl.find('#change-group-desc'), - gid = detailsModal.attr('data-gid'); + groupName = detailsModal.attr('data-groupname'); socket.emit('admin.groups.update', { - gid: gid, + groupName: groupName, values: { name: nameEl.val(), description: descEl.val() diff --git a/src/socket.io/admin.js b/src/socket.io/admin.js index cb0d11e8c1..d8b6aa8022 100644 --- a/src/socket.io/admin.js +++ b/src/socket.io/admin.js @@ -358,12 +358,12 @@ SocketAdmin.groups.create = function(socket, data, callback) { }); }; -SocketAdmin.groups.delete = function(socket, gid, callback) { - groups.destroy(gid, callback); +SocketAdmin.groups.delete = function(socket, groupName, callback) { + groups.destroy(groupName, callback); }; -SocketAdmin.groups.get = function(socket, gid, callback) { - groups.get(gid, { +SocketAdmin.groups.get = function(socket, groupName, callback) { + groups.get(groupName, { expand: true }, function(err, groupObj) { callback(err, groupObj || undefined); @@ -375,7 +375,7 @@ SocketAdmin.groups.join = function(socket, data, callback) { return callback(new Error('invalid data')); } - groups.join(data.gid, data.uid, callback); + groups.join(data.groupName, data.uid, callback); }; SocketAdmin.groups.leave = function(socket, data, callback) { @@ -383,7 +383,7 @@ SocketAdmin.groups.leave = function(socket, data, callback) { return callback(new Error('invalid data')); } - groups.leave(data.gid, data.uid, callback); + groups.leave(data.groupName, data.uid, callback); }; SocketAdmin.groups.update = function(socket, data, callback) { @@ -391,7 +391,7 @@ SocketAdmin.groups.update = function(socket, data, callback) { return callback(new Error('invalid data')); } - groups.update(data.gid, data.values, function(err) { + groups.update(data.groupName, data.values, function(err) { callback(err ? err.message : null); }); };