mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-02 05:40:43 +01:00
feat: allow unban/unmute on flag details page. closes #10593
This commit is contained in:
@@ -57,8 +57,12 @@ define('forum/account/header', [
|
||||
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/unban').on('click', function () {
|
||||
unbanAccount(ajaxify.data.theirid);
|
||||
});
|
||||
components.get('account/unmute').on('click', function () {
|
||||
unmuteAccount(ajaxify.data.theirid);
|
||||
});
|
||||
components.get('account/delete-account').on('click', handleDeleteEvent.bind(null, 'account'));
|
||||
components.get('account/delete-content').on('click', handleDeleteEvent.bind(null, 'content'));
|
||||
components.get('account/delete-all').on('click', handleDeleteEvent.bind(null, 'purge'));
|
||||
@@ -73,6 +77,8 @@ define('forum/account/header', [
|
||||
// TODO: This exported method is used in forum/flags/detail -- refactor??
|
||||
AccountHeader.banAccount = banAccount;
|
||||
AccountHeader.muteAccount = muteAccount;
|
||||
AccountHeader.unbanAccount = unbanAccount;
|
||||
AccountHeader.unmuteAccount = unmuteAccount;
|
||||
|
||||
function hidePrivateLinks() {
|
||||
if (!app.user.uid || app.user.uid !== parseInt(ajaxify.data.theirid, 10)) {
|
||||
@@ -176,8 +182,8 @@ define('forum/account/header', [
|
||||
});
|
||||
}
|
||||
|
||||
function unbanAccount() {
|
||||
api.del('/users/' + ajaxify.data.theirid + '/ban').then(() => {
|
||||
function unbanAccount(theirid) {
|
||||
api.del('/users/' + theirid + '/ban').then(() => {
|
||||
ajaxify.refresh();
|
||||
}).catch(alerts.error);
|
||||
}
|
||||
@@ -223,8 +229,8 @@ define('forum/account/header', [
|
||||
});
|
||||
}
|
||||
|
||||
function unmuteAccount() {
|
||||
api.del('/users/' + ajaxify.data.theirid + '/mute').then(() => {
|
||||
function unmuteAccount(theirid) {
|
||||
api.del('/users/' + theirid + '/mute').then(() => {
|
||||
ajaxify.refresh();
|
||||
}).catch(alerts.error);
|
||||
}
|
||||
|
||||
@@ -69,10 +69,18 @@ define('forum/flags/detail', [
|
||||
AccountHeader.banAccount(uid, ajaxify.refresh);
|
||||
break;
|
||||
|
||||
case 'unban':
|
||||
AccountHeader.unbanAccount(uid);
|
||||
break;
|
||||
|
||||
case 'mute':
|
||||
AccountHeader.muteAccount(uid, ajaxify.refresh);
|
||||
break;
|
||||
|
||||
case 'unmute':
|
||||
AccountHeader.unmuteAccount(uid);
|
||||
break;
|
||||
|
||||
case 'delete-account':
|
||||
AccountsDelete.account(uid, ajaxify.refresh);
|
||||
break;
|
||||
|
||||
@@ -104,7 +104,7 @@ module.exports = function (Posts) {
|
||||
'uid', 'username', 'fullname', 'userslug',
|
||||
'reputation', 'postcount', 'topiccount', 'picture',
|
||||
'signature', 'banned', 'banned:expire', 'status',
|
||||
'lastonline', 'groupTitle',
|
||||
'lastonline', 'groupTitle', 'mutedUntil',
|
||||
];
|
||||
const result = await plugins.hooks.fire('filter:posts.addUserFields', {
|
||||
fields: fields,
|
||||
|
||||
@@ -252,6 +252,10 @@ module.exports = function (User) {
|
||||
user.banned = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (user.hasOwnProperty('mutedUntil')) {
|
||||
user.muted = user.mutedUntil > Date.now();
|
||||
}
|
||||
}));
|
||||
|
||||
return await plugins.hooks.fire('filter:users.get', users);
|
||||
|
||||
Reference in New Issue
Block a user