Skip to content

Commit

Permalink
Block Library: Deprecate the Post Comment block (#36032)
Browse files Browse the repository at this point in the history
* Block Library: Deprecate the Post Comment block

* Update packages/block-library/src/post-comment/block.json

Co-authored-by: Nik Tsekouras <ntsekouras@outlook.com>

Co-authored-by: Nik Tsekouras <ntsekouras@outlook.com>
  • Loading branch information
gziolo and ntsekouras authored Nov 2, 2021
1 parent 02fc532 commit f26e0af
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 37 deletions.
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
6 changes: 3 additions & 3 deletions packages/block-library/src/post-comment-reply-link/block.json
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 Comments Query Loop block instead.",
"textdomain": "default",
"attributes": {
"commentId": {
Expand All @@ -14,6 +14,7 @@
"commentId": "commentId"
},
"supports": {
"html": false
"html": false,
"inserter": false
}
}

0 comments on commit f26e0af

Please sign in to comment.