RocketChat / RocketChat/Rocket.Chat

Fix incorrect user count in getUsersOfRoom (includes deactivated users)

Open
#38,014 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

While reviewing apps/meteor/server/methods/getUsersOfRoom.ts, I noticed an existing TODO indicating that deactivated users are currently being included in the total user count:

Image

The current implementation counts subscriptions based on the existence of a username, which also includes users that have been deactivated. This results in the total value including users who should no longer be considered active members of the room.

Proposed direction (seeking confirmation before implementation):

  • Update the total calculation to exclude deactivated users, in line with the existing TODO
  • Ensure deactivated users are excluded from the count
  • Keep total and records.length consistent

I’d be happy to work on this fix and submit a PR once the preferred approach is confirmed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read apps/meteor/server/methods/getUsersOfRoom.ts, starting at the existing TODO and the subscription count calculation. Confirm the preferred way to identify deactivated users, then ensure they are excluded and that total matches records.length.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.