mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
feat(challenges): slur blocker work
This commit is contained in:
@@ -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();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user