core: fix logout all sessions behavior#1178
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughTokenModel.delByUid gained an optional tokenType parameter and now builds a deletion filter { uid, ...(tokenType) } before calling deleteMany. The postDeleteAllTokens handler was updated to call delByUid(uid, token.TYPE_SESSION), so only session tokens for the current user are deleted. Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
packages/hydrooj/src/model/token.tsESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. 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: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/hydrooj/src/model/token.ts`:
- Around line 105-106: TokenModel.delByUid currently calls
TokenModel.coll.deleteMany({ uid, tokenType }) which passes tokenType: undefined
into the Mongo filter; change delByUid to build the query object conditionally
(e.g., start with { uid } and only add tokenType when tokenType !== undefined)
and then call TokenModel.coll.deleteMany(query) so undefined tokenType is not
serialized as null and numeric tokenType documents are matched correctly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2b93e609-11fd-47dc-90fa-46f0a7f3aeb4
📒 Files selected for processing (2)
packages/hydrooj/src/handler/home.tspackages/hydrooj/src/model/token.ts
Summary by CodeRabbit