|
|
|
@ -23,25 +23,8 @@ define('forum/account/profile', [
|
|
|
|
|
app.enterRoom('user/' + theirid);
|
|
|
|
|
|
|
|
|
|
processPage();
|
|
|
|
|
|
|
|
|
|
updateButtons();
|
|
|
|
|
|
|
|
|
|
$('#follow-btn').on('click', function() {
|
|
|
|
|
return toggleFollow('follow');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#unfollow-btn').on('click', function() {
|
|
|
|
|
return toggleFollow('unfollow');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#chat-btn').on('click', function() {
|
|
|
|
|
app.openChat($('.account-username').html(), theirid);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#banAccountBtn').on('click', banAccount);
|
|
|
|
|
$('#unbanAccountBtn').on('click', unbanAccount);
|
|
|
|
|
$('#deleteAccountBtn').on('click', deleteAccount);
|
|
|
|
|
|
|
|
|
|
socket.removeListener('event:user_status_change', onUserStatusChange);
|
|
|
|
|
socket.on('event:user_status_change', onUserStatusChange);
|
|
|
|
|
|
|
|
|
@ -59,21 +42,6 @@ define('forum/account/profile', [
|
|
|
|
|
$('#chat-btn').toggleClass('hide', isSelfOrNotLoggedIn);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function toggleFollow(type) {
|
|
|
|
|
socket.emit('user.' + type, {
|
|
|
|
|
uid: theirid
|
|
|
|
|
}, function(err) {
|
|
|
|
|
if (err) {
|
|
|
|
|
return app.alertError(err.message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('#follow-btn').toggleClass('hide', type === 'follow');
|
|
|
|
|
$('#unfollow-btn').toggleClass('hide', type === 'unfollow');
|
|
|
|
|
app.alertSuccess('[[global:alert.' + type + ', ' + $('.account-username').html() + ']]');
|
|
|
|
|
});
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function onUserStatusChange(data) {
|
|
|
|
|
if (parseInt(ajaxify.data.theirid, 10) !== parseInt(data.uid, 10)) {
|
|
|
|
|
return;
|
|
|
|
@ -121,50 +89,5 @@ define('forum/account/profile', [
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function banAccount() {
|
|
|
|
|
translator.translate('[[user:ban_account_confirm]]', function(translated) {
|
|
|
|
|
bootbox.confirm(translated, function(confirm) {
|
|
|
|
|
if (!confirm) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
socket.emit('admin.user.banUsers', [ajaxify.data.theirid], function(err) {
|
|
|
|
|
if (err) {
|
|
|
|
|
return app.alertError(err.message);
|
|
|
|
|
}
|
|
|
|
|
$('#banAccountBtn').toggleClass('hide', true);
|
|
|
|
|
$('#banLabel, #unbanAccountBtn').toggleClass('hide', false);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function unbanAccount() {
|
|
|
|
|
socket.emit('admin.user.unbanUsers', [ajaxify.data.theirid], function(err) {
|
|
|
|
|
if (err) {
|
|
|
|
|
return app.alertError(err.message);
|
|
|
|
|
}
|
|
|
|
|
$('#banAccountBtn').toggleClass('hide', false);
|
|
|
|
|
$('#banLabel, #unbanAccountBtn').toggleClass('hide', true);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function deleteAccount() {
|
|
|
|
|
translator.translate('[[user:delete_this_account_confirm]]', function(translated) {
|
|
|
|
|
bootbox.confirm(translated, function(confirm) {
|
|
|
|
|
if (!confirm) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
socket.emit('admin.user.deleteUsers', [ajaxify.data.theirid], function(err) {
|
|
|
|
|
if (err) {
|
|
|
|
|
return app.alertError(err.message);
|
|
|
|
|
}
|
|
|
|
|
app.alertSuccess('[[user:account-deleted]]');
|
|
|
|
|
history.back();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Account;
|
|
|
|
|
});
|
|
|
|
|