Repository navigation
feature: rsvp form customisation - #207
GladwynChua wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
joengy
left a comment
There was a problem hiding this comment.
Thank you for these massive changes Gladwyn, I left some comments for you to take a look at they shouldn't be anything too complex.
joengy
left a comment
There was a problem hiding this comment.
Sorry for the delay in review I was really busy last week wrapping up uni, only small comments left and it should be finished. TY for your work Gladwyn
| ({ doc }) => ({ | ||
| ...doc, | ||
| rsvpQuestions: | ||
| doc.rsvpQuestions ?? |
There was a problem hiding this comment.
Existing events will show an empty RSVP form after this is deployed.
Suggested fix (pick one):
- In the migration, add the default question rows for every existing event, or
- Treat an empty list the same as "not set", e.g.
doc.rsvpQuestions?.length ? doc.rsvpQuestions : DEFAULT.... (Admins can still hide questions withenabled, so nothing is lost by not allowing a truly empty list.)
| } | ||
|
|
||
| const eventQuestions = event.rsvpQuestions | ||
| const questions = eventQuestions ?? [...DEFAULT_RSVP_QUESTIONS] |
There was a problem hiding this comment.
Same problem as the afterRead comment in Events.ts: event.rsvpQuestions will be [] for events created before this deploy, not undefined, so ?? [...DEFAULT_RSVP_QUESTIONS] never kicks in. validateRsvpAnswers([], ...) then passes with no answers at all, so this route is the safety net that lets a registration through with no emergency contact.
If you go with the "empty means use defaults" fix, it should be applied here too (or better, only in one place, so the route and the hook can't disagree).
| options?: Array<{ label: string; value: string } | null> | null | ||
| } | ||
|
|
||
| export const DEFAULT_RSVP_QUESTIONS: RsvpQuestion[] = [ |
There was a problem hiding this comment.
Small suggestion, this is a second copy of the types and default questions in cms/src/lib/eventRegistrationQuestions.ts. If someone edits the defaults in the CMS (e.g. adds a university year option), this copy won't change with it.
Once the afterRead fix is in, the CMS always sends the questions with the event, so the web side only needs the type. Could we drop DEFAULT_RSVP_QUESTIONS here and the ?? DEFAULT_RSVP_QUESTIONS fallback in RsvpContent.tsx? Then there's only one list to maintain.
What does this PR do?
create feature where rsvp form can be edited or add additional questions for specific event
Type of change
Checklist
feature/,fix/,chore/,hotfix/)Linked Issues
Closes #200
Addresses #