Slur swear blocker challenges redux (#15089)

* update packages on local/origin repo

* feat(challenges): add banned words & slur blocker to challenges

* feat(challenges): slur blocker work

* feat(challenges): slur blocker

* feat(challenges): more slur blocker

* feat(challenges): even more slur blocker

* feat(challenges): swear and slur blocker

* feat(challenges): update behavior based on public/private groups

* feat(profiles): slur/swear blocker

* feat(profiles): slur/swear blocker

* feat(profiles/PMs): slur/swear blocker upgrade

* feat(slur/swear): working on it

* feat(profiles/challenges): work on profile block & slack report

* feat(slur/swear blocker): work on Profiles

* feat(slur blocker): refactoring code

* feat(slur blocker): more refactoring

* feat(slur blocker): arghhhhhh

* fix(profiles): improve profanity check logic

* fix(slack): update Slack notification to include authorEmail and remove undefined

* feat(s/s blocker): work on challenges

* feat(s/s blocker): challenge update

* feat(s/s blocker): slack notifs refinements

* feat(s/s blocker): refine slack notifs & disallow use of challenges POST API route if user is chatRevoked:true in db

* update package.json and package-lock.json

* attempt to disable create challenge button for muted users

* another attempt to disable create challenge

* block muted users from creating challenges

* CSS button fun

* fix CSS button

* refactor(css): move button style to global
Also, disable Clone button if user is chat revoked

* fix(lint): remove unused fn

* fix(challenges): handle null slur check

* fix(groups): throw notFound earlier

* fix(challenges): CSS and logic updates

* fix(lint): remove whitespace

* fix(challenges): don't disable create buttons

* fix(slack): restore broken profile flag fields

* chore(cleanup): remove comments and whitespace

* chore(cleanup): one more white space

---------

Co-authored-by: SabreCat <sabe@habitica.com>
This commit is contained in:
Natalie
2024-01-16 15:22:03 -05:00
committed by GitHub
parent 8b2e13b5fd
commit 4cbc3d7664
14 changed files with 166 additions and 86 deletions

View File

@@ -11,9 +11,7 @@ const bannedSlurRegexes = bannedSlurs.map(word => new RegExp(`\\b([^a-z]+)?${wor
const bannedWordRegexes = bannedWords.map(word => new RegExp(`\\b([^a-z]+)?${word}([^a-z]+)?\\b`, 'i'));
export function stringContainsProfanity (str, profanityType = 'bannedWord') {
const bannedRegexes = profanityType === 'slur'
? bannedSlurRegexes
: bannedWordRegexes;
const bannedRegexes = profanityType === 'slur' ? bannedSlurRegexes : bannedWordRegexes;
for (let i = 0; i < bannedRegexes.length; i += 1) {
const regEx = bannedRegexes[i];