From 6dcf6ac5f81b6c62ac0905579fd8e441e415d80a Mon Sep 17 00:00:00 2001 From: Sawyer Cutler Date: Wed, 4 Nov 2026 18:23:49 -0800 Subject: [PATCH] fix(web): give a decline with files the typed words as its reason A send with files while an approval card was open declined it with no reason and sent the words with the files, so the coordinator was told the person left no feedback. The words now go as the decline's reason and the files follow on their own; a send with no words keeps the bare decline. --- apps/web/src/pages/workspace/index.tsx | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/apps/web/src/pages/workspace/index.tsx b/apps/web/src/pages/workspace/index.tsx index 05210787..b5b59e86 100644 --- a/apps/web/src/pages/workspace/index.tsx +++ b/apps/web/src/pages/workspace/index.tsx @@ -850,9 +850,8 @@ function ReadyRoom({ setFiles((current) => [...current, ...fitting]); }; - const deliverFiles = async (): Promise => { + const deliverFiles = async (text: string): Promise => { if (sending) return false; - const text = value.trim(); const attached = files; setSending(true); setSendFailed(false); @@ -1106,14 +1105,27 @@ function ReadyRoom({ }; const sendFiles = async () => { if (sending) return false; + const text = value.trim(); const currentApprovals = await readPendingApprovals(); const currentOpen = currentApprovals?.find( (approval) => approval.packages === undefined, ); - return deliverWithOpenApproval({ + const send = { openApprovalId: currentOpen?.approvalId, decide: onDecideApproval, - deliver: deliverFiles, + deliver: () => deliverFiles(text), + }; + if (text.length === 0) return deliverWithOpenApproval(send); + return deliverWithOpenApproval({ + ...send, + // The words go first as the decline's reason, so the coordinator reads them as the + // person's answer; a failed decline uploads nothing and leaves both in the composer. + decline: async (approvalId) => { + if (!(await deliverMail(text, true, declineWith(approvalId)))) + return false; + // The words already went with the decline; alone, the files get the hub's own note. + return deliverFiles(""); + }, }); }; const sendNow = () => {