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