From 82194555ea4569cb1f923f438c87e5cc5e92f072 Mon Sep 17 00:00:00 2001 From: Heitor Tanoue <68477006+totoi690@users.noreply.github.com> Date: Mon, 22 May 2023 15:43:12 -0300 Subject: [PATCH 01/10] fix: Editing a room in the admin menu breaks that room's integration (#29019) Co-authored-by: Matheus Barbosa Silva <36537004+matheusbsilva137@users.noreply.github.com> --- .changeset/quick-cows-repeat.md | 5 +++++ .../server/functions/saveRoomName.ts | 15 ++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 .changeset/quick-cows-repeat.md diff --git a/.changeset/quick-cows-repeat.md b/.changeset/quick-cows-repeat.md new file mode 100644 index 000000000000..310984bdfc4e --- /dev/null +++ b/.changeset/quick-cows-repeat.md @@ -0,0 +1,5 @@ +--- +"@rocket.chat/meteor": patch +--- + +fix: Editing a room in the admin menu breaks that room's integration diff --git a/apps/meteor/app/channel-settings/server/functions/saveRoomName.ts b/apps/meteor/app/channel-settings/server/functions/saveRoomName.ts index 308d113af360..864475a0d229 100644 --- a/apps/meteor/app/channel-settings/server/functions/saveRoomName.ts +++ b/apps/meteor/app/channel-settings/server/functions/saveRoomName.ts @@ -14,9 +14,7 @@ const updateFName = async (rid: string, displayName: string): Promise<(UpdateRes return Promise.all([Rooms.setFnameById(rid, displayName), Subscriptions.updateFnameByRoomId(rid, displayName)]); }; -const updateRoomName = async (rid: string, displayName: string) => { - const slugifiedRoomName = await getValidRoomName(displayName, rid); - +const updateRoomName = async (rid: string, displayName: string, slugifiedRoomName: string) => { // Check if the username is available if (!(await checkUsernameAvailability(slugifiedRoomName))) { throw new Meteor.Error('error-duplicate-handle', `A room, team or user with name '${slugifiedRoomName}' already exists`, { @@ -52,24 +50,27 @@ export async function saveRoomName( if (displayName === room.name) { return; } - const isDiscussion = Boolean(room?.prid); - let update; if (!displayName?.trim()) { return; } + const slugifiedRoomName = await getValidRoomName(displayName, rid); + const isDiscussion = Boolean(room?.prid); + + let update; + if (isDiscussion || isRoomFederated(room)) { update = await updateFName(rid, displayName); } else { - update = await updateRoomName(rid, displayName); + update = await updateRoomName(rid, displayName, slugifiedRoomName); } if (!update) { return; } - room.name && (await Integrations.updateRoomName(room.name, displayName)); + room.name && (await Integrations.updateRoomName(room.name, slugifiedRoomName)); if (sendMessage) { await Message.saveSystemMessage('r', rid, displayName, user); } From 35aeeed1cab7875bb622f4c1a33be743ab7e851e Mon Sep 17 00:00:00 2001 From: Yash Rajpal <58601732+yash-rajpal@users.noreply.github.com> Date: Tue, 23 May 2023 01:51:54 +0530 Subject: [PATCH 02/10] fix: Room leader padding always visible (#29303) --- .changeset/late-carrots-think.md | 5 +++++ apps/meteor/client/views/room/components/body/RoomBody.tsx | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/late-carrots-think.md diff --git a/.changeset/late-carrots-think.md b/.changeset/late-carrots-think.md new file mode 100644 index 000000000000..4a27a6c1ef77 --- /dev/null +++ b/.changeset/late-carrots-think.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/meteor': minor +--- + +fix: Hide roomLeader padding diff --git a/apps/meteor/client/views/room/components/body/RoomBody.tsx b/apps/meteor/client/views/room/components/body/RoomBody.tsx index 40a5199eecda..2859395ac2cc 100644 --- a/apps/meteor/client/views/room/components/body/RoomBody.tsx +++ b/apps/meteor/client/views/room/components/body/RoomBody.tsx @@ -563,7 +563,10 @@ const RoomBody = (): ReactElement => { /> ))} -
+
Date: Mon, 22 May 2023 22:27:58 -0300 Subject: [PATCH 03/10] regression: fix sdk regressions (#29327) * regression: presence structure * regression: fix response.json() being called twice --- apps/meteor/app/notifications/client/lib/Presence.ts | 4 ++-- .../server/modules/notifications/notifications.module.ts | 2 +- packages/api-client/__tests__/2fahandling.spec.ts | 2 +- packages/api-client/src/index.ts | 4 +++- packages/ui-contexts/src/ServerContext/streams.ts | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/meteor/app/notifications/client/lib/Presence.ts b/apps/meteor/app/notifications/client/lib/Presence.ts index 29e0709c0ac9..adeaa4d67f2c 100644 --- a/apps/meteor/app/notifications/client/lib/Presence.ts +++ b/apps/meteor/app/notifications/client/lib/Presence.ts @@ -4,10 +4,10 @@ import { Presence, STATUS_MAP } from '../../../../client/lib/presence'; // TODO implement API on Streamer to be able to listen to all streamed data // this is a hacky way to listen to all streamed data from user-presence Streamer -(Meteor as any).StreamerCentral.on('stream-user-presence', (uid: string, args: unknown) => { +(Meteor as any).StreamerCentral.on('stream-user-presence', (uid: string, ...args: unknown[]) => { if (!Array.isArray(args)) { throw new Error('Presence event must be an array'); } - const [username, status, statusText] = args as [string, number, string | undefined]; + const [username, status, statusText] = args[0] as [string, number, string | undefined]; Presence.notify({ _id: uid, username, status: STATUS_MAP[status], statusText }); }); diff --git a/apps/meteor/server/modules/notifications/notifications.module.ts b/apps/meteor/server/modules/notifications/notifications.module.ts index a9fd5fadd013..46d437f0544a 100644 --- a/apps/meteor/server/modules/notifications/notifications.module.ts +++ b/apps/meteor/server/modules/notifications/notifications.module.ts @@ -535,7 +535,7 @@ export class NotificationsModule { // console.log('notifyUserAndBroadcast', [userId, eventName, ...args]); // } emit(uid, args as any); - return this.streamPresence.emitWithoutBroadcast(uid, ...args); + return this.streamPresence.emitWithoutBroadcast(uid, args); } progressUpdated(progress: { diff --git a/packages/api-client/__tests__/2fahandling.spec.ts b/packages/api-client/__tests__/2fahandling.spec.ts index f4cffc105d55..a53cd8928457 100644 --- a/packages/api-client/__tests__/2fahandling.spec.ts +++ b/packages/api-client/__tests__/2fahandling.spec.ts @@ -71,7 +71,7 @@ test('if the 2fa handler is not provided, it should throw an error', async () => expect(error.status).toBe(400); - const body = error.body && (await JSON.parse(error.body.toString())); + const body = error.json(); expect(body).toMatchObject({ errorType: 'totp-required', diff --git a/packages/api-client/src/index.ts b/packages/api-client/src/index.ts index fbad9807f451..a93cb5942730 100644 --- a/packages/api-client/src/index.ts +++ b/packages/api-client/src/index.ts @@ -234,7 +234,9 @@ export class RestClient implements RestClientInterface { return Promise.reject(response); } - const error = await response.json(); + const clone = response.clone(); + + const error = await clone.json(); if ((isTotpRequiredError(error) || isTotpInvalidError(error)) && hasRequiredTwoFactorMethod(error) && this.twoFactorHandler) { const method2fa = 'details' in error ? error.details.method : 'password'; diff --git a/packages/ui-contexts/src/ServerContext/streams.ts b/packages/ui-contexts/src/ServerContext/streams.ts index 036941a983d5..6165e15708d6 100644 --- a/packages/ui-contexts/src/ServerContext/streams.ts +++ b/packages/ui-contexts/src/ServerContext/streams.ts @@ -297,7 +297,7 @@ export interface StreamerEvents { }, ]; - 'user-presence': [{ key: string; args: [username: string, statusChanged?: 0 | 1 | 2 | 3, statusText?: string] }]; + 'user-presence': [{ key: string; args: [[username: string, statusChanged?: 0 | 1 | 2 | 3, statusText?: string]] }]; // TODO: rename to 'integration-history' 'integrationHistory': [ From 1687bfbe3a6af77614e2c20a0ec9c59a218edc66 Mon Sep 17 00:00:00 2001 From: Debdut Chakraborty Date: Tue, 23 May 2023 18:20:32 +0530 Subject: [PATCH 04/10] fix: unable to create user if Accounts_ManuallyApproveNewUsers is enabled (#29293) --- .changeset/heavy-years-repeat.md | 5 +++++ apps/meteor/app/authentication/server/startup/index.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/heavy-years-repeat.md diff --git a/.changeset/heavy-years-repeat.md b/.changeset/heavy-years-repeat.md new file mode 100644 index 000000000000..fc88cd86553b --- /dev/null +++ b/.changeset/heavy-years-repeat.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/meteor': patch +--- + +fix: Admins unable to create new users if new users require manual approval diff --git a/apps/meteor/app/authentication/server/startup/index.js b/apps/meteor/app/authentication/server/startup/index.js index f8d39f14b7ab..726518465e9c 100644 --- a/apps/meteor/app/authentication/server/startup/index.js +++ b/apps/meteor/app/authentication/server/startup/index.js @@ -196,7 +196,7 @@ const onCreateUserAsync = async function (options, user = {}) { if (!user.active) { const destinations = []; const usersInRole = await Roles.findUsersInRole('admin'); - await usersInRole.toArray().forEach((adminUser) => { + await usersInRole.forEach((adminUser) => { if (Array.isArray(adminUser.emails)) { adminUser.emails.forEach((email) => { destinations.push(`${adminUser.name}<${email.address}>`); From f8cd53bc7e89ab45c8963d65c99c96d87756d91a Mon Sep 17 00:00:00 2001 From: Kevin Aleman Date: Tue, 23 May 2023 11:03:58 -0600 Subject: [PATCH 05/10] fix: Add missing awaits to .count() calls (#29323) --- .changeset/quiet-rules-swim.md | 5 +++++ apps/meteor/app/importer-pending-avatars/server/importer.js | 2 +- apps/meteor/app/livechat/client/startup/notifyUnreadRooms.js | 2 +- apps/meteor/app/livechat/server/lib/Helper.js | 2 +- apps/meteor/app/livechat/server/lib/Livechat.js | 2 +- apps/meteor/app/slashcommands-inviteall/server/server.ts | 4 ++-- 6 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 .changeset/quiet-rules-swim.md diff --git a/.changeset/quiet-rules-swim.md b/.changeset/quiet-rules-swim.md new file mode 100644 index 000000000000..005517c1d695 --- /dev/null +++ b/.changeset/quiet-rules-swim.md @@ -0,0 +1,5 @@ +--- +"@rocket.chat/meteor": patch +--- + +fix: Add missing awaits to .count() calls diff --git a/apps/meteor/app/importer-pending-avatars/server/importer.js b/apps/meteor/app/importer-pending-avatars/server/importer.js index b85792a406c1..912d253e808c 100644 --- a/apps/meteor/app/importer-pending-avatars/server/importer.js +++ b/apps/meteor/app/importer-pending-avatars/server/importer.js @@ -9,7 +9,7 @@ export class PendingAvatarImporter extends Base { await super.updateProgress(ProgressStep.PREPARING_STARTED); const users = await Users.findAllUsersWithPendingAvatar(); - const fileCount = users.count(); + const fileCount = await users.count(); if (fileCount === 0) { await super.updateProgress(ProgressStep.DONE); diff --git a/apps/meteor/app/livechat/client/startup/notifyUnreadRooms.js b/apps/meteor/app/livechat/client/startup/notifyUnreadRooms.js index 51af1a47aa38..f730925f50d9 100644 --- a/apps/meteor/app/livechat/client/startup/notifyUnreadRooms.js +++ b/apps/meteor/app/livechat/client/startup/notifyUnreadRooms.js @@ -16,7 +16,7 @@ Meteor.startup(() => { return; } - const subs = Subscriptions.find({ t: 'l', ls: { $exists: 0 }, open: true }).count(); + const subs = await Subscriptions.find({ t: 'l', ls: { $exists: 0 }, open: true }).count(); if (subs === 0) { audio && audio.pause(); return; diff --git a/apps/meteor/app/livechat/server/lib/Helper.js b/apps/meteor/app/livechat/server/lib/Helper.js index e862ec350760..eb57dcf8e697 100644 --- a/apps/meteor/app/livechat/server/lib/Helper.js +++ b/apps/meteor/app/livechat/server/lib/Helper.js @@ -299,7 +299,7 @@ export const dispatchInquiryQueued = async (inquiry, agent) => { return; } - logger.debug(`Notifying ${onlineAgents.count()} agents of new inquiry`); + logger.debug(`Notifying ${await onlineAgents.count()} agents of new inquiry`); const notificationUserName = v && (v.name || v.username); for await (let agent of onlineAgents) { diff --git a/apps/meteor/app/livechat/server/lib/Livechat.js b/apps/meteor/app/livechat/server/lib/Livechat.js index ae39d8a21d87..fca1813820da 100644 --- a/apps/meteor/app/livechat/server/lib/Livechat.js +++ b/apps/meteor/app/livechat/server/lib/Livechat.js @@ -78,7 +78,7 @@ export const Livechat = { if (settings.get('Livechat_assign_new_conversation_to_bot')) { Livechat.logger.debug(`Fetching online bot agents for department ${department}`); const botAgents = await Livechat.getBotAgents(department); - const onlineBots = botAgents.count(); + const onlineBots = await botAgents.count(); Livechat.logger.debug(`Found ${onlineBots} online`); if (onlineBots > 0) { return true; diff --git a/apps/meteor/app/slashcommands-inviteall/server/server.ts b/apps/meteor/app/slashcommands-inviteall/server/server.ts index 8478bbfba003..cd5ed9dc4932 100644 --- a/apps/meteor/app/slashcommands-inviteall/server/server.ts +++ b/apps/meteor/app/slashcommands-inviteall/server/server.ts @@ -57,11 +57,11 @@ function inviteAll(type: T): SlashCommand['callback'] { }); try { - const APIsettings = settings.get('API_User_Limit'); + const APIsettings = settings.get('API_User_Limit'); if (!APIsettings) { return; } - if (cursor.count() > APIsettings) { + if ((await cursor.count()) > APIsettings) { throw new Meteor.Error('error-user-limit-exceeded', 'User Limit Exceeded', { method: 'addAllToRoom', }); From cc68894674070308f4fec02444d677e1f9261871 Mon Sep 17 00:00:00 2001 From: csuadev <72958726+csuadev@users.noreply.github.com> Date: Tue, 23 May 2023 14:57:34 -0500 Subject: [PATCH 06/10] chore: hide releases tab for private apps on marketplace (#29129) --- .../marketplace/AppDetailsPage/AppDetailsPage.tsx | 6 +++--- .../AppDetailsPage/AppDetailsPageTabs.tsx | 14 +++----------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/apps/meteor/client/views/marketplace/AppDetailsPage/AppDetailsPage.tsx b/apps/meteor/client/views/marketplace/AppDetailsPage/AppDetailsPage.tsx index 4272db0522d9..d1688b22c6ab 100644 --- a/apps/meteor/client/views/marketplace/AppDetailsPage/AppDetailsPage.tsx +++ b/apps/meteor/client/views/marketplace/AppDetailsPage/AppDetailsPage.tsx @@ -53,7 +53,8 @@ const AppDetailsPage = ({ id }: { id: App['id'] }): ReactElement => { context && router.push({ context, page: 'list' }); }); - const { installed, settings, privacyPolicySummary, permissions, tosLink, privacyLink, marketplace, name } = appData || {}; + const { installed, settings, privacyPolicySummary, permissions, tosLink, privacyLink, name } = appData || {}; + const isSecurityVisible = Boolean(privacyPolicySummary || permissions || tosLink || privacyLink); const saveAppSettings = useCallback(async () => { @@ -94,12 +95,11 @@ const AppDetailsPage = ({ id }: { id: App['id'] }): ReactElement => { <> {Boolean(!tab || tab === 'details') && } {tab === 'requests' && } diff --git a/apps/meteor/client/views/marketplace/AppDetailsPage/AppDetailsPageTabs.tsx b/apps/meteor/client/views/marketplace/AppDetailsPage/AppDetailsPageTabs.tsx index ff3ddef243a0..d93af7b44d19 100644 --- a/apps/meteor/client/views/marketplace/AppDetailsPage/AppDetailsPageTabs.tsx +++ b/apps/meteor/client/views/marketplace/AppDetailsPage/AppDetailsPageTabs.tsx @@ -6,22 +6,14 @@ import React from 'react'; import type { ISettings } from '../../../../ee/client/apps/@types/IOrchestrator'; type AppDetailsPageTabsProps = { + context: string; installed: boolean | undefined; isSecurityVisible: boolean; - marketplace: unknown; settings: ISettings | undefined; tab: string | undefined; - context: string; }; -const AppDetailsPageTabs = ({ - installed, - isSecurityVisible, - marketplace, - settings, - tab, - context, -}: AppDetailsPageTabsProps): ReactElement => { +const AppDetailsPageTabs = ({ context, installed, isSecurityVisible, settings, tab }: AppDetailsPageTabsProps): ReactElement => { const t = useTranslation(); const isAdminUser = usePermission('manage-apps'); @@ -51,7 +43,7 @@ const AppDetailsPageTabs = ({ {t('Security')} )} - {marketplace !== false && ( + {context !== 'private' && ( handleTabClick('releases')} selected={tab === 'releases'}> {t('Releases')} From 09075132385b32caafe29d038c5d856f021cd3bd Mon Sep 17 00:00:00 2001 From: Kevin Aleman Date: Tue, 23 May 2023 16:07:30 -0600 Subject: [PATCH 07/10] test: Fix Omnichannel Webhooks tests (#29344) --- .github/workflows/ci-test-e2e.yml | 1 + apps/meteor/tests/end-to-end/api/livechat/06-integrations.ts | 1 + docker-compose-ci.yml | 1 - 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-test-e2e.yml b/.github/workflows/ci-test-e2e.yml index 2fca0c3e36ac..a27915154277 100644 --- a/.github/workflows/ci-test-e2e.yml +++ b/.github/workflows/ci-test-e2e.yml @@ -214,6 +214,7 @@ jobs: if: inputs.type == 'api' working-directory: ./apps/meteor env: + WEBHOOK_TEST_URL: 'http://host.docker.internal:10000' IS_EE: ${{ inputs.release == 'ee' && 'true' || '' }} run: | for i in $(seq 1 2); do diff --git a/apps/meteor/tests/end-to-end/api/livechat/06-integrations.ts b/apps/meteor/tests/end-to-end/api/livechat/06-integrations.ts index f5a88fd69ca2..8a90822406da 100644 --- a/apps/meteor/tests/end-to-end/api/livechat/06-integrations.ts +++ b/apps/meteor/tests/end-to-end/api/livechat/06-integrations.ts @@ -123,6 +123,7 @@ describe('LIVECHAT - Integrations', function () { describe('Livechat - Webhooks', () => { const webhookUrl = process.env.WEBHOOK_TEST_URL || 'https://httpbin.org'; + describe('livechat/webhook.test', () => { it('should fail when user doesnt have view-livechat-webhooks permission', async () => { await updatePermission('view-livechat-webhooks', []); diff --git a/docker-compose-ci.yml b/docker-compose-ci.yml index a47ca7db662c..ab54ed2d57d2 100644 --- a/docker-compose-ci.yml +++ b/docker-compose-ci.yml @@ -15,7 +15,6 @@ services: - 'TRANSPORTER=${TRANSPORTER}' - MOLECULER_LOG_LEVEL=info - 'ROCKETCHAT_LICENSE=${ENTERPRISE_LICENSE}' - - 'WEBHOOK_TEST_URL=host.docker.internal:10000' extra_hosts: - 'host.docker.internal:host-gateway' depends_on: From 89e2c266255025cc69781c23504648261a48dd04 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Tue, 23 May 2023 22:00:08 -0300 Subject: [PATCH 08/10] regression: Fix secondary presence streamer (#29340) --- apps/meteor/app/notifications/client/lib/Presence.ts | 10 +++++++--- apps/meteor/app/notifications/server/lib/Presence.ts | 5 +++-- .../modules/notifications/notifications.module.ts | 5 +---- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/apps/meteor/app/notifications/client/lib/Presence.ts b/apps/meteor/app/notifications/client/lib/Presence.ts index adeaa4d67f2c..0c04a164d936 100644 --- a/apps/meteor/app/notifications/client/lib/Presence.ts +++ b/apps/meteor/app/notifications/client/lib/Presence.ts @@ -1,13 +1,17 @@ import { Meteor } from 'meteor/meteor'; +import type { StreamerEvents } from '@rocket.chat/ui-contexts'; import { Presence, STATUS_MAP } from '../../../../client/lib/presence'; // TODO implement API on Streamer to be able to listen to all streamed data // this is a hacky way to listen to all streamed data from user-presence Streamer -(Meteor as any).StreamerCentral.on('stream-user-presence', (uid: string, ...args: unknown[]) => { + +new Meteor.Streamer('user-presence'); + +(Meteor as any).StreamerCentral.on('stream-user-presence', (uid: string, ...args: StreamerEvents['user-presence'][number]['args']) => { if (!Array.isArray(args)) { throw new Error('Presence event must be an array'); } - const [username, status, statusText] = args[0] as [string, number, string | undefined]; - Presence.notify({ _id: uid, username, status: STATUS_MAP[status], statusText }); + const [[username, status, statusText]] = args; + Presence.notify({ _id: uid, username, status: STATUS_MAP[status ?? 0], statusText }); }); diff --git a/apps/meteor/app/notifications/server/lib/Presence.ts b/apps/meteor/app/notifications/server/lib/Presence.ts index 304e533d599a..5f258c05f998 100644 --- a/apps/meteor/app/notifications/server/lib/Presence.ts +++ b/apps/meteor/app/notifications/server/lib/Presence.ts @@ -1,6 +1,7 @@ import { Emitter } from '@rocket.chat/emitter'; import type { IPublication, IStreamerConstructor, Connection, IStreamer } from 'meteor/rocketchat:streamer'; import type { IUser } from '@rocket.chat/core-typings'; +import type { StreamerEvents } from '@rocket.chat/ui-contexts'; type UserPresenceStreamProps = { added: IUser['_id'][]; @@ -9,7 +10,7 @@ type UserPresenceStreamProps = { type UserPresenceStreamArgs = { uid: string; - args: unknown; + args: StreamerEvents['user-presence'][number]['args']; }; const e = new Emitter<{ @@ -97,6 +98,6 @@ export class StreamPresence { } } -export const emit = (uid: string, args: UserPresenceStreamArgs): void => { +export const emit = (uid: string, args: UserPresenceStreamArgs['args']): void => { e.emit(uid, { uid, args }); }; diff --git a/apps/meteor/server/modules/notifications/notifications.module.ts b/apps/meteor/server/modules/notifications/notifications.module.ts index 46d437f0544a..0b82792ee819 100644 --- a/apps/meteor/server/modules/notifications/notifications.module.ts +++ b/apps/meteor/server/modules/notifications/notifications.module.ts @@ -531,10 +531,7 @@ export class NotificationsModule { } sendPresence(uid: string, ...args: [username: string, statusChanged: 0 | 1 | 2 | 3, statusText: string | undefined]): void { - // if (this.debug === true) { - // console.log('notifyUserAndBroadcast', [userId, eventName, ...args]); - // } - emit(uid, args as any); + emit(uid, [args]); return this.streamPresence.emitWithoutBroadcast(uid, args); } From 7e00009ddb2d23995eacf5b176b0ebc8007e4bb6 Mon Sep 17 00:00:00 2001 From: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com> Date: Wed, 24 May 2023 10:15:40 +0530 Subject: [PATCH 09/10] fix: Application crashes when clicking on Analytics option in Omnichannel view page (#29286) Co-authored-by: Yash Rajpal <58601732+yash-rajpal@users.noreply.github.com> --- .changeset/wild-lizards-guess.md | 5 +++++ apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/wild-lizards-guess.md diff --git a/.changeset/wild-lizards-guess.md b/.changeset/wild-lizards-guess.md new file mode 100644 index 000000000000..4a7b45515df7 --- /dev/null +++ b/.changeset/wild-lizards-guess.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/meteor': minor +--- + +fix: Analytics page crash diff --git a/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json b/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json index 3873e3448fc3..f2e5c8da4769 100644 --- a/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json @@ -17,7 +17,7 @@ "@username": "@username", "@username_message": "@username ", "#channel": "#channel", - "%_of_conversations": "% of Conversations", + "%_of_conversations": "%% of Conversations", "0_Errors_Only": "0 - Errors Only", "1_Errors_and_Information": "1 - Errors and Information", "2_Erros_Information_and_Debug": "2 - Errors, Information and Debug", From c95cda43e69b931cb2c902f9cd031ac064930f6a Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Wed, 24 May 2023 11:03:07 -0300 Subject: [PATCH 10/10] fix: getActiveLocalUserCount query (#29349) --- .changeset/cold-years-beg.md | 5 +++++ apps/meteor/server/models/raw/Users.js | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .changeset/cold-years-beg.md diff --git a/.changeset/cold-years-beg.md b/.changeset/cold-years-beg.md new file mode 100644 index 000000000000..4c4cf5c03568 --- /dev/null +++ b/.changeset/cold-years-beg.md @@ -0,0 +1,5 @@ +--- +"@rocket.chat/meteor": patch +--- + +fix: getActiveLocalUserCount query always returning 0 diff --git a/apps/meteor/server/models/raw/Users.js b/apps/meteor/server/models/raw/Users.js index 066fad73fc9d..2e31696eda52 100644 --- a/apps/meteor/server/models/raw/Users.js +++ b/apps/meteor/server/models/raw/Users.js @@ -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 = []) {