Skip to content

Commit a14b0ab

Browse files
authored
FILES field - Attachment name display fix (#18073)
with new 'file' FILES field on attachment, UI should display attachment name from file field value. Issue with API users updating only 'file' FILES field (and not name field anymore)
1 parent 6e29f66 commit a14b0ab

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

packages/twenty-front/src/modules/activities/files/components/AttachmentRow.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import { useHasPermissionFlag } from '@/settings/roles/hooks/useHasPermissionFla
2222
import { IconCalendar, OverflowingTextWithTooltip } from 'twenty-ui/display';
2323
import { isNavigationModifierPressed } from 'twenty-ui/utilities';
2424
import {
25-
PermissionFlagType,
2625
FeatureFlagKey,
26+
PermissionFlagType,
2727
} from '~/generated-metadata/graphql';
2828
import { formatToHumanReadableDate } from '~/utils/date-utils';
2929
import { getFileNameAndExtension } from '~/utils/file/getFileNameAndExtension';
@@ -96,7 +96,11 @@ export const AttachmentRow = ({
9696
);
9797

9898
const { name: originalFileName, extension: attachmentFileExtension } =
99-
getFileNameAndExtension(attachment.name);
99+
getFileNameAndExtension(
100+
isFilesFieldMigrated
101+
? (attachment.file?.[0]?.label as string)
102+
: attachment.name,
103+
);
100104

101105
const [attachmentFileName, setAttachmentFileName] =
102106
useState(originalFileName);
@@ -206,7 +210,9 @@ export const AttachmentRow = ({
206210
target="_blank"
207211
rel="noopener noreferrer"
208212
>
209-
<OverflowingTextWithTooltip text={attachment.name} />
213+
<OverflowingTextWithTooltip
214+
text={`${attachmentFileName}${attachmentFileExtension}`}
215+
/>
210216
</StyledLink>
211217
</StyledLinkContainer>
212218
)}

0 commit comments

Comments
 (0)