Skip to content

Commit

Permalink
feat: add client-side static hook to fire immediately before any topi…
Browse files Browse the repository at this point in the history
…c action (hint: delete `action` to stop default behaviour)
  • Loading branch information
julianlam committed Sep 17, 2021
1 parent 819917d commit 66eaae4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion public/src/client/topic/postTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 66eaae4

Please sign in to comment.