@ape the standard way to get nodebb modules is require.main.requireconst Posts = require.main.require('./src/posts'); Posts.getPostData(pid, callback)
Confirm on post
I have one particular post on my forum where lots of members subscribe, but it has several posting rules attached to it.
Unfortunately members continue to ignore these rules and it makes other members unhappy and I need to go around deleting lots of posts.
We already have a warning toast when replying and edited the composer box to be red, but it still doesn't make much difference.
So I'm looking to put up a final confirm dialog on Submit. I can see that I can use bootbox.confirm to bring up the dialog, just not sure what action I need to be watching, and what to call to either stop the message being posted or to let it continue on the callbacks.
https://github.com/NodeBB/nodebb-plugin-composer-default/blob/master/static/lib/composer.js#L605 I am not sure if it will work with bootbox.confirm since the client side hooks are synchronous. You can give it a shot.
If that doesn't work another option is to add a fake submit button in the composer and hide the real submit button. Once the user confirms the bootbox.confirm trigger a click on the real submit button.
@baris thanks for the suggestions, for now I've just replaced the toast on clicking Reply with the confirm dialog and if they cancel it presses the discard button to close the composer.