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

Inline Commenting: Disable comments on published posts for now. #66583

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Changes from 1 commit
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
7 changes: 6 additions & 1 deletion packages/editor/src/components/collab-sidebar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ export default function CollabSidebar() {
};
}, [] );

const postStatus = useSelect((select) => {
const post = select(editorStore).getCurrentPost();
return { postStatus: post?.status };
}, []);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fail ESLint checks. I would recommend using ELSlint and Prettier code editor extensions.

See: https://developer.wordpress.org/block-editor/contributors/code/getting-started-with-code-contribution/#developer-tools


const threads = useSelect(
( select ) => {
if ( ! postId ) {
Expand Down Expand Up @@ -259,7 +264,7 @@ export default function CollabSidebar() {
}, [ postId, clientId ] );

// Check if the experimental flag is enabled.
if ( ! isBlockCommentExperimentEnabled ) {
if ( ! isBlockCommentExperimentEnabled || postStatus.postStatus === 'publish') {
return null; // or maybe return some message indicating no threads are available.
}

Expand Down
Loading