diff --git a/public/language/en-GB/flags.json b/public/language/en-GB/flags.json index 09b0fe746d..649d3878d1 100644 --- a/public/language/en-GB/flags.json +++ b/public/language/en-GB/flags.json @@ -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", diff --git a/public/src/client/flags/detail.js b/public/src/client/flags/detail.js index 70e380d990..353a09b66b 100644 --- a/public/src/client/flags/detail.js +++ b/public/src/client/flags/detail.js @@ -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,