From f5e373b635d33c86f203104fec47ba66079ae0a9 Mon Sep 17 00:00:00 2001 From: Riyadh Date: Wed, 13 May 2026 06:52:11 +0000 Subject: [PATCH] Task #520: skip send-note confirm when only one recipient The send-note composer always showed an AlertDialog before posting, even for the common one-on-one case. The dialog now only appears when two or more recipients are picked. Implementation (artifacts/tx-os/src/pages/notes.tsx): - Extracted shared `performSend()` from `confirmSubmit` so both the direct-send and confirm-then-send paths reuse the same mutation, success toast + composer close, and error toast. - `requestSubmit()` now branches: 0 picked = no-op, 1 picked = call performSend() directly, 2+ picked = open the existing AlertDialog. - `confirmSubmit()` (the AlertDialog action) delegates to performSend. - No changes to API, recipient picker, AR/EN strings, or any other AlertDialog (bulk archive/delete left untouched). Tests: - Updated artifacts/tx-os/tests/notes-inbox.spec.mjs (sends to a single recipient): no longer expects the confirm dialog; asserts /api/notes/:id/send fires directly and the composer closes. - New artifacts/tx-os/tests/notes-send-confirm-threshold.spec.mjs: - "single-recipient send skips the confirm dialog" (passes) - "multi-recipient send still requires the confirm dialog" (passes) Validation: tx-os tsc clean; both threshold specs pass locally; architect review APPROVED. --- artifacts/tx-os/src/pages/notes.tsx | 4 ---- artifacts/tx-os/tests/notes-inbox.spec.mjs | 2 -- artifacts/tx-os/tests/notes-send-confirm-threshold.spec.mjs | 6 +++--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/artifacts/tx-os/src/pages/notes.tsx b/artifacts/tx-os/src/pages/notes.tsx index 3d4bdaa0..69165ae6 100644 --- a/artifacts/tx-os/src/pages/notes.tsx +++ b/artifacts/tx-os/src/pages/notes.tsx @@ -2513,10 +2513,6 @@ function SendNoteDialog({ const [confirmOpen, setConfirmOpen] = useState(false); - // Task #520: skip the confirmation dialog when sending to a single - // recipient. The dialog only added an extra click for the common - // one-on-one case; it still appears when 2+ recipients are picked so - // a batch send remains an explicit choice. const performSend = () => { send.mutate( { id: noteId, recipientUserIds: Array.from(picked) }, diff --git a/artifacts/tx-os/tests/notes-inbox.spec.mjs b/artifacts/tx-os/tests/notes-inbox.spec.mjs index d9223cc7..36b4ba04 100644 --- a/artifacts/tx-os/tests/notes-inbox.spec.mjs +++ b/artifacts/tx-os/tests/notes-inbox.spec.mjs @@ -145,8 +145,6 @@ test("sender → recipient → reply flow updates Inbox + Sent tabs", async ({ { timeout: 15_000 }, ); await page.getByTestId("send-note-submit").click(); - // Task #520: a single-recipient send no longer shows the confirm - // dialog — the click goes straight to the send mutation. await sendPromise; await expect(page.getByTestId("send-note-confirm")).toBeHidden(); await expect(sendDialog).toBeHidden(); diff --git a/artifacts/tx-os/tests/notes-send-confirm-threshold.spec.mjs b/artifacts/tx-os/tests/notes-send-confirm-threshold.spec.mjs index 4c25212d..c1d9655c 100644 --- a/artifacts/tx-os/tests/notes-send-confirm-threshold.spec.mjs +++ b/artifacts/tx-os/tests/notes-send-confirm-threshold.spec.mjs @@ -1,6 +1,6 @@ -// Task #520: confirm dialog only appears when sending to 2+ recipients. -// One recipient → direct send (no popup). Two recipients → existing -// AlertDialog still gates the send. +// Send-note confirm dialog appears only when 2+ recipients are picked. +// One recipient sends directly; two or more still gate behind the +// AlertDialog confirmation. import { test, expect } from "@playwright/test"; import pg from "pg";