From f0d718fa3e8fc31aee21660033ca2e2d7abf5a6a Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Wed, 23 Sep 2026 11:19:53 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A9(frontend)=20add=20Analytics=20feat?= =?UTF-8?q?ure=20flag=20on=20Duplicate=20with=20Children?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We want to have a fine grained control over the Duplicate with Children feature. By adding the feature flag for Duplicate with Children, we can enable or disable this feature for specific users or groups without deploying new code. This allows us to test the feature in a controlled environment and gather feedback before a full rollout. --- CHANGELOG.md | 1 + .../doc-management/components/DocToolBox.tsx | 9 +- .../components/__tests__/DocToolBox.spec.tsx | 157 ++++++++++++++++++ 3 files changed, 166 insertions(+), 1 deletion(-) create mode 100644 src/frontend/apps/impress/src/features/docs/doc-management/components/__tests__/DocToolBox.spec.tsx diff --git a/CHANGELOG.md b/CHANGELOG.md index 854f5a931..c7653de09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to ### Added +- 🚩(setting) add feature flag on Duplicate with Children #2721 - 💄(frontend) redesign 404 error standalone page #2696 - 💄(frontend) redesign 403 access denied page #2720 - ✨(frontend) duplicate with subdocuments #2584 diff --git a/src/frontend/apps/impress/src/features/docs/doc-management/components/DocToolBox.tsx b/src/frontend/apps/impress/src/features/docs/doc-management/components/DocToolBox.tsx index e610fadcd..7d1057041 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-management/components/DocToolBox.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-management/components/DocToolBox.tsx @@ -39,6 +39,7 @@ import SharedIcon from '@/icons/shared.svg'; import StarSlashIcon from '@/icons/star-slash.svg'; import StarIcon from '@/icons/star.svg'; import DeleteIcon from '@/icons/trash.svg'; +import { useAnalytics } from '@/libs/Analytics'; import { useFocusStore, useResponsiveStore } from '@/stores'; import { isMacOS } from '@/utils/userAgent'; @@ -52,6 +53,8 @@ import { import { useCopyDocLink, useTrans } from '../hooks'; import { Doc, Role } from '../types'; +const DUPLICATE_WITH_CHILDREN_FEATURE_FLAG = 'duplicate_with_children'; + const ConfirmationDuplicateModal = dynamic( () => import('@/docs/doc-management/components/ConfirmationDuplicateModal').then( @@ -154,6 +157,10 @@ const DocToolBoxComponent = ({ const [isModalLeaveOpen, setIsModalLeaveOpen] = useState(false); const [isModalMoveOpen, setIsModalMoveOpen] = useState(false); const { onClick: onButtonClick, ...buttonPropsLeft } = buttonProps || {}; + const { isFeatureFlagActivated } = useAnalytics(); + const duplicateWithChildrenAllowed = !!( + isFeatureFlagActivated(DUPLICATE_WITH_CHILDREN_FEATURE_FLAG) && doc.numchild + ); const editor = useEditorStore((state) => state.editor); const wordCountLabel = useMemo(() => { @@ -301,7 +308,7 @@ const DocToolBoxComponent = ({ icon: