Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions apps/web/src/pages/workspace/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -850,9 +850,8 @@ function ReadyRoom({
setFiles((current) => [...current, ...fitting]);
};

const deliverFiles = async (): Promise<boolean> => {
const deliverFiles = async (text: string): Promise<boolean> => {
if (sending) return false;
const text = value.trim();
const attached = files;
setSending(true);
setSendFailed(false);
Expand Down Expand Up @@ -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("");
Comment on lines +1123 to +1127

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 · Settled card now sends the words and files as two separate messages

When the card is already settled (409), declineWith falls back to mail(text), which sends the words as a plain message. deliverFiles("") then uploads the files with no text. Before this change, onDecideApproval returned null for a settled card and deliverFiles sent the words together with the files. The description says the settled-card path is unchanged, but it now splits into two messages.

Send typed words with attached files while the cached open card has just been decided elsewhere or its run has moved on (decline gets a 409).

Resolve this comment. Triage will not finish while it is open.

},
});
};
const sendNow = () => {
Expand Down