-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Latest Comments: Add option to display full comments #72665
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
Latest Comments: Add option to display full comments #72665
Conversation
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
… validation Adds new test fixtures for the core/latest-comments block to verify the deprecated v1 migration path. Includes: - core__latest-comments__deprecated-v1.html - core__latest-comments__deprecated-v1.json - core__latest-comments__deprecated-v1.serialized.html These fixtures ensure correct migration from legacy 'displayExcerpt' to the new 'displayContent' attribute.
|
Adds new test fixtures for the core/latest-comments block to verify the deprecated v1 migration path.
|
|
@sidharthpandita1 This PR contains a lot of changes. See the file diff: https://github.com/WordPress/gutenberg/pull/72665/files |
I didn’t make significant modifications to these files — the large diff is likely due to some whitespace or indentation differences introduced during copy–paste. |
Regardless of the cause, as the CI failures indicate, these changes are unacceptable. Could you revert the unnecessary changes? |
Absolutely !! |
|
@t-hamano removed the extra spacing/indentation of block.json, should i continue the same for the rest? |
|
@sidharthpandita1 Yes. It would also be a good idea to correctly update the PR title and description. |
|
@t-hamano changes made accordingly ! |
|
@sidharthpandita1 There are still a lot of unnecessary changes. Most of them are because the indentation is done with spaces instead of tabs. Can you run the following commands?
|
|
commands ran successfully @t-hamano |
Co-authored-by: Aki Hamano <[email protected]>
Co-authored-by: Aki Hamano <[email protected]>
Co-authored-by: Aki Hamano <[email protected]>
t-hamano
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update! I think we're almost finished 🙏 Finally, could you run npm run fixtures:regenerate one more time?
Co-authored-by: Aki Hamano <[email protected]>
Co-authored-by: Aki Hamano <[email protected]>
Co-authored-by: Aki Hamano <[email protected]>
command ran successfully ! |
t-hamano
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Finally, could you run npm run docs:build? This should ensure that all CI jobs succeed.
Done ! |
What?
Closes #72348
Replaces the "Display excerpt" toggle with a "Display content" dropdown in the Latest Comments block, providing three options: No content, Excerpt, and Full content.
Why?
The Latest Comments block currently only offers a binary choice (show excerpt or hide it). This limits flexibility for users who want to display the full comment text or hide comment content entirely while still showing author information and metadata. This enhancement provides more granular control over comment display.
How?
block.jsonto replace thedisplayExcerptboolean attribute with a newdisplayContentstring attribute (enum: "none", "excerpt", "full")edit.jsto replace theToggleControlwith aSelectControldropdown offering three optionsdeprecated.jswith migration logic to automatically convert blocks using the olddisplayExcerptboolean to the newdisplayContentstring formatindex.phprendering logic to:displayExcerptattribute firstget_comment_text()when "Full content" is selectedget_comment_excerpt()when "Excerpt" is selectedhas-excerptsclass when content is displayedcore__latest-comments__deprecated-v1.*) to verify migration works correctlyTesting Instructions
Backward Compatibility Testing
<!-- wp:latest-comments {"displayExcerpt":false} /-->"displayContent":"none"instead of"displayExcerpt":false{"displayExcerpt":true}and verify it migrates to"displayContent":"excerpt"Testing Instructions for Keyboard
/then type "latest comments")Tabto navigate to the block toolbar, then continue tabbing to reach the settings sidebarTabto navigate to the "Display content" dropdownSpaceorEnterto open the dropdownArrow Up/Downkeys to navigate through the three optionsEnterto select an optionTabto navigate to other settings and ensure keyboard navigation works smoothly throughoutScreenshots or screencast
Screen.Recording.2025-10-21.at.1.08.29.AM.mov
Additional Notes
has-excerptsis applied when content is displayed (excerpt or full)get_comment_text()as suggested in the original issuewpautop()for proper paragraph formattingdisplayExcerptattribute are automatically migrated via deprecation logic when edited, and render correctly on the frontend via PHP fallback logicisEligible()check that only runs when the legacydisplayExcerptattribute existsdisplayExcerpt: false→displayContent: "none"anddisplayExcerpt: true→displayContent: "excerpt"works correctly