diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 9cabbc49368947..f3d23c778bd3e1 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -19,7 +19,7 @@ /packages/block-library/src/navigation-submenu @tellthemachines /packages/block-library/src/page-list @tellthemachines /packages/block-library/src/comment-template @michalczaplinski -/packages/block-library/src/comments-query-loop @michalczaplinski +/packages/block-library/src/comments @michalczaplinski # Duotone /lib/block-supports/duotone.php @ajlende diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index 260212e376174a..045bfc7b401ebf 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -170,6 +170,15 @@ Contains the block elements used to display a comment, like the title, date, aut - **Supports:** align, ~~html~~, ~~reusable~~ - **Attributes:** +## Comments + +An advanced block that allows displaying post comments using different visual configurations. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comments)) + +- **Name:** core/comments-query-loop +- **Category:** theme +- **Supports:** align (full, wide), color (background, gradients, link, text), ~~html~~ +- **Attributes:** tagName + ## Comments Pagination Displays a paginated navigation to next/previous set of comments, when applicable. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comments-pagination)) @@ -206,15 +215,6 @@ Displays the previous comment's page link. ([Source](https://github.com/WordPres - **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** label -## Comments Query Loop - -An advanced block that allows displaying post comments using different visual configurations. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comments-query-loop)) - -- **Name:** core/comments-query-loop -- **Category:** theme -- **Supports:** align (full, wide), color (background, gradients, link, text), ~~html~~ -- **Attributes:** tagName - ## Comments Title Displays a title with the number of comments ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comments-title)) @@ -478,7 +478,7 @@ The author name. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/pac ## Post Comment (deprecated) -This block is deprecated. Please use the Comments Query Loop block instead. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-comment)) +This block is deprecated. Please use the Comments block instead. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-comment)) - **Name:** core/post-comment - **Category:** theme @@ -487,7 +487,7 @@ This block is deprecated. Please use the Comments Query Loop block instead. ([So ## Post Comments (deprecated) -This block is deprecated. Please use the Comments Query Loop block instead. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-comments)) +This block is deprecated. Please use the Comments block instead. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-comments)) - **Name:** core/post-comments - **Category:** theme diff --git a/lib/blocks.php b/lib/blocks.php index 816aceb777d886..10c052954ad7d4 100644 --- a/lib/blocks.php +++ b/lib/blocks.php @@ -21,7 +21,7 @@ function gutenberg_reregister_core_block_types() { 'code', 'column', 'columns', - 'comments-query-loop', + 'comments', 'group', 'heading', 'html', diff --git a/packages/block-library/src/comments-query-loop/block.json b/packages/block-library/src/comments/block.json similarity index 94% rename from packages/block-library/src/comments-query-loop/block.json rename to packages/block-library/src/comments/block.json index fecbd7c92f6bb7..fbdfdd253b278b 100644 --- a/packages/block-library/src/comments-query-loop/block.json +++ b/packages/block-library/src/comments/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 2, "name": "core/comments-query-loop", - "title": "Comments Query Loop", + "title": "Comments", "category": "theme", "description": "An advanced block that allows displaying post comments using different visual configurations.", "textdomain": "default", diff --git a/packages/block-library/src/comments-query-loop/edit.js b/packages/block-library/src/comments/edit.js similarity index 94% rename from packages/block-library/src/comments-query-loop/edit.js rename to packages/block-library/src/comments/edit.js index fa7f048a285f09..14303fe7c54584 100644 --- a/packages/block-library/src/comments-query-loop/edit.js +++ b/packages/block-library/src/comments/edit.js @@ -68,7 +68,7 @@ const TEMPLATE = [ [ 'core/post-comments-form' ], ]; -export default function CommentsQueryLoopEdit( { attributes, setAttributes } ) { +export default function CommentsEdit( { attributes, setAttributes } ) { const { tagName: TagName } = attributes; const blockProps = useBlockProps(); diff --git a/packages/block-library/src/comments-query-loop/edit/comments-inspector-controls.js b/packages/block-library/src/comments/edit/comments-inspector-controls.js similarity index 100% rename from packages/block-library/src/comments-query-loop/edit/comments-inspector-controls.js rename to packages/block-library/src/comments/edit/comments-inspector-controls.js diff --git a/packages/block-library/src/comments-query-loop/editor.scss b/packages/block-library/src/comments/editor.scss similarity index 100% rename from packages/block-library/src/comments-query-loop/editor.scss rename to packages/block-library/src/comments/editor.scss diff --git a/packages/block-library/src/comments-query-loop/index.js b/packages/block-library/src/comments/index.js similarity index 100% rename from packages/block-library/src/comments-query-loop/index.js rename to packages/block-library/src/comments/index.js diff --git a/packages/block-library/src/comments-query-loop/save.js b/packages/block-library/src/comments/save.js similarity index 69% rename from packages/block-library/src/comments-query-loop/save.js rename to packages/block-library/src/comments/save.js index dc080f0f413444..47c774fc4b9bb1 100644 --- a/packages/block-library/src/comments-query-loop/save.js +++ b/packages/block-library/src/comments/save.js @@ -3,9 +3,7 @@ */ import { InnerBlocks, useBlockProps } from '@wordpress/block-editor'; -export default function CommentsQueryLoopSave( { - attributes: { tagName: Tag }, -} ) { +export default function CommentsSave( { attributes: { tagName: Tag } } ) { return ( diff --git a/packages/block-library/src/editor.scss b/packages/block-library/src/editor.scss index 5e1b6d7afa733b..ba031d6cbdeaa9 100644 --- a/packages/block-library/src/editor.scss +++ b/packages/block-library/src/editor.scss @@ -6,8 +6,8 @@ @import "./buttons/editor.scss"; @import "./categories/editor.scss"; @import "./columns/editor.scss"; +@import "./comments/editor.scss"; @import "./comment-author-avatar/editor.scss"; -@import "./comments-query-loop/editor.scss"; @import "./comments-pagination/editor.scss"; @import "./comments-pagination-numbers/editor.scss"; @import "./comments-title/editor.scss"; diff --git a/packages/block-library/src/index.js b/packages/block-library/src/index.js index 4db6f860b6cd3d..b4ef7507f368a3 100644 --- a/packages/block-library/src/index.js +++ b/packages/block-library/src/index.js @@ -23,6 +23,7 @@ import * as classic from './freeform'; import * as code from './code'; import * as column from './column'; import * as columns from './columns'; +import * as comments from './comments'; import * as commentAuthorAvatar from './comment-author-avatar'; import * as commentAuthorName from './comment-author-name'; import * as commentContent from './comment-content'; @@ -31,7 +32,6 @@ import * as commentEditLink from './comment-edit-link'; import * as commentReplyLink from './comment-reply-link'; import * as commentTemplate from './comment-template'; import * as commentsPaginationPrevious from './comments-pagination-previous'; -import * as commentsQueryLoop from './comments-query-loop'; import * as commentsPagination from './comments-pagination'; import * as commentsPaginationNext from './comments-pagination-next'; import * as commentsPaginationNumbers from './comments-pagination-numbers'; @@ -206,6 +206,7 @@ export const __experimentalGetCoreBlocks = () => [ queryPaginationPrevious, queryNoResults, readMore, + comments, commentAuthorName, commentContent, commentDate, @@ -213,12 +214,10 @@ export const __experimentalGetCoreBlocks = () => [ commentReplyLink, commentTemplate, commentsTitle, - commentsQueryLoop, commentsPagination, commentsPaginationNext, commentsPaginationNumbers, commentsPaginationPrevious, - postComments, postCommentsForm, homeLink, diff --git a/packages/block-library/src/post-comment/block.json b/packages/block-library/src/post-comment/block.json index 5210253b6447c3..cc8311cfce5473 100644 --- a/packages/block-library/src/post-comment/block.json +++ b/packages/block-library/src/post-comment/block.json @@ -4,7 +4,7 @@ "name": "core/post-comment", "title": "Post Comment (deprecated)", "category": "theme", - "description": "This block is deprecated. Please use the Comments Query Loop block instead.", + "description": "This block is deprecated. Please use the Comments block instead.", "textdomain": "default", "attributes": { "commentId": { diff --git a/packages/block-library/src/post-comments/block.json b/packages/block-library/src/post-comments/block.json index 6c5c4e16b8f748..dc719fff5d7081 100644 --- a/packages/block-library/src/post-comments/block.json +++ b/packages/block-library/src/post-comments/block.json @@ -4,7 +4,7 @@ "name": "core/post-comments", "title": "Post Comments (deprecated)", "category": "theme", - "description": "This block is deprecated. Please use the Comments Query Loop block instead.", + "description": "This block is deprecated. Please use the Comments block instead.", "textdomain": "default", "attributes": { "textAlign": { diff --git a/packages/block-library/src/post-comments/edit.js b/packages/block-library/src/post-comments/edit.js index 248922da8b19e6..723280d6416cf9 100644 --- a/packages/block-library/src/post-comments/edit.js +++ b/packages/block-library/src/post-comments/edit.js @@ -53,7 +53,7 @@ export default function PostCommentsEdit( { ); let warning = __( - 'Post Comments block: This is just a placeholder, not a real comment. The final styling may differ because it also depends on the current theme. For better compatibility with the Block Editor, please consider replacing this block with the "Comments Query Loop" block.' + 'Post Comments block: This is just a placeholder, not a real comment. The final styling may differ because it also depends on the current theme. For better compatibility with the Block Editor, please consider replacing this block with the "Comments" block.' ); let showPlaceholder = true; diff --git a/packages/e2e-tests/specs/editor/blocks/comments-query.test.js b/packages/e2e-tests/specs/editor/blocks/comments.test.js similarity index 95% rename from packages/e2e-tests/specs/editor/blocks/comments-query.test.js rename to packages/e2e-tests/specs/editor/blocks/comments.test.js index 5f142aee56c75a..19b4704b676fb9 100644 --- a/packages/e2e-tests/specs/editor/blocks/comments-query.test.js +++ b/packages/e2e-tests/specs/editor/blocks/comments.test.js @@ -11,7 +11,7 @@ import { trashAllComments, } from '@wordpress/e2e-test-utils'; -describe( 'Comment Query Loop', () => { +describe( 'Comments', () => { let previousPageComments, previousCommentsPerPage, previousDefaultCommentsPage; @@ -27,12 +27,12 @@ describe( 'Comment Query Loop', () => { it( 'We show no results message if there are no comments', async () => { await trashAllComments(); await createNewPost(); - await insertBlock( 'Comments Query Loop' ); + await insertBlock( 'Comments' ); await page.waitForXPath( '//p[contains(text(), "No results found.")]' ); } ); it( 'Pagination links are working as expected', async () => { await createNewPost(); - await insertBlock( 'Comments Query Loop' ); + await insertBlock( 'Comments' ); await insertBlock( 'Post Comments Form' ); await publishPost(); // Visit the post that was just published. @@ -93,7 +93,7 @@ describe( 'Comment Query Loop', () => { it( 'Pagination links are not appearing if break comments is not enabled', async () => { await setOption( 'page_comments', '0' ); await createNewPost(); - await insertBlock( 'Comments Query Loop' ); + await insertBlock( 'Comments' ); await insertBlock( 'Post Comments Form' ); await publishPost(); // Visit the post that was just published.