diff --git a/client/coral-embed-stream/src/tabs/stream/containers/CommentBox.js b/client/coral-embed-stream/src/tabs/stream/containers/CommentBox.js index de0551141..c02bc63d4 100644 --- a/client/coral-embed-stream/src/tabs/stream/containers/CommentBox.js +++ b/client/coral-embed-stream/src/tabs/stream/containers/CommentBox.js @@ -65,9 +65,12 @@ class CommentBox extends React.Component { }; // Execute preSubmit Hooks - this.state.hooks.preSubmit.forEach(hook => - hook(input, this.handleBodyChange) - ); + this.state.hooks.preSubmit.forEach(hook => { + const result = hook(input); + if (result) { + input = result; + } + }); this.setState({ loadingState: 'loading' }); postComment(input, 'comments') diff --git a/plugins/talk-plugin-akismet/client/components/CheckSpamHook.js b/plugins/talk-plugin-akismet/client/components/CheckSpamHook.js index 056f28eef..83378d248 100644 --- a/plugins/talk-plugin-akismet/client/components/CheckSpamHook.js +++ b/plugins/talk-plugin-akismet/client/components/CheckSpamHook.js @@ -15,8 +15,11 @@ export default class CheckSpamHook extends React.Component { // If we haven't check the spam yet, make sure to include `checkSpam=true` in the mutation. // Otherwise post comment without checking the spam. if (!this.checked) { - input.checkSpam = true; this.checked = true; + return { + ...input, + checkSpam: true, + }; } }); diff --git a/plugins/talk-plugin-toxic-comments/client/components/CheckToxicityHook.js b/plugins/talk-plugin-toxic-comments/client/components/CheckToxicityHook.js index 4331e006b..814c107cc 100644 --- a/plugins/talk-plugin-toxic-comments/client/components/CheckToxicityHook.js +++ b/plugins/talk-plugin-toxic-comments/client/components/CheckToxicityHook.js @@ -15,8 +15,11 @@ export default class CheckToxicityHook extends React.Component { // If we haven't check the toxicity yet, make sure to include `checkToxicity=true` in the mutation. // Otherwise post comment without checking the toxicity. if (!this.checked) { - input.checkToxicity = true; this.checked = true; + return { + ...input, + checkToxicity: true, + }; } });