Skip to content

chore update getUsersBasedOnFilter to not include all usersStatus call - #2609

Merged
prakashchoudhary07 merged 1 commit into
developfrom
chore-update-getUsersBasedOnFilter-to-not-include-all-usersStatus-call
Jul 25, 2026
Merged

chore update getUsersBasedOnFilter to not include all usersStatus call#2609
prakashchoudhary07 merged 1 commit into
developfrom
chore-update-getUsersBasedOnFilter-to-not-include-all-usersStatus-call

Conversation

@prakashchoudhary07

@prakashchoudhary07 prakashchoudhary07 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

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?

  • Yes
  • No

Under Feature Flag

  • Yes
  • No

Database Changes

  • Yes
  • No

Breaking Changes

  • Yes
  • No

Development Tested?

  • Yes
  • No

Screenshots

Screenshot 1

Test Coverage

Screenshot 1

Additional Notes

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

User 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.

Changes

User status filtering

Layer / File(s) Summary
Active status filtering
models/userStatus.js, models/users.js
Removed getAllUserStatus, added active Discord user retrieval, and rewrote state filtering to use getUserStatusForUserIds with tag intersection support.
Filter fixture and test updates
test/fixtures/user/user.js, test/integration/usersFilter.test.js, test/unit/models/users.test.js
Added archived role values and onboarding timestamps, and expanded state and onboarding filter assertions.

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
Loading

Poem

I’m a bunny sorting states with care,
Active Discord users hop through the air.
Archived ones stay in their burrowed bed,
Status maps guide each path ahead.
Tags and onboarding now align—
Tests thump happily in a tidy line!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title describes the main refactor to getUsersBasedOnFilter and its removal of the broad usersStatus fetch.
Description check ✅ Passed The description directly matches the PR's refactor of status-based user filtering.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore-update-getUsersBasedOnFilter-to-not-include-all-usersStatus-call

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 227988d and a3831dd.

📒 Files selected for processing (5)
  • models/userStatus.js
  • models/users.js
  • test/fixtures/user/user.js
  • test/integration/usersFilter.test.js
  • test/unit/models/users.test.js
💤 Files with no reviewable changes (1)
  • models/userStatus.js

Comment thread models/users.js
@prakashchoudhary07
prakashchoudhary07 merged commit 97de670 into develop Jul 25, 2026
4 of 5 checks passed
@prakashchoudhary07
prakashchoudhary07 deleted the chore-update-getUsersBasedOnFilter-to-not-include-all-usersStatus-call branch July 25, 2026 15:47
@prakashchoudhary07 prakashchoudhary07 mentioned this pull request Jul 25, 2026
10 tasks
Comment thread models/users.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants