feature request: QQ ID autofill at registry#1072
Conversation
WalkthroughThe change modifies the user registration handler to extend QQ email domain processing. When a user registers with a QQ email address (domain qq.com) whose local part is entirely numeric, the handler now sets the user's Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/hydrooj/src/handler/user.ts (1)
315-318: Use a more robust numeric check for QQ IDs.The condition
!Number.isNaN(+id)will incorrectly accept edge cases like empty strings (converts to 0), whitespace, decimal numbers like "123.45", and scientific notation like "1e5". For QQ IDs, which should be pure numeric strings, use a regex pattern instead.Apply this diff to use a more precise check:
- if (mailDomain === 'qq.com' && !Number.isNaN(+id)) { + if (mailDomain === 'qq.com' && /^\d+$/.test(id)) { $set.avatar = `qq:${id}`; - $set.qq = `${id}`; + $set.qq = id;Note: Also removed the redundant template literal on line 317 since
idis already a string.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/hydrooj/src/handler/user.ts(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Analyze (javascript)
- GitHub Check: build
|
@coderabbitai generate docstrings |
✅ Actions performedInitiated docstring generation; will generate only if new commits exist. |
|
Caution Docstrings generation - FAILED No docstrings were generated. |
Summary by CodeRabbit