Skip to content

Commit

Permalink
fix: seat counter including bots (#30216)
Browse files Browse the repository at this point in the history
  • Loading branch information
tapiarafael authored Aug 31, 2023
1 parent 761cad4 commit 5321e87
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/moody-pans-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fix seat counter including bots users
6 changes: 3 additions & 3 deletions apps/meteor/server/models/raw/Users.js
Original file line number Diff line number Diff line change
Expand Up @@ -2921,13 +2921,13 @@ export class UsersRaw extends BaseRaw {
this.col.countDocuments({
active: true,
}),
// Count all active that are guests, apps or federated
// Count all active that are guests, apps, bots or federated
// Fast based on indexes, usually based on guest index as is usually small
this.col.countDocuments({
active: true,
$or: [{ roles: ['guest'] }, { type: 'app' }, { federated: true }, { isRemote: true }],
$or: [{ roles: ['guest'] }, { type: { $in: ['app', 'bot'] } }, { federated: true }, { isRemote: true }],
}),
// Get all active and remove the guests, apps, federated, etc
// Get all active and remove the guests, apps, bots and federated
]).then((results) => results.reduce((a, b) => a - b));
}

Expand Down

0 comments on commit 5321e87

Please sign in to comment.