chore update getUsersBasedOnFilter to not include all usersStatus call - #2609
Conversation
WalkthroughUser filtering now uses active, non-archived Discord users and batched status lookups for state filtering. The obsolete all-status helper was removed, and fixtures plus integration and unit tests were updated for archived flags, onboarding timestamps, and state results. ChangesUser status filtering
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Sequence Diagram(s)sequenceDiagram
participant Filter
participant ActiveUsers
participant StatusLookup
participant Firestore
Filter->>ActiveUsers: Retrieve active Discord users
ActiveUsers->>Firestore: Query non-archived Discord users
Firestore-->>ActiveUsers: Return user documents
Filter->>StatusLookup: Fetch statuses for user IDs
StatusLookup-->>Filter: Return status map
Filter->>Filter: Apply state and tag filters
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 `@models/users.js`:
- Around line 630-632: Update getActiveDiscordUsers to query only
roles.in_discord == true, then filter the mapped users in memory so users with
missing roles.archived are retained while archived users are excluded; preserve
each returned user’s id and data.
🪄 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: ASSERTIVE
Plan: Pro Plus
Run ID: ec644704-03ff-49c4-bf4c-42466e7e050e
📒 Files selected for processing (5)
models/userStatus.jsmodels/users.jstest/fixtures/user/user.jstest/integration/usersFilter.test.jstest/unit/models/users.test.js
💤 Files with no reviewable changes (1)
- models/userStatus.js
Date: 25-07-26
Developer Name: @prakashchoudhary07
Issue Ticket Number
#2603
Description
Update getUsersBasedOnFilter to not get all the docs of the usersStatus collection when filtering users with status
Documentation Updated?
Under Feature Flag
Database Changes
Breaking Changes
Development Tested?
Screenshots
Screenshot 1
Test Coverage
Screenshot 1
Additional Notes