feat(challenges): slur blocker

This commit is contained in:
CuriousMagpie
2023-11-13 15:12:14 -05:00
parent 315ea24ef4
commit 50e824e4e3

View File

@@ -247,13 +247,20 @@ api.createChallenge = {
}); });
// check challenge for slurs // check challenge for slurs
if (group.privacy === 'public' && textContainsBannedSlur(req.body.name)) { if (group.privacy === 'public'
const { message } = req.body; && ((textContainsBannedSlur(req.body.name))
|| (textContainsBannedSlur(req.body.shortName))
|| (textContainsBannedSlur(req.body.summary))
|| (textContainsBannedSlur(req.body.description)))) {
const { message } = req.body.name
&& req.body.shortName
&& req.body.summary
&& req.body.description;
user.flags.chatRevoked = true; user.flags.chatRevoked = true;
await user.save(); await user.save();
// note to Natalie: // note to Natalie:
// needs to also check all fields and actually prevent challenge from being saved // does this need to shadow-mute the user? And what about hiding the challenge
// and actually block the user // until the language can be corrected?
// email mods // email mods
const authorEmail = getUserInfo(user, ['email']).email; const authorEmail = getUserInfo(user, ['email']).email;