feat(challenges): slur blocker work

This commit is contained in:
CuriousMagpie
2023-11-03 12:31:12 -04:00
parent 0f742d219f
commit 315ea24ef4

View File

@@ -247,14 +247,13 @@ api.createChallenge = {
}); });
// check challenge for slurs // check challenge for slurs
if (group.privacy === 'public' if (group.privacy === 'public' && textContainsBannedSlur(req.body.name)) {
&& textContainsBannedSlur(req.workingChallenge.name
|| req.workingChallenge.shortName
|| req.workingChallenge.summary
|| req.workingChallenge.description)) {
const { message } = req.body; const { message } = req.body;
user.flags.chatRevoked = true; user.flags.chatRevoked = true;
await user.save(); await user.save();
// note to Natalie:
// needs to also check all fields and actually prevent challenge from being saved
// and actually block the user
// email mods // email mods
const authorEmail = getUserInfo(user, ['email']).email; const authorEmail = getUserInfo(user, ['email']).email;
@@ -271,11 +270,7 @@ api.createChallenge = {
} }
// prevent banned words being posted, except in private challenges // prevent banned words being posted, except in private challenges
if (group.privacy === 'public' if (group.privacy === 'public' && textContainsBannedWord(req.body.name)) {
&& textContainsBannedWord(req.workingChallenge.name
|| req.workingChallenge.shortName
|| req.workingChallenge.summary
|| req.workingChallenge.description)) {
const { message } = req.body; const { message } = req.body;
await user.save(); await user.save();