Repository navigation
feat(email): intake answers in the host's booking email, opt-in per event type (#264) - #283
dominik-myszkowski wants to merge 3 commits into
Conversation
…vent type (Calnode#264) event_types.answers_in_host_email (migration 00076, default off) lists the attendee's intake answers in each host's new-booking email, and in the new host's email when a booking is reassigned. Unanswered questions are left out. The answers travel in BookingData.HostAnswers, which only the host templates read and which is set only on each host's copy in notifyHosts, never on the data the attendee's email and .ics are built from. The calendar event description is deliberately not used: the attendee sees it in their own invite on Google, Microsoft and CalDAV. Editor: a checkbox in the Notifications tab (en/fr). Duplicating an event type carries the flag.
There was a problem hiding this comment.
ℹ️ No critical issues — one merge-order note below and one minor inline comment.
Approach: sound — the answers ride a single BookingData.HostAnswers field that only the host templates read, so the host-only guarantee falls out of where the field is set rather than out of template discipline. Opt-in, default off, additive migration.
Reviewed changes
- Schema + API —
event_types.answers_in_host_email(migration00076), surfaced oneventTypeJSON,etColumns, create, PATCH and duplication; the admin-side concatenation withetOwnerColumnsstays valid because the new column is appended last. - Answer loading —
Handler.hostEmailAnswersreads the flag then the booking's non-empty answers in form order; failures log and yield nil so the confirmation never blocks on this. - Host-only delivery —
notifyHostsandreassign.gosetHostAnswerson each host's copy only; the attendee's email and.icsare built from the untouchedbData, and the ICS description still comes fromcalDetails(). - Rendering —
Answersblock in the text template (continuation lines indented viaAnswer.IndentedValue) and inhtmlConfirmHost;html/templateauto-escapes, so attendee input cannot inject markup. - Editor — checkbox in the Notifications tab,
en/frstrings, value round-tripped throughloadET/saveET. - Tests — mailer rendering/escaping/no-block/no-attendee-leak, handler opt-in/off/reassign/flag round-trip, duplication column coverage.
ℹ️ 00076 sits above two unmerged migrations, and goose will refuse to boot over that gap
00074 (#275) and 00075 (#281) are still open, so main ends at 00073 and this PR is the highest number. That is fine on its own, but the "I'll renumber" plan only works in one direction: goose's Up returns an error when the embedded migrations contain a version below the database's highest applied version, and cmd/calnode/main.go:76 exits on that error. If this merges first, #275 and #281 must be renumbered above 00076; leaving them at 00074/00075 would fail startup for every deployment that already ran 00076.
Technical details
# Merge-order constraint on migration numbering
## Affected sites
- `internal/db/migrations/00076_event_type_answers_in_host_email.sql:12` — claims 00076 while 74/75 are absent from `main`.
- `internal/db/db.go:61` — `goose.Up(db, "migrations")`.
- `cmd/calnode/main.go:76` — `logger.Error` + `os.Exit(1)` when `Migrate` fails.
## Why the gap matters
`goose.Up` → `UpToContext` → `findMissingMigrations` (goose v3.29.0 `up.go`) collects embedded
versions `< dbMaxVersion` that are not in `goose_db_version` and returns
`"found N missing migrations before current version X"`. A DB migrated to 76 therefore errors on
the next boot once 74/75 appear in the binary, and `/readyz` stays false because
`SchemaReady` compares against `TargetVersion()`.
## Required outcome
- If this PR merges before #275/#281: theirs become 00077/00078 (any number above 00076).
- If #275/#281 merge first: this file is renumbered below them, per the PR description.
- Whichever way, no migration may be added below a version already applied anywhere.deepseek-v4.1-flash | 𝕏
The admin booking view reads checkbox answers through checkboxTicked,
because older rows hold whatever the surface sent ("Yes", "1", "on").
The host email printed the raw token; it now reads them the same way.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Normalised checkbox answers to
Yes/Noin the host's email:hostEmailAnswersnow selectsq.typeand maps through the existingcheckboxTickedhelper, so legacy tokens (on,1,checked,Yes) can no longer read as the opposite of what the guest ticked. The reassignment path gets the same treatment since it calls the same helper. - Added
TestHostEmailAnswers_checkboxReadsAsYesNo, coveringon→Yes,no→No, and a text answer passing through untouched.
deepseek-v4.1-flash | 𝕏
…e-answers # Conflicts: # frontend/src/lib/api.ts # internal/handler/event_type.go # internal/handler/event_type_duplicate_test.go
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — since the prior pullfrog review at afbd40f the only change is e55e3b2, a merge of origin/main (now ce0e135, carrying #275's next-available setting and its migration 00074). No PR-authored code changed, so this run verified the resolution rather than re-reading the feature.
- Column lists still line up —
etColumns(35 columns) andscanEventTypeRow's 35 dest pointers agree in order, the createINSERThas 25 columns, 25 placeholders and 25 arguments, andevent_type_duplicate.gocopies 38 columns into 38 values withanswers_in_host_emaillast. Neither setting was dropped or shifted by the merge. - Editor and catalogue keep both settings — the Notifications tab still loads, binds and submits
answersInHostEmailbeside main'sform.show_next_available, anden/frcarry both key sets in their own blocks with no duplicate keys. - Duplication guard — the
copiedmap inTestDuplicateEventType_handlesEveryEventTypeColumnlists bothanswers_in_host_emailandshow_next_available, matching the SQL. - Verified green on the merged tree —
go test ./internal/handler/ ./internal/db/ ./internal/mailer/,node --test internal/handler/assets/booking-logic.test.js(21 pass),gofmt -l .empty,go vetclean. The frontend gates (pnpm check,check:i18n,test:visual) neednode_modules, which this checkout does not have, so they were not re-run here.
deepseek-v4.1-flash | 𝕏

Implements the half of #264 you accepted: the attendee's intake answers in the host's new-booking email, opt-in per event type, off by default. The calendar event description is left alone, as agreed.
What it does
event_types.answers_in_host_email(migration00076, default 0), exposed asanswers_in_host_emailon the event type API (GET, create, PATCH) and carried by duplication.Keeping it host-only
BookingData.HostAnswers. Only the host templates read that field.notifyHosts(and on the reassigned host's copy), never on thebDatathat the attendee's confirmation and.icsare built from.Migration number
00076, after00074(#275) and00075(#281). If this lands before either of them, I'll renumber.Tests
mailer:HostAnswerseven when it is set.handler, through the realdispatchBookingConfirmation:TestDuplicateEventType_*covers the new column.Mutation check: dropping the line that sets the answers on the host's copy fails the opt-in test.
gofmt,go vet ./...,go build ./...,go test ./...,go run ./cmd/i18n-coverage,pnpm check,pnpm check:i18n,pnpm build,pnpm test:visualandmake buildpass locally.