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 May 24, 2023
1 parent 7e00009 commit c95cda4
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 @@ -2819,7 +2819,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 c95cda4

Please sign in to comment.