From d380b2f4316e118cb507dcf499bb98b7c12cf682 Mon Sep 17 00:00:00 2001 From: hjlarry Date: Wed, 22 Oct 2025 10:10:23 +0800 Subject: [PATCH] hide comments when disable collaboration --- .../components/workflow/hooks/use-workflow-comment.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/web/app/components/workflow/hooks/use-workflow-comment.ts b/web/app/components/workflow/hooks/use-workflow-comment.ts index 217fa6afb0..e659f0238e 100644 --- a/web/app/components/workflow/hooks/use-workflow-comment.ts +++ b/web/app/components/workflow/hooks/use-workflow-comment.ts @@ -7,6 +7,7 @@ import type { WorkflowCommentDetail, WorkflowCommentList } from '@/service/workf import { createWorkflowComment, createWorkflowCommentReply, deleteWorkflowComment, deleteWorkflowCommentReply, fetchWorkflowComment, fetchWorkflowComments, resolveWorkflowComment, updateWorkflowComment, updateWorkflowCommentReply } from '@/service/workflow-comment' import { collaborationManager } from '@/app/components/workflow/collaboration' import { useAppContext } from '@/context/app-context' +import { useGlobalPublicStore } from '@/context/global-public-context' export const useWorkflowComment = () => { const params = useParams() @@ -34,6 +35,7 @@ export const useWorkflowComment = () => { const rightPanelWidth = useStore(s => s.rightPanelWidth) const nodePanelWidth = useStore(s => s.nodePanelWidth) const { userProfile } = useAppContext() + const isCollaborationEnabled = useGlobalPublicStore(s => s.systemFeatures.enable_collaboration_mode) const commentDetailCacheRef = useRef>(commentDetailCache) const activeCommentIdRef = useRef(null) @@ -60,7 +62,7 @@ export const useWorkflowComment = () => { }, [appId, setActiveComment, setCommentDetailCache]) const loadComments = useCallback(async () => { - if (!appId) return + if (!appId || !isCollaborationEnabled) return setCommentsLoading(true) try { @@ -73,11 +75,11 @@ export const useWorkflowComment = () => { finally { setCommentsLoading(false) } - }, [appId, setComments, setCommentsLoading]) + }, [appId, isCollaborationEnabled, setComments, setCommentsLoading]) // Setup collaboration useEffect(() => { - if (!appId) return + if (!appId || !isCollaborationEnabled) return const unsubscribe = collaborationManager.onCommentsUpdate(() => { loadComments() @@ -86,7 +88,7 @@ export const useWorkflowComment = () => { }) return unsubscribe - }, [appId, loadComments, refreshActiveComment]) + }, [appId, isCollaborationEnabled, loadComments, refreshActiveComment]) useEffect(() => { loadComments()