diff --git a/src/groups.js b/src/groups.js index a9aa6902a7..1496a2c7cf 100644 --- a/src/groups.js +++ b/src/groups.js @@ -235,7 +235,8 @@ userTitle: values.userTitle, description: values.description, icon: values.icon || '', - labelColor: values.labelColor || '#000000' + labelColor: values.labelColor || '#000000', + hidden: values.hidden || '0' }, callback); }); }; @@ -265,7 +266,6 @@ return callback(err); } - Groups.hide(groupName); db.setAdd('group:' + groupName + ':members', uid, callback); }); } diff --git a/src/socket.io/admin/categories.js b/src/socket.io/admin/categories.js index a17779cfae..5beb66eb7d 100644 --- a/src/socket.io/admin/categories.js +++ b/src/socket.io/admin/categories.js @@ -96,11 +96,13 @@ Categories.setGroupPrivilege = function(socket, data, callback) { return callback(new Error('[[error:invalid-data]]')); } - if (data.set) { - groups.join('cid:' + data.cid + ':privileges:' + data.privilege, data.name, callback); - } else { - groups.leave('cid:' + data.cid + ':privileges:' + data.privilege, data.name, callback); - } + groups[data.set ? 'join' : 'leave']('cid:' + data.cid + ':privileges:' + data.privilege, data.name, function (err) { + if (err) { + return callback(err); + } + + groups.hide('cid:' + data.cid + ':privileges:' + data.privilege, callback); + }); }; Categories.groupsList = function(socket, cid, callback) {