From a771045ca7dde5bd4edea83dcb5572e093da95f1 Mon Sep 17 00:00:00 2001 From: CuriousMagpie Date: Tue, 14 Nov 2023 15:46:16 -0500 Subject: [PATCH] feat(challenges): even more slur blocker --- website/common/locales/en/groups.json | 2 +- website/server/controllers/api-v3/challenges.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/website/common/locales/en/groups.json b/website/common/locales/en/groups.json index d12ec31ebe..54ab327ab0 100644 --- a/website/common/locales/en/groups.json +++ b/website/common/locales/en/groups.json @@ -18,7 +18,7 @@ "communityGuidelines": "Community Guidelines", "bannedWordUsed": "Oops! Looks like this post contains a swearword or reference to an addictive substance or adult topic (<%= swearWordsUsed %>). Habitica keeps our chat very clean. Feel free to edit your message so you can post it! You must remove the word, not just censor it.", "bannedSlurUsed": "Your post contained inappropriate language, and your chat privileges have been revoked.", - "challengeBannedWordsAndSlurs": "Your challenge contains either a swear word or other inappropriate language. Please remove in order to continue with your challenge creation.", + "challengeBannedWordsAndSlurs": "Your Challenge contains one or more words that violate Habitica’s community guidelines.", "party": "Party", "usernameCopied": "Username copied to clipboard.", "create": "Create", diff --git a/website/server/controllers/api-v3/challenges.js b/website/server/controllers/api-v3/challenges.js index 3503545c97..6209d8f92c 100644 --- a/website/server/controllers/api-v3/challenges.js +++ b/website/server/controllers/api-v3/challenges.js @@ -225,7 +225,7 @@ api.createChallenge = { const validationErrors = req.validationErrors(); if (validationErrors) throw validationErrors; - const { group } = (user, req, req); + const { savedChal, group } = await createChallenge(user, req, res); // checks challenge for slurs and banned words if (group.privacy === 'public' @@ -236,7 +236,7 @@ api.createChallenge = { throw new BadRequest(res.t('challengeBannedWordsAndSlurs')); } - const { savedChal } = await createChallenge(user, req, res); + await user.save(); const response = savedChal.toJSON(); response.leader = { // the leader is the authenticated user