From 68f5e70ade354e513a8eeeba3e1fb13f463d1cd0 Mon Sep 17 00:00:00 2001 From: BugIsGod <87571967+bugisthegod@users.noreply.github.com> Date: Fri, 27 Mar 2026 08:28:30 +0000 Subject: [PATCH] fix: sign file URLs in timeline and file loss on click outside (#19001) Fixes: #18943 ## Problem Two bugs related to the Files field: 1. **File loss on click outside**: When `MultiItemFieldInput` was not in edit mode (input hidden), clicking outside would still call `validateInputAndComputeUpdatedItems()` with an empty `inputValue` and `itemToEditIndex = 0`, causing the first file to be silently deleted. image 2. **Unsigned file URLs in timeline activity**: FileId, FileName stored in `timelineActivity.properties.diff` (before/after values) were not being signed (timeActivity.properties is stored as json in database), making them inaccessible from the frontend. image ## Reproduction https://github.com/user-attachments/assets/e75b842b-5cbb-46e8-a923-ac9df62deb98 ## Changes - `MultiItemFieldInput.tsx`: Wrap the validate + onChange logic in `if (isInputDisplayed)` so it only runs when the input is actually open. - `timeline-activity-query-result-getter.handler.ts`: New handler that iterates over `properties.diff` fields and signs any file arrays found in `before`/`after` values (call same method: `fileUrlService.signFileByIdUrl` as table field view `FilesFieldQueryResultGetterHandler`. - `common-result-getters.service.ts`: Register the new handler for `timelineActivity`. ## After https://github.com/user-attachments/assets/368c7be1-3101-43a2-ac93-fe1b0d8a7a37 --- .../input/components/MultiItemFieldInput.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MultiItemFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MultiItemFieldInput.tsx index 210a257f2f..5f2fb98e0b 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MultiItemFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MultiItemFieldInput.tsx @@ -91,13 +91,20 @@ export const MultiItemFieldInput = ({ ) { return; } - const { isValid, updatedItems } = validateInputAndComputeUpdatedItems(); - if (!isValid) { + if (isInputDisplayed) { + const { isValid, updatedItems } = validateInputAndComputeUpdatedItems(); + + if (!isValid) { + return; + } + + onChange(updatedItems); + onClickOutside(updatedItems, event); + return; } - onChange(updatedItems); onClickOutside(items, event); }, listenerId: instanceId,