Return flags when creating comment, restrict access to actions in comment resolver

This commit is contained in:
Chi Vinh Le
2017-09-20 02:50:43 +07:00
parent b482976c58
commit 5f7c4f82e7
4 changed files with 22 additions and 19 deletions
@@ -23,8 +23,8 @@ export default class CheckToxicityHook extends React.Component {
});
this.toxicityPostHook = this.props.registerHook('postSubmit', (result) => {
const actions = result.createComment.comment && result.createComment.comment.actions;
if (actions && actions.some(({reason}) => reason === 'TOXIC_COMMENT')) {
const flags = result.createComment.flags;
if (flags && flags.some(({reason}) => reason === 'TOXIC_COMMENT')) {
this.props.notify('error', t('talk-plugin-toxic-comments.still_toxic'));
}