diff --git a/web/app/components/header/account-setting/members-page/operation/transfer-ownership.tsx b/web/app/components/header/account-setting/members-page/operation/transfer-ownership.tsx index 815c86abc7..6903a85f2e 100644 --- a/web/app/components/header/account-setting/members-page/operation/transfer-ownership.tsx +++ b/web/app/components/header/account-setting/members-page/operation/transfer-ownership.tsx @@ -5,6 +5,9 @@ import { } from '@remixicon/react' import { Fragment } from 'react' import { useTranslation } from 'react-i18next' +import Loading from '@/app/components/base/loading' +import { useGlobalPublicStore } from '@/context/global-public-context' +import { useWorkspacePermissions } from '@/service/use-workspace' import { cn } from '@/utils/classnames' type Props = { @@ -13,6 +16,16 @@ type Props = { const TransferOwnership = ({ onOperate }: Props) => { const { t } = useTranslation() + const systemFeatures = useGlobalPublicStore(s => s.systemFeatures) + const { data: workspacePermissions, isFetching: isFetchingWorkspacePermissions } = useWorkspacePermissions(systemFeatures.branding.enabled) + if (systemFeatures.branding.enabled) { + if (isFetchingWorkspacePermissions) { + return + } + if (!workspacePermissions || workspacePermissions.allow_owner_transfer !== true) { + return {t('members.owner', { ns: 'common' })} + } + } return (