Skip to content

fix: normalize room github usernames#2188

Open
nyxsky404 wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
nyxsky404:fix/normalize-room-usernames
Open

fix: normalize room github usernames#2188
nyxsky404 wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
nyxsky404:fix/normalize-room-usernames

Conversation

@nyxsky404
Copy link
Copy Markdown
Contributor

Summary

Normalized collaboration room membership to use stable GitHub logins and case-insensitive invite checks.

Closes #2183


Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor / code cleanup

Changes Made

  • Updated room API routes to use session.githubLogin instead of session.user.name
  • Added shared room username helpers for validation and case-insensitive comparison
  • Normalized invited usernames before GitHub lookup and storage
  • Stored the canonical login returned by the GitHub API when inviting members
  • Added focused tests for username normalization and mixed-case comparison

How to Test

Steps for the reviewer to verify this works:

  1. Run npm run test -- rooms.test.ts
  2. Create or access a collaboration room with an authenticated GitHub account
  3. Invite a user with mixed casing, such as Octocat
  4. Attempt to invite the same user again with different casing, such as octocat
  5. Verify the second invite is rejected as an existing member

Validation performed:

  • npm run test -- rooms.test.ts passes
  • npm run type-check currently fails on existing project-wide dependency/type issues unrelated to this change
  • npm run lint currently fails before linting because @ducanh2912/next-pwa is missing from local module resolution

Screenshots (if UI change)

N/A


Checklist

  • Linked issue in summary
  • npm run lint passes locally
  • No TypeScript errors (npm run type-check)
  • Self-reviewed the diff
  • Added/updated tests if applicable

Accessibility Checklist

  • Proper keyboard navigation tested
  • Responsive UI verified
  • Accessibility labels added where needed

Additional Notes

This change intentionally avoids a database migration and fixes the behavior at the API layer. A future migration could add a case-insensitive uniqueness constraint for stronger database-level enforcement.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 7, 2026

@nyxsky404 is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:bug GSSoC type bonus: bug fix type:testing GSSoC type bonus: tests (+10 pts) labels Jun 7, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 7, 2026

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@Priyanshu-byte-coder
Copy link
Copy Markdown
Owner

This PR now has a merge conflict with main after the Supabase client security split in #2114 was merged (which also modified the rooms routes).

Please rebase your branch on main to resolve the conflicts:

git fetch origin
git rebase origin/main

Once the conflicts are resolved and CI passes, we can merge this.

@nyxsky404 nyxsky404 force-pushed the fix/normalize-room-usernames branch from 0f930de to 12ddf84 Compare June 8, 2026 07:35
@nyxsky404 nyxsky404 force-pushed the fix/normalize-room-usernames branch from 12ddf84 to 57f7bda Compare June 8, 2026 07:38
@nyxsky404
Copy link
Copy Markdown
Contributor Author

nyxsky404 commented Jun 8, 2026

@Priyanshu-byte-coder The 11 failing Playwright smoke tests are pre-existing failures unrelated to this PR's changes. The failures are in api.spec.ts, dashboard.spec.ts, goals.spec.ts, and streak.spec.ts - none of which touch the rooms code changed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc26 GSSoC 2026 contribution type:bug GSSoC type bonus: bug fix type:testing GSSoC type bonus: tests (+10 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Normalize GitHub usernames in collaboration room membership and invites

2 participants