Repository navigation
fix: remove a saved draft once its email is sent - #214
LUCKYREDDY31 wants to merge 3 commits into
Conversation
Sending a saved draft left it in Drafts after the email went out. The send request did not say which draft it came from, and nothing removed drafts, so the person saw an email that looked unsent and could send it twice. The email.send proposal now carries an optional draftId, and the action service removes that draft only after the send succeeds. A declined, expired, failed or uncertain send keeps the draft. Edit details on the review reopens the same draft instead of creating a copy.
A draft now records its pending review. Starting a new review or saving the draft again cancels the older review, so one draft has at most one pending send and older text cannot be sent over a rewrite. A send removes the draft only if it still points to that review, and a failed cleanup is logged instead of reported as a failed send. propose rejects a draft that does not exist for the owner, and Edit details opens the editor only when its own tap declined the review.
A save, or a second review, that landed while a review was still being prepared could be replaced by the older review: propose linked the review to whatever version of the draft existed when preparation finished, so approving it sent the older text and deleted the newer draft, and two reviews started together cancelled each other. Every save now gives the draft a new revision, and linking a review bumps it too. propose reads the revision before preparing and links the review only if the draft still has it; otherwise the new review is cancelled and the request returns 409. Drafts saved before this change get a revision the first time they are reviewed.
|
Read the full flow against One reachable edge this leaves open. On Minor: cleanup runs exactly once, after the terminal Not blocking — the core change is solid. |
Replaces #170, which GitHub closed when I accidentally deleted my fork. The review discussion and the before/after screenshots are on #170.
What changed
Sending a saved draft left it in Drafts, so the email looked unsent and was easy to send twice. Now the draft is removed once its email is sent.
proposeonly accepts a draft that belongs to the same person, and links the review to it.Verification
pnpm lint,pnpm typecheck,pnpm --dir apps/worker typecheck,pnpm test(494/494) andpnpm build:serverpass on Node 24. On top of current main (a4944f4) the same checks pass at 531/531, along withpnpm test:browser, both Docker suites and the web, iOS and Android exports.Integration limits