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

Add spam checking on pattern submissions #406

Merged
merged 15 commits into from
Mar 11, 2022

Conversation

dd32
Copy link
Member

@dd32 dd32 commented Feb 23, 2022

This PR adds some anti-spam checks to pattern submissions:

  • Akismet
  • Basic paragraph-only detection (ie. if a submission is only paragraphs, it's likely to require manual review / be an automated bot)
  • A keyword to use for testing the spam process.

In order to simplify the text being checked, I leveraged the Pattern Translator codebase to extract all strings from the submitted content, rather than simply passing the HTML to Akismet, to avoid any issues related to HTML.

See #22

How to test the changes in this Pull Request:

  1. Apply PR
  2. Create a Spam pattern. (Either by including PatternDirectorySpamTest within the content, or the pattern only containing core/paragraph blocks)
  3. Verify that the post is pending review.

You can also try running yarn test:php however I've been unable to run phpunit locally due to wp-env problems, so I'm not able to check the unit test additions actually work.

@dd32 dd32 added [Component] Pattern Creator Anything related to the pattern front end editor or preview [Component] Pattern Directory The backend of the pattern directory: submission, management, etc labels Feb 23, 2022
Copy link
Contributor

@ryelle ryelle left a comment

Choose a reason for hiding this comment

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

The tests pass locally, and on the PR itself. Manually tested as well. I haven't been able to trigger Akismet spamming a pattern, but the other two checks work as expected.

@ryelle ryelle added this to the Pattern Creation milestone Mar 2, 2022
@ryelle ryelle merged commit b73e61d into WordPress:trunk Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Component] Pattern Creator Anything related to the pattern front end editor or preview [Component] Pattern Directory The backend of the pattern directory: submission, management, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants