Skip to content

Commit

Permalink
Comments Query Loop block: Rename to Comments (but keep ID) (#40763)
Browse files Browse the repository at this point in the history
Co-authored-by: Carlos Bravo <[email protected]>
Co-authored-by: Michal Czaplinski <[email protected]>
  • Loading branch information
3 people authored May 3, 2022
1 parent 7f3488a commit d8eb4c5
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 11 additions & 11 deletions docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function gutenberg_reregister_core_block_types() {
'code',
'column',
'columns',
'comments-query-loop',
'comments',
'group',
'heading',
'html',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Tag { ...useBlockProps.save() }>
<InnerBlocks.Content />
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
5 changes: 2 additions & 3 deletions packages/block-library/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
Expand Down Expand Up @@ -206,19 +206,18 @@ export const __experimentalGetCoreBlocks = () => [
queryPaginationPrevious,
queryNoResults,
readMore,
comments,
commentAuthorName,
commentContent,
commentDate,
commentEditLink,
commentReplyLink,
commentTemplate,
commentsTitle,
commentsQueryLoop,
commentsPagination,
commentsPaginationNext,
commentsPaginationNumbers,
commentsPaginationPrevious,

postComments,
postCommentsForm,
homeLink,
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/post-comment/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/post-comments/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/post-comments/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
trashAllComments,
} from '@wordpress/e2e-test-utils';

describe( 'Comment Query Loop', () => {
describe( 'Comments', () => {
let previousPageComments,
previousCommentsPerPage,
previousDefaultCommentsPage;
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit d8eb4c5

Please sign in to comment.