Public: anyone can read this; the crew can change it.

A reminder to a party with no email or phone on file lets the agent add one right on the review page, so Send reaches them #116

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

On the review page, a draft whose party has no contact now shows an Email or phone field and a Save contact button in place of "no contact on file". The review tests pass, along with the accessibility, API-docs, security and server tests. I did not run the whole suite.

Notes

shipped production is serving it deploy d2eada7

opened this

On the review page, a draft whose party has no contact now shows an Email or phone field and a Save contact button in place of "no contact on file". The review tests pass, along with the accessibility, API-docs, security and server tests. I did not run the whole suite. scripts/gate.ts, scripts/design-lint.ts and scripts/fast.ts don't exist in this clone, and there is no tsconfig, so tsc printed its help text and checked nothing.

What changed

  • src/pages/review.ts:

- The field is rendered only while the party's contact is empty. With a contact on file, the page shows it as before. - The field sits first inside the draft's own form, so the agent's edited subject and body travel with it. Pressing Enter in the field saves the contact rather than sending. - Next to Send, a line says Send records the approval and the agent's Mail opens with no recipient. Send itself is unchanged.

  • src/routes.ts: a new POST /reminders/today/contact.

- It calls editParty, the same action as the deal's page, so it asks permit for deal update. A signed-out or forbidden caller gets the usual refusal page. - Success: the same draft is shown again (200) with the contact and the edited words kept. - Bad input: a 422 shows the same draft with the typed contact and the edited words kept. This covers a contact over 120 characters and an empty one. - The "return path" is a re-render of the draft, not a redirect, because a redirect would drop the edited words. The cost is that refreshing the page after saving re-posts the form. - I split the "show the same draft again" part out of reviewed into sameDraft, which both handlers now use.

  • src/deals.ts: CONTACT_MAX = 120 now names the existing contact limit. The page's maxlength and the validation use the same value.
  • src/review.test.ts: four new tests covering the field showing only when the contact is empty, saving returning to the same draft with the words kept, bad input keeping the typed words, and Send still working with no contact.

What I chose not to do

  • No contact cell in contract.json was loosened.
  • Pressing Enter in the Subject field now saves the contact (an empty one gives the 422) instead of sending. This follows from the contact block being first in the form. The alternative is a separate form, which would lose unsaved edits.
  • I left the Send form's extra name and contact fields alone. Send ignores them.

To try it: open /reminders/today on a draft for a party with no contact, type an email, press Save contact, then Send.

🤖 Generated with Claude Code

Closes #114

2 earlier comments · 2 events
commented

On the review page, a draft whose party has no contact now shows an Email or phone field and a Save contact button in place of "no contact on file". The review tests pass, along with the accessibility, API-docs, security and server tests. I did not run the whole suite. scripts/gate.ts, scripts/design-lint.ts and scripts/fast.ts don't exist in this clone, and there is no tsconfig, so tsc printed its help text and checked nothing.

What changed

  • src/pages/review.ts:

- The field is rendered only while the party's contact is empty. With a contact on file, the page shows it as before. - The field sits first inside the draft's own form, so the agent's edited subject and body travel with it. Pressing Enter in the field saves the contact rather than sending. - Next to Send, a line says Send records the approval and the agent's Mail opens with no recipient. Send itself is unchanged.

  • src/routes.ts: a new POST /reminders/today/contact.

- It calls editParty, the same action as the deal's page, so it asks permit for deal update. A signed-out or forbidden caller gets the usual refusal page. - Success: the same draft is shown again (200) with the contact and the edited words kept. - Bad input: a 422 shows the same draft with the typed contact and the edited words kept. This covers a contact over 120 characters and an empty one. - The "return path" is a re-render of the draft, not a redirect, because a redirect would drop the edited words. The cost is that refreshing the page after saving re-posts the form. - I split the "show the same draft again" part out of reviewed into sameDraft, which both handlers now use.

  • src/deals.ts: CONTACT_MAX = 120 now names the existing contact limit. The page's maxlength and the validation use the same value.
  • src/review.test.ts: four new tests covering the field showing only when the contact is empty, saving returning to the same draft with the words kept, bad input keeping the typed words, and Send still working with no contact.

What I chose not to do

  • No contact cell in contract.json was loosened.
  • Pressing Enter in the Subject field now saves the contact (an empty one gives the 422) instead of sending. This follows from the contact block being first in the form. The alternative is a separate form, which would lose unsaved edits.
  • I left the Send form's extra name and contact fields alone. Send ignores them.

To try it: open /reminders/today on a draft for a party with no contact, type an email, press Save contact, then Send.

🤖 Generated with Claude Code

Changes requested — before the latest push

Two changes needed before this lands.

  1. Enter in Subject no longer sends. The Save contact button is the first submit button in the Send form, so pressing Enter in Subject (or in Email or phone) submits it. On a bare-contact draft that means Enter either saves the contact or returns a 422 with an empty field, where it used to send. Fix: put the Send button first in tree order, or give the form a hidden default submit button for Send before the contact block. Add a test that asserts Send comes before Save contact in the markup.
  1. The README does not say how to use this. Where the Read and edit a reminder section mentions 'no contact or phone on file', add the Email or phone field and Save contact, and say that Send without a contact opens Mail with no recipient.

Smaller points:

  • The contact action takes the party's name from a hidden field the client posts, and editParty renames the party to it. Read the name from the draft instead (look the party up by id), so a stale or tampered name cannot rename anyone.
  • The Send test only checks the 303. Also assert the approval was recorded.

Permit is asked through editParty (deal update), no contract cell is loosened, and the 422 keeps the typed words. Those are fine.

commented

I've pushed all four changes from the review to the branch. The review, accessibility and hold tests pass. I did not run the whole suite.

  • Enter sends again. On a draft with no contact, the form now opens with a hidden Send button. Because it is first in the markup, Enter in Subject or in Email or phone submits Send, and Save contact only runs when clicked. I haven't tried this in a real browser. A test asserts the hidden Send comes before Save contact.
  • The party's name comes from the database. The contact action looks the party up by id with nameOf, so the page no longer posts a name. The hidden name field is gone from the page. A new test posts name=Mallory and shows the page doesn't use it.
  • Send test. It now also checks that the sent message appears in /api/deals with the approved subject.
  • README. Step 3, "Read and edit a reminder", now describes the Email or phone field and Save contact. It also says that Send without a contact still records the approval and opens Mail with no recipient.

I didn't disagree with anything in the review.

🤖 Generated with Claude Code

Approved

All earlier asks are met. Enter now sends, because the hidden Send button comes first in the form. The party name comes from the database through nameOf, and a test posts name=Mallory to prove it is ignored. The Send test checks the sent message, and the README covers the new field. The contact save goes through editParty, which asks permit, and no contract cell is loosened. I read the diff and did not run the tests or the preview. The clone lacks 31a2a76530a3, so I checked the head as a whole, not only what changed since that commit.

commented

Left #114 open: 1 unticked item remain (bun test passes and bun scripts/design-lint.ts is clean.).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs