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
if (group.privacy === 'public'
&& textContainsBannedSlur(req.workingChallenge.name
|| req.workingChallenge.shortName
|| req.workingChallenge.summary
|| req.workingChallenge.description)) {
if (group.privacy === 'public' && textContainsBannedSlur(req.body.name)) {
const { message } = req.body;
user.flags.chatRevoked = true;
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
const authorEmail = getUserInfo(user, ['email']).email;
@@ -271,11 +270,7 @@ api.createChallenge = {
}
// prevent banned words being posted, except in private challenges
if (group.privacy === 'public'
&& textContainsBannedWord(req.workingChallenge.name
|| req.workingChallenge.shortName
|| req.workingChallenge.summary
|| req.workingChallenge.description)) {
if (group.privacy === 'public' && textContainsBannedWord(req.body.name)) {
const { message } = req.body;
await user.save();