From 66eaae44a6be0f1141c934873ae4e60b27f746e0 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 17 Sep 2021 10:37:06 -0400 Subject: [PATCH] feat: add client-side static hook to fire immediately before any topic action (hint: delete `action` to stop default behaviour) --- public/src/client/topic/postTools.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/src/client/topic/postTools.js b/public/src/client/topic/postTools.js index dfc9f6ce72..793153325c 100644 --- a/public/src/client/topic/postTools.js +++ b/public/src/client/topic/postTools.js @@ -399,7 +399,12 @@ define('forum/topic/postTools', [ postAction('purge', getData(button, 'data-pid')); } - function postAction(action, pid) { + async function postAction(action, pid) { + ({ action } = await hooks.fire(`static:post.${action}`, { action, pid })); + if (!action) { + return; + } + bootbox.confirm('[[topic:post_' + action + '_confirm]]', function (confirm) { if (!confirm) { return;