Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement automated content filtering (User Story #1) #47

Merged
merged 13 commits into from
Oct 20, 2024

Conversation

mohamed-elzeni
Copy link
Member

@mohamed-elzeni mohamed-elzeni commented Oct 20, 2024

This adds an automated content filtering system to prevent users from creating posts that contain inappropriate words.

This is done by importing a predefined list of inappropriate words from the inappropriate-words.json file, where the module in src/filters.js has been created to perform that. Then, this module exposes the getInappropriateWords method to be used in loading these words when needed for filtering. A function was created for checking a given text against the list. And the text of any post or reply that the user attempts to post is first given to this function, and if it flags it as inappropriate, the user is given a warning message and prevented from posting.

This also adds comprehensive automated tests. Testing for this feature is explained in more detail in UserGuide.md.

The following files were added:

  • inappropriate-words.json
  • src/filters.js

And the following files were modified:

  • src/topics/create.js
  • test/posts.js

This resolves #2, #3, and #4, fully completing User Story 1 and resolving #18.

@mohamed-elzeni mohamed-elzeni added enhancement New feature or request frontend main code is written in frontend backend main code is written in backend High impact Features that have a high impact on the application Moderate effort Features that need moderate effort to implement Test This tests features that were implemented labels Oct 20, 2024
@mohamed-elzeni mohamed-elzeni added this to the Sprint 2 milestone Oct 20, 2024
@mohamed-elzeni mohamed-elzeni removed the frontend main code is written in frontend label Oct 20, 2024
@coveralls
Copy link

Pull Request Test Coverage Report for Build 11428259809

Details

  • 9 of 12 (75.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.007%) to 82.675%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/topics/create.js 6 9 66.67%
Totals Coverage Status
Change from base Build 11057241668: -0.007%
Covered Lines: 22362
Relevant Lines: 25627

💛 - Coveralls

Copy link

@lhitmi lhitmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks very clear!

Copy link

@akobaidan akobaidan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the code looks clear and effective.

@mohamed-elzeni mohamed-elzeni removed the request for review from aattiyah October 20, 2024 18:29
@mohamed-elzeni mohamed-elzeni merged commit 725b800 into f24 Oct 20, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend main code is written in backend enhancement New feature or request High impact Features that have a high impact on the application Moderate effort Features that need moderate effort to implement Test This tests features that were implemented
Projects
None yet
5 participants