From 1ae71b194e0bd03e594eddf55b896806abb5c61d Mon Sep 17 00:00:00 2001 From: Nick Grosenbacher Date: Fri, 4 Oct 2024 10:25:41 -0400 Subject: [PATCH 1/3] Get entity type instead of using static 'project' text --- .../EntityAclEditor/InheritanceMessage.tsx | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/packages/synapse-react-client/src/components/EntityAclEditor/InheritanceMessage.tsx b/packages/synapse-react-client/src/components/EntityAclEditor/InheritanceMessage.tsx index 19987d1718b..6e414edc78c 100644 --- a/packages/synapse-react-client/src/components/EntityAclEditor/InheritanceMessage.tsx +++ b/packages/synapse-react-client/src/components/EntityAclEditor/InheritanceMessage.tsx @@ -1,4 +1,9 @@ import React from 'react' +import { useGetEntityHeader } from '../../synapse-queries/index' +import { + convertToEntityType, + entityTypeToFriendlyName, +} from '../../utils/functions/EntityTypeUtils' import { EntityLink } from '../EntityLink' import { Link, Typography } from '@mui/material' @@ -11,11 +16,25 @@ type InheritanceMessageProps = { export function InheritanceMessage(props: InheritanceMessageProps) { const { isProject, isInherited, isAfterUpload = false, benefactorId } = props + const { data: benefactorHeader } = useGetEntityHeader( + benefactorId, + undefined, + { + enabled: Boolean(benefactorId), + }, + ) + if (isAfterUpload) { return ( <> - Currently, the sharing settings are inherited from the project named + Currently, the sharing settings are inherited from the{' '} + {benefactorHeader + ? entityTypeToFriendlyName( + convertToEntityType(benefactorHeader.type), + ).toLowerCase() + : 'container'}{' '} + named {benefactorId ? ( <> {' '} From 1e66d62774c9a528969784d7567d372acec768d9 Mon Sep 17 00:00:00 2001 From: Nick Grosenbacher Date: Fri, 4 Oct 2024 10:27:46 -0400 Subject: [PATCH 2/3] fix import --- .../src/components/EntityAclEditor/InheritanceMessage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/synapse-react-client/src/components/EntityAclEditor/InheritanceMessage.tsx b/packages/synapse-react-client/src/components/EntityAclEditor/InheritanceMessage.tsx index 6e414edc78c..23e7399d022 100644 --- a/packages/synapse-react-client/src/components/EntityAclEditor/InheritanceMessage.tsx +++ b/packages/synapse-react-client/src/components/EntityAclEditor/InheritanceMessage.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { useGetEntityHeader } from '../../synapse-queries/index' +import { useGetEntityHeader } from '../../synapse-queries/entity/useGetEntityHeaders' import { convertToEntityType, entityTypeToFriendlyName, From d95c0338060fe802a2f82a9feb8ebd984080a090 Mon Sep 17 00:00:00 2001 From: Nick Grosenbacher Date: Fri, 4 Oct 2024 14:27:53 -0400 Subject: [PATCH 3/3] Fix test --- .../src/components/EntityAclEditor/EntityAclEditor.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/synapse-react-client/src/components/EntityAclEditor/EntityAclEditor.test.tsx b/packages/synapse-react-client/src/components/EntityAclEditor/EntityAclEditor.test.tsx index 9a1887a8ee6..dcddb79eabb 100644 --- a/packages/synapse-react-client/src/components/EntityAclEditor/EntityAclEditor.test.tsx +++ b/packages/synapse-react-client/src/components/EntityAclEditor/EntityAclEditor.test.tsx @@ -113,7 +113,7 @@ function verifyInheritsSharingSettingsFromBenefactorMessage() { function verifyInheritsSharingSettingsPostUploadMessage() { screen.getByText( - /Currently, the sharing settings are inherited from the project named/, + /Currently, the sharing settings are inherited from the \w+ named/, { exact: false }, ) }