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

Block Library: Deprecate the Post Comment block #36032

Merged
merged 3 commits into from
Nov 2, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"apiVersion": 2,
"name": "core/post-comment-author-avatar",
"title": "Comment Author Avatar",
"category": "design",
"parent": [ "core/post-comment" ],
"description": "Comment Author Avatar.",
"category": "theme",
"parent": [ "core/comment-template" ],
"description": "Add the avatar of this comment's author.",
"textdomain": "default",
"attributes": {
"width": {
Expand Down
8 changes: 4 additions & 4 deletions packages/block-library/src/post-comment-author/block.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"apiVersion": 2,
"name": "core/post-comment-author",
"title": "Post Comment Author",
"category": "design",
"parent": [ "core/post-comment" ],
"description": "Post comment author.",
"title": "Comment Author",
"category": "theme",
"parent": [ "core/comment-template" ],
"description": "Add the author of this comment.",
"textdomain": "default",
"attributes": {
"isLink": {
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/post-comment-author/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export default function Edit( {
{ inspectorControls }
{ blockControls }
<div { ...blockProps }>
<p>{ _x( 'Post Comment Author', 'block title' ) }</p>
<p>{ _x( 'Comment Author', 'block title' ) }</p>
</div>
</>
);
Expand Down
8 changes: 4 additions & 4 deletions packages/block-library/src/post-comment-content/block.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"apiVersion": 2,
"name": "core/post-comment-content",
"title": "Post Comment Content",
"category": "design",
"parent": [ "core/post-comment" ],
"description": "Post comment content",
"title": "Comment Content",
"category": "theme",
"parent": [ "core/comment-template" ],
"description": "Displays the contents of a comment.",
"textdomain": "default",
"usesContext": [ "commentId" ],
"attributes": {
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/post-comment-content/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default function Edit( {
<>
{ blockControls }
<div { ...blockProps }>
<p>{ _x( 'Post Comment Content', 'block title' ) }</p>
<p>{ _x( 'Comment Content', 'block title' ) }</p>
</div>
</>
);
Expand Down
8 changes: 4 additions & 4 deletions packages/block-library/src/post-comment-date/block.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"apiVersion": 2,
"name": "core/post-comment-date",
"title": "Post Comment Date",
"category": "design",
"parent": [ "core/post-comment" ],
"description": "Post comment date.",
"title": "Comment Date",
"category": "theme",
"parent": [ "core/comment-template" ],
"description": "Add the date of this comment.",
"textdomain": "default",
"attributes": {
"format": {
Expand Down
21 changes: 10 additions & 11 deletions packages/block-library/src/post-comment-date/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,22 @@ import { __, _x } from '@wordpress/i18n';
/**
* Renders the `core/post-comment-date` block on the editor.
*
* @param {Object} props React props.
* @param {Object} props.setAttributes Callback for updating block attributes.
* @param {Object} props.attributes Block attributes.
* @param {string} props.attributes.className Block class name.
* @param {string} props.attributes.format Format of the date.
* @param {string} props.attributes.isLink Whether the author name should be linked.
* @param {Object} props.context Inherited context.
* @param {string} props.context.commentId The comment ID.
* @param {Object} props React props.
* @param {Object} props.setAttributes Callback for updating block attributes.
* @param {Object} props.attributes Block attributes.
* @param {string} props.attributes.format Format of the date.
* @param {string} props.attributes.isLink Whether the author name should be linked.
* @param {Object} props.context Inherited context.
* @param {string} props.context.commentId The comment ID.
*
* @return {JSX.Element} React element.
*/
export default function Edit( {
attributes: { className, format, isLink },
attributes: { format, isLink },
context: { commentId },
setAttributes,
} ) {
const blockProps = useBlockProps( { className } );
const blockProps = useBlockProps();
const [ date ] = useEntityProp( 'root', 'comment', 'date', commentId );
const [ siteDateFormat ] = useEntityProp( 'root', 'site', 'date_format' );

Expand Down Expand Up @@ -75,7 +74,7 @@ export default function Edit( {
<>
{ inspectorControls }
<div { ...blockProps }>
<p>{ _x( 'Post Comment Date', 'block title' ) }</p>
<p>{ _x( 'Comment Date', 'block title' ) }</p>
</div>
</>
);
Expand Down
6 changes: 3 additions & 3 deletions packages/block-library/src/post-comment-edit/block.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"apiVersion": 2,
"name": "core/post-comment-edit",
"title": "Post Comment Edit Link",
"category": "design",
"parent": [ "core/post-comment" ],
"title": "Comment Edit Link",
"category": "theme",
"parent": [ "core/comment-template" ],
"description": "Displays a link to edit the comment in the WordPress Dashboard. This link is only visible to users with the edit comment capability.",
"textdomain": "default",
"usesContext": [ "commentId" ],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"apiVersion": 2,
"name": "core/post-comment-reply-link",
"title": "Post Comment Reply Link",
"category": "design",
"parent": [ "core/post-comment" ],
"title": "Comment Reply Link",
"category": "theme",
"parent": [ "core/comment-template" ],
"description": "Displays a link to reply to a comment.",
"textdomain": "default",
"usesContext": [ "commentId" ],
Expand Down
7 changes: 4 additions & 3 deletions packages/block-library/src/post-comment/block.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"apiVersion": 2,
"name": "core/post-comment",
"title": "Post Comment",
"title": "Post Comment (deprecated)",
"category": "theme",
"description": "Post comment.",
"description": "This block is deprecated. Please use the Comment Template block instead.",
gziolo marked this conversation as resolved.
Show resolved Hide resolved
"textdomain": "default",
"attributes": {
"commentId": {
Expand All @@ -14,6 +14,7 @@
"commentId": "commentId"
},
"supports": {
"html": false
"html": false,
"inserter": false
}
}