diff --git a/client/coral-plugin-commentbox/CommentBox.js b/client/coral-plugin-commentbox/CommentBox.js index bf918c6b7..d7d6fb00d 100644 --- a/client/coral-plugin-commentbox/CommentBox.js +++ b/client/coral-plugin-commentbox/CommentBox.js @@ -56,11 +56,24 @@ class CommentBox extends Component { } !isReply && updateCountCache(assetId, countCache + 1); + // Execute preSubmit Hooks + + Object.keys(this.state.hooks.preSubmit).forEach(hook => { + + // Hooks MUST be functions + + if (typeof this.state.hooks.preSubmit[hook] === 'function') { + this.state.hooks.preSubmit[hook](); + } else { + console.warn(`Hooks MUST be functions. preSubmit ${hook} will not be executed.`); + } + }); + postItem(comment, 'comments') .then(({data}) => { const postedComment = data.createComment.comment; - // Execute postComment Hooks + // Execute postSubmit Hooks Object.keys(this.state.hooks.postSubmit).forEach(hook => { @@ -69,7 +82,7 @@ class CommentBox extends Component { if (typeof this.state.hooks.postSubmit[hook] === 'function') { this.state.hooks.postSubmit[hook](data); } else { - console.warn(`Hooks MUST be functions. ${hook} will not be executed.`); + console.warn(`Hooks MUST be functions. postSubmit ${hook} will not be executed.`); } }); diff --git a/plugins/coral-plugin-offtopic/client/components/OffTopicCheckbox.js b/plugins/coral-plugin-offtopic/client/components/OffTopicCheckbox.js index b303c6731..7354a841b 100644 --- a/plugins/coral-plugin-offtopic/client/components/OffTopicCheckbox.js +++ b/plugins/coral-plugin-offtopic/client/components/OffTopicCheckbox.js @@ -29,7 +29,6 @@ class OffTopicCheckbox extends React.Component { return (