feat(surveys): edit survey settings after creation (Issue 1459) - #1473
Conversation
|
Merge conflicts with Rebasing Auto-resolvable (mechanical):
Needs human judgment (blocker):
Auto-resolution was skipped to avoid a risky merge; the branch was left untouched (rebase aborted). |
Add a settings dialog on the survey builder to edit title, description, slug, visibility, one-response-per-user, and linked event via the existing PATCH endpoint. Extracts the shared field layout from CreateSurveyDialog into SurveyFields so create and edit stay in sync. Slug collisions surface as a field-level error via a new getFieldError helper in apiErrors.
- clear the slug field error as soon as the slug changes, in both the settings and create dialogs - remount CreateSurveyDialog on open so values don't survive close/reopen - show slug collisions inline on create, matching the edit path - route linked_event_id backend errors to the linked event dropdown
…hook Drop two comments that restated the code they sat above and tighten the getFieldError docblock to the part that isn't in the signature. Move useSurveyFieldErrors into its own module so SurveyFields.tsx exports only components — it was tripping react-refresh/only-export-components, which the config disables only for src/router. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
8176a02 to
fbacaa0
Compare
|
Resolved — conflicts are gone, branch rebased onto Test file (the blocker): hand-merged into one file with a unified mock set — Screen file: import-only union, as expected. Two extra things while in here:
Verified: frontend lint, typecheck, and the full 1322-test suite pass; backend lint/typecheck/complexity pass. The 7 backend failures locally (SSE + the two race tests) are pre-existing SQLite-environment limits — identical on |
Summary
PATCH /surveys/{id}/endpoint (useUpdateSurvey).CreateSurveyDialoginto a newSurveyFieldscomponent so create and edit stay in sync; the linked-event picker reuses the existinguseEventshook and keeps a past/cancelled linked event selectable even once it drops off the active list.Code.Survey.SlugAlreadyExists) now surface as a field-level error via a newgetFieldErrorhelper inapiErrors.ts, instead of the generic form alert.Closes #1459
Test plan
make agent-frontend-lint— passesmake agent-frontend-typecheck— passesmake agent-frontend-test— passes (1286 passed, 1 skipped)make agent-ci— backendruff,manage.py check,tytypecheck, cognitive-complexity, and check-codes all pass clean. The backend pytest run has 7 pre-existing failures unrelated to this change (this branch is frontend-only): 5test_sse.pyauth tests that need Postgrespg_notify(SSE is documented in CLAUDE.md as returning 503 on SQLite), and 2 concurrency race tests (test_poll_finalize_race.py,test_rsvp_capacity_race.py) that hit SQLite's lack of real row-level locking underselect_for_update.SurveySettingsDialog.test.tsxcovering: seeding fields from the survey and saving edits, keeping a non-active linked event selectable, surfacing a slug collision as a field error, and blocking save on a blank title.