-
Notifications
You must be signed in to change notification settings - Fork 27
Participant required fields + CoC checkbox cleanup #338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR reinforces validation on account creation by enforcing required email and password fields, introduces associations for Code of Conduct agreements, and cleans up related UI components and timestamp handling.
- Enforces email and password presence and uniqueness in the Participant model
- Adds feature tests to cover required field validations
- Updates associations and UI elements for Code of Conduct agreements and uses Time.current for timestamp consistency
Reviewed Changes
File | Description |
---|---|
spec/features/sign_in_and_out_spec.rb | Adds a feature test to verify the presence of required fields |
app/models/participant.rb | Updates validations and association for Code of Conduct agreements |
app/controllers/participants_controller.rb | Updates email confirmation timestamp handling to Time.current |
app/models/event.rb | Adds association for Code of Conduct agreements |
app/views/sessions/_form.html.erb | Modifies the CoC checkbox to be disabled if already accepted |
app/views/participants/new.html.erb | Marks the CoC field as required (adds an asterisk to the label) |
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Good catch on the form allowing null emails! Ha. And yikes. All the changes LGTM. One suggestion: I’d add a migration that adds a not null constraint for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks good to me too!
@pcantrell how's this look? I added the If this looks good to you, let's merge and deploy this bad boy. |
Participant.where(email: nil).update_all(email: 'INVALID') | ||
Participant.where(crypted_password: nil).update_all(crypted_password: 'INVALID') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strictly speaking, migrations shouldn’t use models, because this migration has to work with every future version of the model code (but with the schema frozen at this point in the migration chain). In practice, however, I really doubt this will cause any actual problems!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fair. I agree with you - I think the likelihood that the Participant
model goes away are very low.
LGTM with the new changes! |
While testing for #337, I realized that neither
email
norpassword
were required fields on the create account page.This cleans up a number of small things:
Participants
email
andpassword
field to be present when creating an accountNOT NULL
constraints foremail
andcrypted_password
email
orcrypted_password
values in the DB, but wrote the migration in a way that it shouldn't matter too much (e.g.null
gets replaced with"INVALID"
if any exist).Admin::Legacy::SessionsController#create
and#new
endpoints, along with problematicbuild_presenter
method that would create a participant without anemail
orpassword
, thus triggering these new constraints.Code of Conduct Agreements
has_many
associations toEvent
andParticipant
for easy accessOther small changes
email
input field width so it matches thename
andpassword
fields on registration.Time.current
instead ofTime.now
foremail_confirmed_at
, so it's not saved with a time zone.Screen
Before

shots
After
This shows the wider
email
input + validation errors onemail
andpassword
, which weren't present before.