mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-01 20:30:07 +01:00
feat: bulk purge flags
This commit is contained in:
@@ -84,6 +84,7 @@
|
|||||||
"modal-reason-offensive": "Offensive",
|
"modal-reason-offensive": "Offensive",
|
||||||
"modal-reason-other": "Other (specify below)",
|
"modal-reason-other": "Other (specify below)",
|
||||||
"modal-reason-custom": "Reason for reporting this content...",
|
"modal-reason-custom": "Reason for reporting this content...",
|
||||||
|
"modal-notify-remote": "Forward this report to %1",
|
||||||
"modal-submit": "Submit Report",
|
"modal-submit": "Submit Report",
|
||||||
"modal-submit-success": "Content has been flagged for moderation.",
|
"modal-submit-success": "Content has been flagged for moderation.",
|
||||||
|
|
||||||
@@ -91,6 +92,8 @@
|
|||||||
|
|
||||||
"bulk-actions": "Bulk Actions",
|
"bulk-actions": "Bulk Actions",
|
||||||
"bulk-resolve": "Resolve Flag(s)",
|
"bulk-resolve": "Resolve Flag(s)",
|
||||||
|
"confirm-purge": "Are you sure you want to permanently delete these flags?",
|
||||||
|
"purge-cancelled": "Flag Purge Cancelled",
|
||||||
"bulk-purge": "Purge Flag(s)",
|
"bulk-purge": "Purge Flag(s)",
|
||||||
"bulk-success": "%1 flags updated",
|
"bulk-success": "%1 flags updated",
|
||||||
"flagged-timeago-readable": "Flagged <span class=\"timeago\" title=\"%1\"></span> (%2)",
|
"flagged-timeago-readable": "Flagged <span class=\"timeago\" title=\"%1\"></span> (%2)",
|
||||||
|
|||||||
@@ -213,13 +213,34 @@ export function handleBulkActions() {
|
|||||||
const subselector = e.target.closest('[data-action]');
|
const subselector = e.target.closest('[data-action]');
|
||||||
if (subselector) {
|
if (subselector) {
|
||||||
const action = subselector.getAttribute('data-action');
|
const action = subselector.getAttribute('data-action');
|
||||||
|
let confirmed;
|
||||||
|
if (action === 'bulk-purge') {
|
||||||
|
confirmed = new Promise((resolve, reject) => {
|
||||||
|
bootbox.confirm('[[flags:confirm-purge]]', (confirmed) => {
|
||||||
|
if (confirmed) {
|
||||||
|
resolve();
|
||||||
|
} else {
|
||||||
|
reject(new Error('[[flags:purge-cancelled]]'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
const flagIds = getSelected();
|
const flagIds = getSelected();
|
||||||
const promises = flagIds.map((flagId) => {
|
const promises = flagIds.map(async (flagId) => {
|
||||||
const data = {};
|
const data = {};
|
||||||
if (action === 'bulk-assign') {
|
switch (action) {
|
||||||
data.assignee = app.user.uid;
|
case 'bulk-assign': {
|
||||||
} else if (action === 'bulk-mark-resolved') {
|
data.assignee = app.user.uid;
|
||||||
data.state = 'resolved';
|
break;
|
||||||
|
}
|
||||||
|
case 'bulk-mark-resolved': {
|
||||||
|
data.state = 'resolved';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'bulk-purge': {
|
||||||
|
await confirmed;
|
||||||
|
return api.del(`/flags/${flagId}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return api.put(`/flags/${flagId}`, data);
|
return api.put(`/flags/${flagId}`, data);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user