Skip to content

Commit

Permalink
Merge pull request #1257 from nickgros/SWC-6776b
Browse files Browse the repository at this point in the history
SWC-6776 - Get entity type instead of using static text
  • Loading branch information
jay-hodgson authored Oct 4, 2024
2 parents 0cca79a + d95c033 commit e4c6824
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import React from 'react'
import { useGetEntityHeader } from '../../synapse-queries/entity/useGetEntityHeaders'
import {
convertToEntityType,
entityTypeToFriendlyName,
} from '../../utils/functions/EntityTypeUtils'
import { EntityLink } from '../EntityLink'
import { Link, Typography } from '@mui/material'

Expand All @@ -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 (
<>
<Typography variant={'body1'}>
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 ? (
<>
{' '}
Expand Down

0 comments on commit e4c6824

Please sign in to comment.