From f0ef1acc9326647b2f1b04231cfcdcd3055066cb Mon Sep 17 00:00:00 2001 From: Rinkal Pagdar <92097119+rinkalpagdar@users.noreply.github.com> Date: Wed, 30 Oct 2024 17:19:58 +0530 Subject: [PATCH] Inline Commenting: Disable comments on published posts for now (#66583) Co-authored-by: rinkalpagdar Co-authored-by: Mamaduka --- packages/editor/src/components/collab-sidebar/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/editor/src/components/collab-sidebar/index.js b/packages/editor/src/components/collab-sidebar/index.js index 482bf3d4081ed1..8c7a710bce308a 100644 --- a/packages/editor/src/components/collab-sidebar/index.js +++ b/packages/editor/src/components/collab-sidebar/index.js @@ -62,6 +62,11 @@ export default function CollabSidebar() { }; }, [] ); + const postStatus = useSelect( ( select ) => { + const post = select( editorStore ).getCurrentPost(); + return { postStatus: post?.status }; + }, [] ); + const threads = useSelect( ( select ) => { if ( ! postId ) { @@ -259,7 +264,10 @@ 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. }