v1.18.x
Baris Soner Usakli 11 years ago
parent f96a711298
commit 2dcc4172c4

@ -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);

@ -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) {

@ -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) {

@ -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);
}

Loading…
Cancel
Save