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

Comments controller: fix issue where comments are allowed when closed #66976

Merged
merged 2 commits into from
Nov 14, 2024

Conversation

ellatrix
Copy link
Member

@ellatrix ellatrix commented Nov 13, 2024

What?

The comments endpoint allows no type to be specified, in which case comment should be assumed.

https://github.com/WordPress/wordpress-develop/blob/a27e6a8ecd5279a45e47ef88d048643740d07b5a/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php#L591

Why?

Comments can be submitted even if comments are closed.

How?

Testing Instructions

Testing Instructions for Keyboard

Screenshots or screencast

@ellatrix ellatrix added [Priority] High Used to indicate top priority items that need quick attention [Type] Regression Related to a regression in the latest release labels Nov 13, 2024
Copy link

github-actions bot commented Nov 13, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @xavier-lc.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: xavier-lc.

Co-authored-by: ellatrix <[email protected]>
Co-authored-by: Mamaduka <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@ellatrix ellatrix added the No Core Sync Required Indicates that any changes do not need to be synced to WordPress Core label Nov 13, 2024
Copy link

@xavier-lc xavier-lc left a comment

Choose a reason for hiding this comment

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

Tested locally via curl and it returns the proper response:

{"body":{"code":"rest_comment_closed","message":"Sorry, comments are closed for this item.","data":{"status":403}},"status":403,"headers":{"Allow":"GET"}}

Copy link

Flaky tests detected in 904a28e.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11822624735
📝 Reported issues:

@ellatrix ellatrix merged commit 4d0245c into trunk Nov 14, 2024
65 checks passed
@ellatrix ellatrix deleted the fix/comments-on-closed branch November 14, 2024 13:06
@github-actions github-actions bot added this to the Gutenberg 19.8 milestone Nov 14, 2024
@priethor priethor added Backport to Gutenberg Minor Release Pull request that needs to be backported to a Gutenberg minor release Backport to Gutenberg RC Pull request that needs to be backported to a Gutenberg release candidate (RC) labels Nov 14, 2024
@priethor
Copy link
Contributor

I just cherry-picked this PR to the release/19.6 branch to get it included in the next release: af38d43

priethor pushed a commit that referenced this pull request Nov 14, 2024
…#66976)

Unlinked contributors: xavier-lc.

Co-authored-by: ellatrix <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
@priethor priethor removed the Backport to Gutenberg Minor Release Pull request that needs to be backported to a Gutenberg minor release label Nov 14, 2024
priethor pushed a commit that referenced this pull request Nov 14, 2024
…#66976)

Unlinked contributors: xavier-lc.

Co-authored-by: ellatrix <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
@priethor
Copy link
Contributor

I just cherry-picked this PR to the release/19.7 branch to get it included in the next release: 14c270e

@priethor priethor removed the Backport to Gutenberg RC Pull request that needs to be backported to a Gutenberg release candidate (RC) label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
No Core Sync Required Indicates that any changes do not need to be synced to WordPress Core [Priority] High Used to indicate top priority items that need quick attention [Type] Regression Related to a regression in the latest release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants