Skip to content
This repository was archived by the owner on May 7, 2024. It is now read-only.

Word filter#62

Merged
sopyb merged 4 commits intomasterfrom
wordFilter
Sep 20, 2023
Merged

Word filter#62
sopyb merged 4 commits intomasterfrom
wordFilter

Conversation

@sopyb
Copy link
Copy Markdown
Owner

@sopyb sopyb commented Sep 20, 2023

No description provided.

Implemented a profanity filter under utility directory. This includes a ProfanityFilterUtil.ts file consisting of functions to check strings and objects for profane words. It is accompanied by a WordList.ts file that contains a list of bad word patterns. These additions are aimed at preventing misuse of our platform by limiting language that could be offensive or inappropriate.
Introduced a profanity checker logic to screen the content of roadmaps during creation or update. The created or updated roadmap is set to 'public' only when it passes through the profanity check. This validation is done by the new validation functions added to 'validateRoadmapData.ts'. Aimed at maintaining a more cordial environment on the platform.
Enhanced profanity filter with 'checkWordProfanity' to check individual words in a string, ensuring a more accurate filtering. Applied this new filter to roadmap titles and descriptions in 'validateRoadmapIsProfane.ts' to prevent posting inappropriate content. Filter now also functions with case-insensitive regex, addressing variability in text case. Effort to uphold a respectful community environment.
To promote a respectful community, roadmaps containing profanity are now automatically flagged as drafts. A new condition has been added to roadmapController to implement this. If a roadmap fails the profanity check (isPublic equals false), it's marked as draft and will require a manual review before being visible publicly. This applies universally to all instances where a roadmap is created or updated.
@sopyb sopyb merged commit dd1d059 into master Sep 20, 2023
if (typeof value === 'object') {
// justified by the fact that value is already checked to be an object
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore

Check failure

Code scanning / ESLint

Disallow `@ts-<directive>` comments or require descriptions after directives

Do not use "@ts-ignore" because it alters compilation errors.
if (typeof value === 'object') {
// justified by the fact that value is already checked to be an object
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
return checkObjectProfanity(value);

Check failure

Code scanning / ESLint

Disallow calling a function with a value with type `any`

Unsafe argument of type `any` assigned to a parameter of type `object | Record<string, never>`.
@sopyb sopyb deleted the wordFilter branch September 20, 2023 09:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants