Repository navigation
fix: validate co-organizer invites and match emails case-insensitively - #218
Merged
TheCodeHeist-Coder merged 1 commit intoOct 26, 2026
Conversation
Invites now return 400 for a missing or invalid email and 409 for a duplicate invite, an existing organizer or the owner inviting themselves, instead of a 500 from the unique constraint. Emails are trimmed and lower cased when stored and compared case-insensitively on accept. QuizBuilder shows the server's error and reads quizOrganizers for the sidebar.
TheCodeHeist-Coder
self-requested a review
October 26, 2026 12:44
TheCodeHeist-Coder
approved these changes
Oct 26, 2026
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.
What does this PR do?
Fixes the co-organizer invite flow so bad input gets a proper error instead of a 500, and the sidebar actually lists people.
Backend (
inviteController.ts):inviteEmailas well as the user, because the@@unique([userId, quizId])constraint doesn't catch repeat invites to an email that has no account yet (userId is null there)Frontend (
QuizBuilder.tsx):errortext from the API instead of always "Failed to invite."quiz.organizersbut the API sendsquizOrganizers, so it was always empty. Fixed, and it shows OWNER / ACCEPTED / PENDINGhttp-server had no tests so I added vitest the way ws-server has it, one small test file for the email check, and a test step in
ci.yml. Same setup lines as my other PR for #211, so whichever merges first the other should apply cleanly.Related issue
Closes #214
Type of change
Which services does this touch?
apps/frontendapps/http-serverapps/ws-serverapps/genAIpackages/db(schema or Prisma changes)How did you test this?
pnpm --filter http-server run test: 14 passpnpm --filter frontend run test: 75 pass, 3 of them new (sidebar and the error message)Bob@Example.comaccount could not accept an invite sent tobob@example.com. After: 400 for missing, blank and invalid email, 409 for self invite, 409 "Already invited" (also for a different letter case and for an email with no account), 409 "Already an organizer", 409 on the second invite link, and the mixed case account accepts finedocker compose upChecklist
pnpm run lintpnpm run check-typespnpm run builddocker-compose up.envfile, API key or other secretpnpm run lintstill fails in the frontend because of errors that were already on main (18, mostlyno-explicit-any), my change adds none.check-typeshas no script for http-server or the frontend, so I also rantscon both and it passes. No schema change, no migration.