We received a HelpScout ticket from an admin wanting to change the registration type on incomplete registrations. Because some required fields hadn't been filled out yet, the edit registration modal wasn't letting admins save the registration. To resolve that, this PR removes the ng-disabled check and lets admins always update registrations. Note that unlike Save, Save & Set as Completed still requires all questions to have valid questions.
I also had to set allowInvalid on ng-model-options for email address fields. Without it, data corruption is possible (see screen capture). To reproduce, create an incomplete registration, change the registrant type, and set the email address to an invalid value. At this point, the field is failing validation and ng-model sets the value to undefined. Saving the answer on the server without a value attribute will cause the email to be stored with a null value in the database. Then if you try to change the type, you will get an error about the email address being null.
To avoid this, I'm enabling allowInvalid on email addresses when admins are editing registrations so that invalid email addresses will still update ng-model and by rejected during the server-side email address validation. I'm not adding allowInvalid to any other fields because no other fields have server-side validation like email addresses do.
If a registration contains an invalid email address that was added before server-side email validation was added in May 2023 (see API PR), then admins won't be able to change the registrant type without fixing the invalid email address. I believe that that is an acceptable trade-off because legacy registrations with invalid email addresses would be over a year old by now.
We received a HelpScout ticket from an admin wanting to change the registration type on incomplete registrations. Because some required fields hadn't been filled out yet, the edit registration modal wasn't letting admins save the registration. To resolve that, this PR removes the
ng-disabled
check and lets admins always update registrations. Note that unlikeSave
,Save & Set as Completed
still requires all questions to have valid questions.I also had to set
allowInvalid
onng-model-options
for email address fields. Without it, data corruption is possible (see screen capture). To reproduce, create an incomplete registration, change the registrant type, and set the email address to an invalid value. At this point, the field is failing validation andng-model
sets the value toundefined
. Saving the answer on the server without avalue
attribute will cause the email to be stored with anull
value in the database. Then if you try to change the type, you will get an error about the email address beingnull
.To avoid this, I'm enabling
allowInvalid
on email addresses when admins are editing registrations so that invalid email addresses will still updateng-model
and by rejected during the server-side email address validation. I'm not addingallowInvalid
to any other fields because no other fields have server-side validation like email addresses do.If a registration contains an invalid email address that was added before server-side email validation was added in May 2023 (see API PR), then admins won't be able to change the registrant type without fixing the invalid email address. I believe that that is an acceptable trade-off because legacy registrations with invalid email addresses would be over a year old by now.
Feel free to test in my Promo Test event: https://stage.eventregistrationtool.com/eventRegistrations/ec6ac5f9-1df0-4b69-b09d-f85ce39001ef