Add email as a potentially missing field#14
Merged
CannonLock merged 1 commit intomainfrom Apr 20, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the user/application-form data model to support users (notably external/OIDC collaborators) who may not have an email available at the user-info endpoint, by allowing email to be captured via the user application form and stored in the DB/view.
Changes:
- Make
users.email1nullable and adjust Pydantic schemas accordingly. - Add an
emailfield toUserForm(table + schemas) and to theuser_applicationsview/model. - Update form submission/approval flow and add tests covering “user without email” scenarios.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
userapp/core/schemas/users.py |
Makes email1 optional in user read/table schemas to reflect nullable DB column. |
userapp/core/schemas/user_application_form.py |
Adds email to user application form post/patch/get/table schemas. |
userapp/core/schemas/general.py |
Adds email to the UserApplicationView schema (view response shape). |
userapp/core/models/tables.py |
Makes User.email1 nullable and adds UserForm.email column. |
userapp/core/models/views.py |
Adds email column to the UserApplicationView ORM mapping. |
userapp/api/routes/security.py |
Avoids KeyError when OIDC userinfo has no email and removes debug print. |
userapp/api/routes/forms/user_application.py |
Persists email on form creation and changes trigger invocation to pass the created form. |
userapp/api/routes/forms/_util.py |
Uses form-provided email when user has no email; sets user email on approval. |
alembic/versions/cf94844cecc1_allow_email1_to_be_nullable.py |
Migration to add user_form.email, make users.email1 nullable, and recreate user_applications view. |
userapp/api/tests/test_forms.py |
Adds test coverage for submitting/approving forms when the user has no email1. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Handle the instance where external collaborators don't have emails at their user info endpoint and we need to collect that information another way.
071da86 to
f24990f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Handle the instance where external collaborators don't have emails at their user info endpoint and we need to collect that information another way.