From b3fe3afd4cc4ed1c3336f4d51a65159a719baa5a Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Wed, 6 Sep 2017 22:20:19 +0700 Subject: [PATCH] Add todo --- plugins/talk-plugin-toxic-comments/server/hooks.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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?. + } }, }, },