From f2d07d3182e601f5baaac076523bb0bca0f1da3a Mon Sep 17 00:00:00 2001 From: root--- Date: Thu, 31 Jul 2014 01:39:41 -0400 Subject: [PATCH 1/2] fix fatal error when renaming group with no users --- src/groups.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/groups.js b/src/groups.js index 8164ae457c..5af818c5ec 100644 --- a/src/groups.js +++ b/src/groups.js @@ -295,7 +295,13 @@ db.rename('group:' + oldName, 'group:' + newName, next); }, function(next) { - db.rename('group:' + oldName + ':members', 'group:' + newName + ':members', next); + Groups.exists('group:' + oldName + ':members', function(err, exists) { + if (exists) { + db.rename('group:' + oldName + ':members', 'group:' + newName + ':members', next); + } else { + next(); + } + }); }, function(next) { renameGroupMember('groups', oldName, newName, next); From da7a161245beb35c738d054d83a63d0151547b20 Mon Sep 17 00:00:00 2001 From: root--- Date: Thu, 31 Jul 2014 03:19:47 -0400 Subject: [PATCH 2/2] fluidized ACP groups modal dialog --- public/src/forum/admin/groups.js | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/public/src/forum/admin/groups.js b/public/src/forum/admin/groups.js index 5e4f0c34d1..34a1b59ed0 100644 --- a/public/src/forum/admin/groups.js +++ b/public/src/forum/admin/groups.js @@ -78,14 +78,33 @@ define('forum/admin/groups', ['forum/admin/iconSelect'], function(iconSelect) { break; case 'members': socket.emit('admin.groups.get', groupName, function(err, groupObj) { - var formEl = detailsModal.find('form'); + var formEl = detailsModal.find('form').keypress(function(e) { + switch(e.keyCode) { + case 13: + detailsModalSave.click(); + break; + default: + break; + } + }), + groupLabelPreview = formEl.find('#group-label-preview'), + changeGroupUserTitle = formEl.find('#change-group-user-title'), + changeGroupLabelColor = formEl.find('#change-group-label-color'); formEl.find('#change-group-name').val(groupObj.name).prop('readonly', groupObj.system); formEl.find('#change-group-desc').val(groupObj.description); - formEl.find('#change-group-user-title').val(groupObj.userTitle); + changeGroupUserTitle.val(groupObj.userTitle).keydown(function() { + setTimeout(function() { + groupLabelPreview.text(changeGroupUserTitle.val()); + }, 0); + }); formEl.find('#group-icon').attr('class', 'fa fa-2x ' + groupObj.icon).attr('value', groupObj.icon); - formEl.find('#change-group-label-color').val(groupObj.labelColor); - formEl.find('#group-label-preview').css('background', groupObj.labelColor || '#000000').text(groupObj.userTitle); + changeGroupLabelColor.val(groupObj.labelColor).keydown(function() { + setTimeout(function() { + groupLabelPreview.css('background', changeGroupLabelColor.val() || '#000000'); + }, 0); + }); + groupLabelPreview.css('background', groupObj.labelColor || '#000000').text(groupObj.userTitle); groupMembersEl.empty(); if (groupObj.members.length > 0) {