Repository navigation
fix(work-orders): email everyone who has to act; tell builders about terminate and withdraw - #87
Conversation
| const representativeEmail = | ||
| row.representativeEmail ?? fallback?.defaultRepresentativeEmail ?? null; |
There was a problem hiding this comment.
🟠 Medium · correctness: Default-representative fallback puts the wrong person's email on in-app countersignatures and signed PDFs
countersign (l.3878–3887) records the signer's email as contacts.representativeEmail ?? <actor's own email>. Before this change contacts.representativeEmail was just row.representativeEmail, so on a work order with no representative the actual signer's email was stored. Now contactsOf falls back to the Agency's default representative.
Scenario: the Agency's default representative is Dana, and admin Bob countersigns a work order that has no representative set. The signature row gets name "Bob" (typed), userId Bob, but email dana@…. finalizeSigned (l.991–998) then prints that email on the signed PDF's signature page, so the legal signature record names one person with another person's email.
Suggested fix: In countersign, use row.representativeEmail ?? actorEmail instead of the fallback value. Alternatively, make contactsOf expose whether the email came from the fallback and skip the fallback when recording a signature.
Multi Review ·
|
|
Fixed in 8d71585:
Tests added for each. Typecheck is clean and all API tests pass (812). @multi-review |
…sign, check documenso before terminate
8d71585 to
a8ee630
Compare
|
Pushed fixes on top of a8ee630 (3b141a7). Typecheck, lint and all tests pass, and each change has a test that fails without it.
Not in this PR:
Nothing needed from you. |
What changes
Fixes the gaps found in the email-flow review: moments where someone has to act but got no email.
Emails for people who have to act
Terminate and delete
Representative fallback
Copy
Review
api/src/services/work-orders/emails.ts: new email cases and copyapi/src/services/work-orders/service.ts:contactsOffallbacksentToBuilderoffer,syncEnvelope,terminateandremove, on top of staging's safer terminate/deleteapi/src/services/notifications.ts:work_order_terminated/work_order_withdrawn, activation copyTesting
pnpm typecheckis clean.