mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
feat: #10585, ability to mute from flag details
This commit is contained in:
@@ -54,7 +54,9 @@ define('forum/account/header', [
|
||||
components.get('account/ban').on('click', function () {
|
||||
banAccount(ajaxify.data.theirid);
|
||||
});
|
||||
components.get('account/mute').on('click', muteAccount);
|
||||
components.get('account/mute').on('click', function () {
|
||||
muteAccount(ajaxify.data.theirid);
|
||||
});
|
||||
components.get('account/unban').on('click', unbanAccount);
|
||||
components.get('account/unmute').on('click', unmuteAccount);
|
||||
components.get('account/delete-account').on('click', handleDeleteEvent.bind(null, 'account'));
|
||||
@@ -70,6 +72,7 @@ define('forum/account/header', [
|
||||
|
||||
// TODO: This exported method is used in forum/flags/detail -- refactor??
|
||||
AccountHeader.banAccount = banAccount;
|
||||
AccountHeader.muteAccount = muteAccount;
|
||||
|
||||
function hidePrivateLinks() {
|
||||
if (!app.user.uid || app.user.uid !== parseInt(ajaxify.data.theirid, 10)) {
|
||||
@@ -179,7 +182,8 @@ define('forum/account/header', [
|
||||
}).catch(alerts.error);
|
||||
}
|
||||
|
||||
function muteAccount() {
|
||||
function muteAccount(theirid, onSuccess) {
|
||||
theirid = theirid || ajaxify.data.theirid;
|
||||
Benchpress.render('admin/partials/temporary-mute', {}).then(function (html) {
|
||||
bootbox.dialog({
|
||||
className: 'mute-modal',
|
||||
@@ -203,10 +207,13 @@ define('forum/account/header', [
|
||||
Date.now() + (formData.length * 1000 * 60 * 60 * (parseInt(formData.unit, 10) ? 24 : 1))
|
||||
) : 0;
|
||||
|
||||
api.put('/users/' + ajaxify.data.theirid + '/mute', {
|
||||
api.put('/users/' + theirid + '/mute', {
|
||||
until: until,
|
||||
reason: formData.reason || '',
|
||||
}).then(() => {
|
||||
if (typeof onSuccess === 'function') {
|
||||
return onSuccess();
|
||||
}
|
||||
ajaxify.refresh();
|
||||
}).catch(alerts.error);
|
||||
},
|
||||
|
||||
@@ -69,6 +69,10 @@ define('forum/flags/detail', [
|
||||
AccountHeader.banAccount(uid, ajaxify.refresh);
|
||||
break;
|
||||
|
||||
case 'mute':
|
||||
AccountHeader.muteAccount(uid, ajaxify.refresh);
|
||||
break;
|
||||
|
||||
case 'delete-account':
|
||||
AccountsDelete.account(uid, ajaxify.refresh);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user