Skip to content

Commit

Permalink
fix: getActiveLocalUserCount query (#29349)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo authored and sampaiodiego committed Jun 1, 2023
1 parent 7558e6e commit be00878
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/cold-years-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

fix: getActiveLocalUserCount query always returning 0
6 changes: 5 additions & 1 deletion apps/meteor/server/models/raw/Users.js
Original file line number Diff line number Diff line change
Expand Up @@ -2789,7 +2789,11 @@ export class UsersRaw extends BaseRaw {

// here
getActiveLocalUserCount() {
return this.col.countDocuments({ active: true, federated: false, isRemote: false });
return Promise.all([
this.col.countDocuments({ active: true }),
this.col.countDocuments({ federated: true }),
this.col.countDocuments({ isRemote: true }),
]).then((results) => results.reduce((a, b) => a - b));
}

getActiveLocalGuestCount(idExceptions = []) {
Expand Down

0 comments on commit be00878

Please sign in to comment.