mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-05 12:01:17 +01:00
components: account/ban, account/unban, account/delete
This commit is contained in:
@@ -22,16 +22,20 @@ define('forum/account/header', [
|
||||
}
|
||||
|
||||
components.get('account/follow').on('click', function() {
|
||||
return toggleFollow('follow');
|
||||
toggleFollow('follow');
|
||||
});
|
||||
|
||||
components.get('account/unfollow').on('click', function() {
|
||||
return toggleFollow('unfollow');
|
||||
toggleFollow('unfollow');
|
||||
});
|
||||
|
||||
components.get('account/chat').on('click', function() {
|
||||
app.openChat($('.account-username').html(), theirid);
|
||||
});
|
||||
|
||||
components.get('account/ban').on('click', banAccount);
|
||||
components.get('account/unban').on('click', unbanAccount);
|
||||
components.get('account/delete').on('click', deleteAccount);
|
||||
};
|
||||
|
||||
function hidePrivateLinks() {
|
||||
@@ -83,5 +87,50 @@ define('forum/account/header', [
|
||||
return false;
|
||||
}
|
||||
|
||||
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 AccountHeader;
|
||||
});
|
||||
|
||||
@@ -25,10 +25,6 @@ define('forum/account/profile', [
|
||||
processPage();
|
||||
updateButtons();
|
||||
|
||||
$('#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);
|
||||
|
||||
@@ -93,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;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user