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

Comment Query Loop: Unmoderated previews do not display. #40601

Closed
peterwilsoncc opened this issue Apr 25, 2022 · 3 comments · Fixed by #40612
Closed

Comment Query Loop: Unmoderated previews do not display. #40601

peterwilsoncc opened this issue Apr 25, 2022 · 3 comments · Fixed by #40612
Assignees
Labels
[Block] Comments Affects the Comments Block - formerly known as Comments Query Loop [Type] Bug An existing feature does not function as intended

Comments

@peterwilsoncc
Copy link
Contributor

peterwilsoncc commented Apr 25, 2022

Description

In the comments template, WordPress displays a preview of unmoderated comments to the commenter.

These are either displayed based on cookies or a moderation hash if the commenter didn't consent to cookies during the commenting process.

https://github.com/WordPress/wordpress-develop/blob/77561d0a3010ff014de0b2210f39a59f0c4db01e/src/wp-includes/comment-template.php#L2145-L2153

The preview comment is displayed with:

  • header text: Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.
  • comment stripped of all HTML

Anti-spam features (edit)

Since the moderation hash preview feature was introduced in Core, a few anti-spam features needed to be added for the previews:

  • comment author block: For unapproved comments, do not include the author link regardless of the block settings (see wp-develop source)
  • comment text display: this is the filter used in WP Develop the hide links when using the moderation hack -- it could probably do with some fine tuning to simply remove links.

See https://core.trac.wordpress.org/ticket/49956 for further details.

Step-by-step reproduction instructions

  1. Set up a site with Twenty Twenty One
  2. In the dashboard, configure the site to require all comments to need approval
  3. In the dashboard, ensure any anti-spam plugins are disabled
  4. Create and publish a sample post
  5. Open a private/incognito browser window
  6. Leave a comment on the new post
  7. Observe you are shown a preview of your comment
  8. Close the private/incognito browser window
  9. Switch to 2022
  10. Configure comments to be displayed using the new comment query loop
  11. Open a private/incognito browser window
  12. . Leave a comment on the new post
  13. Observe you are not shown a preview of your comment

Screenshots, screen recording, code snippet

Screen Shot 2022-04-26 at 9 30 55 am

Example from 2021.

Environment info

  • WordPress 6.0-beta2
  • Gutenberg inactive
  • 2022 theme

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@amustaque97 amustaque97 added the [Block] Comments Affects the Comments Block - formerly known as Comments Query Loop label Apr 26, 2022
@luisherranz luisherranz added the [Type] Bug An existing feature does not function as intended label Apr 26, 2022
@cbravobernal cbravobernal self-assigned this Apr 26, 2022
@cbravobernal
Copy link
Contributor

Using Comments Query Loop displays the message as expected.

Screenshot 2022-04-26 at 11 12 39

It seems that Post Comments block is the one having this one. That block has been in Gutemberg for a lot of time and uses default WordPress functions to show the comments, I will take a look at that.

@DAreRodz
Copy link
Contributor

@c4rl0sbr4v0, I was able to reproduce the bug using the steps shared by @peterwilsoncc.

I'm taking a look at the issue as well. 👀

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Apr 26, 2022
@peterwilsoncc
Copy link
Contributor Author

I've edited the description to document the anti-spam features added for previews via the moderation hash. It turns out spammers are smart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Comments Affects the Comments Block - formerly known as Comments Query Loop [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants