feat: #8360 flag quick actions for delete/restore/purge

v1.18.x
Julian Lam 5 years ago
parent 6b1d1acb48
commit 8ea1634824

@ -32,6 +32,9 @@
"view-profile": "View Profile",
"start-new-chat": "Start New Chat",
"go-to-target": "View Flag Target",
"delete-post": "Delete Post",
"purge-post": "Purge Post",
"restore-post": "Restore Post",
"user-view": "View Profile",
"user-edit": "Edit Profile",

@ -48,15 +48,48 @@ define('forum/flags/detail', ['forum/flags/list', 'components', 'translator', 'b
AccountHeader.banAccount(uid, ajaxify.refresh);
break;
case 'delete':
case 'delete-account':
AccountHeader.deleteAccount(uid, ajaxify.refresh);
break;
case 'delete-post':
postAction('delete', ajaxify.data.target.pid, ajaxify.data.target.tid);
break;
case 'purge-post':
postAction('purge', ajaxify.data.target.pid, ajaxify.data.target.tid);
break;
case 'restore-post':
postAction('restore', ajaxify.data.target.pid, ajaxify.data.target.tid);
break;
}
});
FlagsList.enableFilterForm();
};
function postAction(action, pid, tid) {
translator.translate('[[topic:post_' + action + '_confirm]]', function (msg) {
bootbox.confirm(msg, function (confirm) {
if (!confirm) {
return;
}
socket.emit('posts.' + action, {
pid: pid,
tid: tid,
}, function (err) {
if (err) {
app.alertError(err.message);
}
ajaxify.refresh();
});
});
});
}
Detail.reloadNotes = function (notes) {
Benchpress.parse('flags/detail', 'notes', {
notes: notes,

Loading…
Cancel
Save