Node.js based forum software built for the modern web
feat: #10585, ability to mute from flag details
Barış Soner Uşaklı7867ccd7809b
diff --git a/public/src/client/account/header.js b/public/src/client/account/header.jsindex a793403bfc..e11f6373d7 100644--- a/public/src/client/account/header.js+++ b/public/src/client/account/header.js@@ -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);},diff --git a/public/src/client/flags/detail.js b/public/src/client/flags/detail.jsindex 7965614255..c55269e3ca 100644--- a/public/src/client/flags/detail.js+++ b/public/src/client/flags/detail.js@@ -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;