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