Skip to content

Commit

Permalink
Remove Enable Comments button
Browse files Browse the repository at this point in the history
  • Loading branch information
karthick-murugan committed Dec 30, 2024
1 parent e7679f1 commit c3f2925
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions packages/block-library/src/post-comments-form/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import clsx from 'clsx';
/**
* WordPress dependencies
*/
import { __, _x, sprintf } from '@wordpress/i18n';
import { __, sprintf } from '@wordpress/i18n';
import {
Warning,
store as blockEditorStore,
__experimentalGetElementClassName,
} from '@wordpress/block-editor';
import { Button } from '@wordpress/components';
import { useInstanceId } from '@wordpress/compose';
import { useEntityProp, store as coreStore } from '@wordpress/core-data';
import { useSelect } from '@wordpress/data';
Expand Down Expand Up @@ -59,7 +58,7 @@ const CommentsFormPlaceholder = () => {
};

const CommentsForm = ( { postId, postType } ) => {
const [ commentStatus, setCommentStatus ] = useEntityProp(
const [ commentStatus ] = useEntityProp(
'postType',
postType,
'comment_status',
Expand All @@ -82,21 +81,8 @@ const CommentsForm = ( { postId, postType } ) => {

if ( ! isSiteEditor && 'open' !== commentStatus ) {
if ( 'closed' === commentStatus ) {
const actions = [
<Button
__next40pxDefaultSize
key="enableComments"
onClick={ () => setCommentStatus( 'open' ) }
variant="primary"
>
{ _x(
'Enable comments',
'action that affects the current post'
) }
</Button>,
];
return (
<Warning actions={ actions }>
<Warning>
{ __(
'Post Comments Form block: Comments are not enabled for this item.'
) }
Expand Down

0 comments on commit c3f2925

Please sign in to comment.