From 2dcc4172c4faebf5172088a1db23219b227d9f8a Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sun, 29 Sep 2013 21:29:43 -0400 Subject: [PATCH] closes #357 --- public/src/forum/admin/users.js | 17 ----------------- src/admin/user.js | 21 --------------------- src/upgrade.js | 2 +- src/user.js | 28 ---------------------------- 4 files changed, 1 insertion(+), 67 deletions(-) diff --git a/public/src/forum/admin/users.js b/public/src/forum/admin/users.js index a83d424964..289adafa3c 100644 --- a/public/src/forum/admin/users.js +++ b/public/src/forum/admin/users.js @@ -83,23 +83,6 @@ return false; }); - $('#users-container').on('click', '.delete-btn', function() { - var deleteBtn = $(this); - var isAdmin = isUserAdmin(deleteBtn); - var parent = deleteBtn.parents('.users-box'); - var uid = getUID(deleteBtn); - - if (!isAdmin) { - bootbox.confirm('Do you really want to delete "' + parent.attr('data-username') + '"?', function(confirm) { - if (confirm) { - socket.emit('api:admin.user.deleteUser', uid); - } - }); - } - - return false; - }); - $('#users-container').on('click', '.ban-btn', function() { var banBtn = $(this); var isAdmin = isUserAdmin(banBtn); diff --git a/src/admin/user.js b/src/admin/user.js index 8933018828..df12b04937 100644 --- a/src/admin/user.js +++ b/src/admin/user.js @@ -11,8 +11,6 @@ var RDB = require('../redis'), Groups.getGidFromName('Administrators', function(err, gid) { Groups.join(gid, theirid, function(err) { if (!err) { - user.setUserField(theirid, 'administrator', 1); - socket.emit('event:alert', { title: 'User Modified', message: 'This user is now an administrator!', @@ -39,7 +37,6 @@ var RDB = require('../redis'), Groups.getGidFromName('Administrators', function(err, gid) { Groups.leave(gid, theirid, function(err) { if (!err) { - user.setUserField(theirid, 'administrator', 0); socket.emit('event:alert', { title: 'User Modified', @@ -54,24 +51,6 @@ var RDB = require('../redis'), }); }; - UserAdmin.deleteUser = function(uid, theirid, socket) { - user.isAdministrator(uid, function(amIAdmin) { - user.isAdministrator(theirid, function(areTheyAdmin) { - if (amIAdmin && !areTheyAdmin) { - user.delete(theirid, function(data) { - - socket.emit('event:alert', { - title: 'User Deleted', - message: 'This user is deleted!', - type: 'success', - timeout: 2000 - }); - }); - } - }); - }); - }; - UserAdmin.banUser = function(uid, theirid, socket) { user.isAdministrator(uid, function(amIAdmin) { user.isAdministrator(theirid, function(areTheyAdmin) { diff --git a/src/upgrade.js b/src/upgrade.js index 84b777f567..36dfb076c4 100644 --- a/src/upgrade.js +++ b/src/upgrade.js @@ -100,7 +100,7 @@ function upgradeUserHash(uid, callback) { function upgradeAdmins(callback) { Groups.getGidFromName('Administrators', function(err, gid) { if (!err && !gid) { - winston.info('Upgading Administrators'); + winston.info('Upgrading Administrators'); async.parallel([ function(next) { diff --git a/src/user.js b/src/user.js index 90bddffff4..ecbee2eb76 100644 --- a/src/user.js +++ b/src/user.js @@ -72,7 +72,6 @@ var utils = require('./../public/src/utils.js'), 'reputation': 0, 'postcount': 0, 'lastposttime': 0, - 'administrator': (uid == 1) ? 1 : 0, 'banned': 0, 'showemail': 0 }); @@ -114,33 +113,6 @@ var utils = require('./../public/src/utils.js'), }); }; - User.delete = function(uid, callback) { - RDB.exists('user:' + uid, function(err, exists) { - if (exists === 1) { - console.log('deleting uid ' + uid); - - User.getUserData(uid, function(err, data) { - - RDB.hdel('username:uid', data['username']); - RDB.hdel('email:uid', data['email']); - RDB.hdel('userslug:uid', data['userslug']); - - RDB.del('user:' + uid); - RDB.del('followers:' + uid); - RDB.del('following:' + uid); - - RDB.zrem('users:joindate', uid); - RDB.zrem('users:postcount', uid); - RDB.zrem('users:reputation', uid); - - callback(true); - }); - } else { - callback(false); - } - }); - } - User.ban = function(uid, callback) { User.setUserField(uid, 'banned', 1, callback); }