From 5321e873634e9037c805ce135cf7cf37cc3de187 Mon Sep 17 00:00:00 2001 From: Rafael Tapia Date: Thu, 31 Aug 2023 16:32:38 -0300 Subject: [PATCH] fix: seat counter including bots (#30216) --- .changeset/moody-pans-act.md | 5 +++++ apps/meteor/server/models/raw/Users.js | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .changeset/moody-pans-act.md diff --git a/.changeset/moody-pans-act.md b/.changeset/moody-pans-act.md new file mode 100644 index 000000000000..6c307604eaa9 --- /dev/null +++ b/.changeset/moody-pans-act.md @@ -0,0 +1,5 @@ +--- +"@rocket.chat/meteor": patch +--- + +Fix seat counter including bots users diff --git a/apps/meteor/server/models/raw/Users.js b/apps/meteor/server/models/raw/Users.js index 03c3ab2769c9..dc3441092892 100644 --- a/apps/meteor/server/models/raw/Users.js +++ b/apps/meteor/server/models/raw/Users.js @@ -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)); }