Update name censor to check for certain substrings (#3603)

## Description:

The deduper was converting profane words like "kkk" => "k" and then
censoring all usernames with the letter "k", so instead we just hardcode
and check for substrings for profane phrases like that.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

evan
This commit is contained in:
Evan
2026-04-06 14:18:32 -07:00
committed by GitHub
parent 0a117aead3
commit 2f95314dce
2 changed files with 22 additions and 2 deletions
+6 -2
View File
@@ -84,7 +84,9 @@ export function createMatcher(bannedWords: string[]): RegExpMatcher {
});
return {
hasMatch: (input: string) =>
substringMatcher.hasMatch(input) || collapseMatcher.hasMatch(input),
input.toLowerCase().includes("kkk") ||
substringMatcher.hasMatch(input) ||
collapseMatcher.hasMatch(input),
getAllMatches: (input: string, sorted?: boolean) => [
...substringMatcher.getAllMatches(input, sorted),
...collapseMatcher.getAllMatches(input, sorted),
@@ -118,7 +120,9 @@ function censorUsernameWithMatcher(
? username.replace(`[${clanTag}]`, "").trim()
: username;
const clanTagIsProfane = clanTag ? matcher.hasMatch(clanTag) : false;
const clanTagIsProfane = clanTag
? matcher.hasMatch(clanTag) || clanTag.toLowerCase() === "ss"
: false;
const usernameIsProfane = matcher.hasMatch(nameWithoutClan);
const censoredName = usernameIsProfane