diff --git a/plugins/talk-plugin-toxic-comments/server/hooks.js b/plugins/talk-plugin-toxic-comments/server/hooks.js index 991c243a0..8924778a7 100644 --- a/plugins/talk-plugin-toxic-comments/server/hooks.js +++ b/plugins/talk-plugin-toxic-comments/server/hooks.js @@ -14,12 +14,18 @@ module.exports = { const apiKey = require('./apiKey'); const scores = await perspective.getScores(apiKey, input.body); - if (input.checkToxicity && scores.SEVERE_TOXICITY.summaryScore > TOXICITY_THRESHOLD) { + const isToxic = scores.SEVERE_TOXICITY.summaryScore > TOXICITY_THRESHOLD; + if (input.checkToxicity && isToxic) { throw ErrToxic; } input.metadata = Object.assign({}, input.metadata, { perspective: scores, }); + + if (isToxic) { + + // TODO: Flag comment as toxic and put in ?premod?. + } }, }, },