From 855c5c2adcf4ef64bccc43f3d2cce4959f96d9df Mon Sep 17 00:00:00 2001 From: gabriellsh <40830821+gabriellsh@users.noreply.github.com> Date: Mon, 22 Jun 2026 13:51:28 -0300 Subject: [PATCH 001/220] test: flaky `session-expiration-redirect.spec` (#41018) --- .../tests/e2e/session-expiration-redirect.spec.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/apps/meteor/tests/e2e/session-expiration-redirect.spec.ts b/apps/meteor/tests/e2e/session-expiration-redirect.spec.ts index 1079d66669950..7098cd9a69c22 100644 --- a/apps/meteor/tests/e2e/session-expiration-redirect.spec.ts +++ b/apps/meteor/tests/e2e/session-expiration-redirect.spec.ts @@ -2,7 +2,7 @@ import { MongoClient } from 'mongodb'; import { URL_MONGODB } from './config/constants'; import injectInitialData from './fixtures/inject-initial-data'; -import { restoreState, Users } from './fixtures/userStates'; +import { Users } from './fixtures/userStates'; import { HomeChannel } from './page-objects'; import { createTargetChannel, deleteChannel } from './utils'; import { test, expect } from './utils/test'; @@ -25,7 +25,7 @@ test.describe('Session Expiration Redirect', () => { let targetChannel: string; test.beforeAll(async ({ api }) => { - targetChannel = await createTargetChannel(api, { members: ['user1'] }); + targetChannel = await createTargetChannel(api, { members: [Users.user1.data.username] }); }); test.afterAll(async ({ api }) => { @@ -34,11 +34,10 @@ test.describe('Session Expiration Redirect', () => { test.beforeEach(async ({ page }) => { poHomeChannel = new HomeChannel(page); - await page.goto(`/channel/${targetChannel}`); + await poHomeChannel.gotoChannel(targetChannel); }); - test.afterEach(async ({ page }) => { + test.afterEach(async () => { await injectInitialData(); - await restoreState(page, Users.user1); }); test('should redirect to login page when server-side token is deleted and user tries to interact', async ({ page }) => { @@ -60,9 +59,7 @@ test.describe('Session Expiration Redirect', () => { }); await test.step('should redirect to login page', async () => { - const loginForm = page.getByRole('form', { name: 'Login' }); - await loginForm.waitFor({ state: 'visible', timeout: 20000 }); - await expect(loginForm).toBeVisible(); + await expect(page.getByRole('form', { name: 'Login' })).toBeVisible(); }); await test.step('verify localStorage was cleared', async () => { @@ -90,7 +87,7 @@ test.describe('Session Expiration Redirect', () => { }); await test.step('expect automatic redirect to login page', async () => { - await expect(page.getByRole('form', { name: 'Login' })).toBeVisible({ timeout: 10000 }); + await expect(page.getByRole('form', { name: 'Login' })).toBeVisible(); }); await test.step('verify localStorage was cleared', async () => { From ffaa11569669757fc0e435f66b754bcc1706b8e5 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Mon, 22 Jun 2026 14:17:41 -0300 Subject: [PATCH 002/220] refactor(ui-voip): extract PeerCardsView from MediaCallRoomSection (#41041) --- .../MediaCallRoomSection.tsx | 85 +------------- .../MediaCallRoomSection/PeerCardsView.tsx | 108 ++++++++++++++++++ 2 files changed, 114 insertions(+), 79 deletions(-) create mode 100644 packages/ui-voip/src/views/MediaCallRoomSection/PeerCardsView.tsx diff --git a/packages/ui-voip/src/views/MediaCallRoomSection/MediaCallRoomSection.tsx b/packages/ui-voip/src/views/MediaCallRoomSection/MediaCallRoomSection.tsx index 0429312e03f6e..c0bf5f3d72766 100644 --- a/packages/ui-voip/src/views/MediaCallRoomSection/MediaCallRoomSection.tsx +++ b/packages/ui-voip/src/views/MediaCallRoomSection/MediaCallRoomSection.tsx @@ -1,16 +1,13 @@ -import { Box, Button, ButtonGroup } from '@rocket.chat/fuselage'; -import { memo, useState } from 'react'; +import { Box, ButtonGroup } from '@rocket.chat/fuselage'; +import { memo } from 'react'; import { useTranslation } from 'react-i18next'; +import PeerCardsView from './PeerCardsView'; import { ToggleButton, Timer, DevicePicker, ActionButton, - CardListContainer, - CardListSection, - PeerCard, - StreamCard, useShouldWrapCards, CARD_LIST_SECTION_MAX_HEIGHT, ActionStrip, @@ -19,7 +16,6 @@ import { import { useMediaCallInstance } from '../../context/MediaCallInstanceContext'; import { useMediaCallView } from '../../context/MediaCallViewContext'; import useRegisterView from '../../context/useRegisterView'; -import { usePlayMediaStream } from '../../providers/usePlayMediaStream'; type MediaCallRoomSectionProps = { showChat: boolean; @@ -48,7 +44,6 @@ const getSplitStyles = (showChat?: boolean) => { const MediaCallRoomSection = ({ showChat, onToggleChat, user, containerHeight }: MediaCallRoomSectionProps) => { const { t } = useTranslation(); - const [focusedCard, setFocusedCard] = useState<'remote' | 'local' | null>('remote'); const { sessionState, onMute, @@ -58,74 +53,25 @@ const MediaCallRoomSection = ({ showChat, onToggleChat, user, containerHeight }: onToggleScreenSharing, onOpenPopout, onClosePopout, - streams: { remoteScreen, localScreen }, + streams: { localScreen }, } = useMediaCallView(); const { currentViews } = useMediaCallInstance(); const isPopout = currentViews.includes('popout'); - const { muted, held, remoteMuted, remoteHeld, peerInfo, connectionState, startedAt } = sessionState; + const { muted, held, peerInfo, connectionState, startedAt } = sessionState; const shouldWrapCards = useShouldWrapCards(showChat, containerHeight); const connecting = connectionState === 'CONNECTING'; const reconnecting = connectionState === 'RECONNECTING'; - const [remoteStreamRefCallback] = usePlayMediaStream(remoteScreen?.stream ?? null); - const [localStreamRefCallback] = usePlayMediaStream(localScreen?.stream ?? null); - useRegisterView('room'); - const onClickFocusRemoteCard = () => { - setFocusedCard((prev) => (prev === 'remote' ? null : 'remote')); - }; - - const onClickFocusLocalCard = () => { - setFocusedCard((prev) => (prev === 'local' ? null : 'local')); - }; - if (!peerInfo || 'number' in peerInfo) { return null; } - const remoteStreamCard = remoteScreen?.active ? ( - - - - ) : null; - - const localStreamCard = localScreen?.active ? ( - - - - ) : null; - - const focusedCardElement = focusedCard === 'remote' ? remoteStreamCard : localStreamCard; - return ( - - {isPopout && ( - - - {t('Call_open_separate_window')} - - - - )} - {!isPopout && ( - - - - {focusedCard !== 'remote' && remoteStreamCard} - {focusedCard !== 'local' && localStreamCard} - - )} - + diff --git a/packages/ui-voip/src/views/MediaCallRoomSection/PeerCardsView.tsx b/packages/ui-voip/src/views/MediaCallRoomSection/PeerCardsView.tsx new file mode 100644 index 0000000000000..0b25b1246df0b --- /dev/null +++ b/packages/ui-voip/src/views/MediaCallRoomSection/PeerCardsView.tsx @@ -0,0 +1,108 @@ +import { Box, Button } from '@rocket.chat/fuselage'; +import { useState } from 'react'; +import { useTranslation } from 'react-i18next'; + +import { CardListContainer, CardListSection, PeerCard, StreamCard } from '../../components'; +import { useMediaCallView } from '../../context'; +import { useMediaCallInstance } from '../../context/MediaCallInstanceContext'; +import { usePlayMediaStream } from '../../providers/usePlayMediaStream'; + +type PeerCardsViewProps = { + shouldWrapCards: boolean; + user: { + displayName: string; + avatarUrl: string; + }; +}; + +const PeerCardsView = ({ user, shouldWrapCards }: PeerCardsViewProps) => { + const { t } = useTranslation(); + const [focusedCard, setFocusedCard] = useState<'remote' | 'local' | null>('remote'); + const { + sessionState, + onToggleScreenSharing, + onClosePopout, + streams: { remoteScreen, localScreen }, + } = useMediaCallView(); + const { currentViews } = useMediaCallInstance(); + const isPopout = currentViews.includes('popout'); + const { muted, held, remoteMuted, remoteHeld, peerInfo } = sessionState; + + const [remoteStreamRefCallback] = usePlayMediaStream(remoteScreen?.stream ?? null); + const [localStreamRefCallback] = usePlayMediaStream(localScreen?.stream ?? null); + + const onClickFocusRemoteCard = () => { + setFocusedCard((prev) => (prev === 'remote' ? null : 'remote')); + }; + + const onClickFocusLocalCard = () => { + setFocusedCard((prev) => (prev === 'local' ? null : 'local')); + }; + + if (!peerInfo || 'number' in peerInfo) { + return null; + } + + const remoteStreamCard = remoteScreen?.active ? ( + + + + ) : null; + + const localStreamCard = localScreen?.active ? ( + + + + ) : null; + + const focusedCardElement = focusedCard === 'remote' ? remoteStreamCard : localStreamCard; + + return ( + + {isPopout && ( + + + {t('Call_open_separate_window')} + + + + )} + {!isPopout && ( + + + + {focusedCard !== 'remote' && remoteStreamCard} + {focusedCard !== 'local' && localStreamCard} + + )} + + ); +}; + +export default PeerCardsView; From c3b4d0ef3450cbd6da5ce528c6081ebfcfe50f03 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Tue, 23 Jun 2026 10:44:56 -0300 Subject: [PATCH 003/220] bump rocket.chat to 8.7.0-develop --- apps/meteor/app/utils/rocketchat.info | 2 +- apps/meteor/package.json | 2 +- package.json | 2 +- packages/core-typings/package.json | 2 +- packages/rest-typings/package.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/meteor/app/utils/rocketchat.info b/apps/meteor/app/utils/rocketchat.info index bcfa0a08beb74..a98b51ead6150 100644 --- a/apps/meteor/app/utils/rocketchat.info +++ b/apps/meteor/app/utils/rocketchat.info @@ -1,3 +1,3 @@ { - "version": "8.6.0-rc.0" + "version": "8.7.0-develop" } diff --git a/apps/meteor/package.json b/apps/meteor/package.json index 5a831d83b9cae..67b9fd00b0eb7 100644 --- a/apps/meteor/package.json +++ b/apps/meteor/package.json @@ -1,6 +1,6 @@ { "name": "@rocket.chat/meteor", - "version": "8.6.0-rc.0", + "version": "8.7.0-develop", "private": true, "description": "The Ultimate Open Source WebChat Platform", "keywords": [ diff --git a/package.json b/package.json index ce4e5bb9b6bcf..da1754c52091c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rocket.chat", - "version": "8.6.0-rc.0", + "version": "8.7.0-develop", "private": true, "description": "Rocket.Chat Monorepo", "homepage": "https://github.com/RocketChat/Rocket.Chat#readme", diff --git a/packages/core-typings/package.json b/packages/core-typings/package.json index f03490e10a7b3..2529d8c3a9cf9 100644 --- a/packages/core-typings/package.json +++ b/packages/core-typings/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package", "name": "@rocket.chat/core-typings", - "version": "8.6.0-rc.0", + "version": "8.7.0-develop", "main": "./dist/index.js", "typings": "./dist/index.d.ts", "files": [ diff --git a/packages/rest-typings/package.json b/packages/rest-typings/package.json index b62e4f2c5f927..eba1a729124cf 100644 --- a/packages/rest-typings/package.json +++ b/packages/rest-typings/package.json @@ -1,6 +1,6 @@ { "name": "@rocket.chat/rest-typings", - "version": "8.6.0-rc.0", + "version": "8.7.0-develop", "main": "./dist/index.js", "typings": "./dist/index.d.ts", "files": [ From 4fb271ead90ecd0d8d230a47172eea91e44715d1 Mon Sep 17 00:00:00 2001 From: Tasso Evangelista Date: Tue, 23 Jun 2026 10:49:05 -0300 Subject: [PATCH 004/220] test(e2e): work around E2E test instabilities (#41005) --- apps/meteor/tests/e2e/message-composer.spec.ts | 2 ++ apps/meteor/tests/e2e/page-objects/fragments/composer.ts | 4 ++++ apps/meteor/tests/e2e/page-objects/fragments/sidebar.ts | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/meteor/tests/e2e/message-composer.spec.ts b/apps/meteor/tests/e2e/message-composer.spec.ts index 7af3095ed04e4..1660ea45f1b86 100644 --- a/apps/meteor/tests/e2e/message-composer.spec.ts +++ b/apps/meteor/tests/e2e/message-composer.spec.ts @@ -57,6 +57,8 @@ test.describe.serial('message-composer', () => { await page.keyboard.press('Control+A'); // on Windows and Linux await page.keyboard.press('Meta+A'); // on macOS await poHomeChannel.composer.btnLinkFormatter.click(); + // It takes a while for the modal to be visible and ready to receive input, so we need to wait for it before typing the url + await poHomeChannel.composer.addLinkModal.waitFor(); await page.keyboard.type(url); await page.keyboard.press('Enter'); diff --git a/apps/meteor/tests/e2e/page-objects/fragments/composer.ts b/apps/meteor/tests/e2e/page-objects/fragments/composer.ts index 7f628d1cdb0bf..5dbe783f339fa 100644 --- a/apps/meteor/tests/e2e/page-objects/fragments/composer.ts +++ b/apps/meteor/tests/e2e/page-objects/fragments/composer.ts @@ -118,6 +118,10 @@ export abstract class Composer { get typingIndicator(): Locator { return this.root.getByRole('status').getByText(/typing/i); } + + get addLinkModal(): Locator { + return this.root.page().getByRole('dialog', { name: 'Add link' }); + } } export class RoomComposer extends Composer { diff --git a/apps/meteor/tests/e2e/page-objects/fragments/sidebar.ts b/apps/meteor/tests/e2e/page-objects/fragments/sidebar.ts index 955d05396a737..45aac6b0bdc1c 100644 --- a/apps/meteor/tests/e2e/page-objects/fragments/sidebar.ts +++ b/apps/meteor/tests/e2e/page-objects/fragments/sidebar.ts @@ -94,7 +94,7 @@ export class RoomSidebar extends Sidebar { } getCollapseGroupByName(name: string): Locator { - return this.channelsList.getByRole('button').filter({ has: this.page.getByRole('heading', { name, exact: true }) }); + return this.root.getByRole('button').filter({ has: this.page.getByRole('heading', { name, exact: true }) }); } getItemUnreadBadge(item: Locator): Locator { From e626fb970b2d7179a84c8bd83c57d5d490f2496b Mon Sep 17 00:00:00 2001 From: Pierre Lehnen <55164754+pierre-lehnen-rc@users.noreply.github.com> Date: Tue, 23 Jun 2026 11:17:12 -0300 Subject: [PATCH 005/220] fix: voice call fails if user navigates during initial connection (#41044) --- .changeset/tricky-comics-wink.md | 5 ++ packages/media-signaling/src/lib/Session.ts | 3 +- .../src/lib/utils/isSameDeviceId.ts | 71 +++++++++++++++++++ 3 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 .changeset/tricky-comics-wink.md create mode 100644 packages/media-signaling/src/lib/utils/isSameDeviceId.ts diff --git a/.changeset/tricky-comics-wink.md b/.changeset/tricky-comics-wink.md new file mode 100644 index 0000000000000..2e78e5adb6856 --- /dev/null +++ b/.changeset/tricky-comics-wink.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/media-signaling': patch +--- + +Fixes an issue where voice calls could fail if the user navigated between rooms during the initial connection diff --git a/packages/media-signaling/src/lib/Session.ts b/packages/media-signaling/src/lib/Session.ts index 20c4eecda73bc..848f29b12989b 100644 --- a/packages/media-signaling/src/lib/Session.ts +++ b/packages/media-signaling/src/lib/Session.ts @@ -16,6 +16,7 @@ import type { import type { IClientMediaCall, CallActorType, CallContact, CallFeature, AnyMediaCallData } from '../definition/call'; import type { IMediaSignalLogger } from '../definition/logger'; import { SessionRegistration } from './components/SessionRegistration'; +import { isSameDeviceId } from './utils/isSameDeviceId'; export type MediaSignalingEvents = { sessionStateChange: void; @@ -249,7 +250,7 @@ export class MediaSignalingSession extends Emitter { // 1. doesn't have any input track yet // 2. it's the same device id // 3. has no restriction on which device to use - if (!this.inputTrack || deviceId === this.currentDeviceId || !deviceId) { + if (!this.inputTrack || !deviceId || isSameDeviceId(deviceId, this.currentDeviceId)) { return; } diff --git a/packages/media-signaling/src/lib/utils/isSameDeviceId.ts b/packages/media-signaling/src/lib/utils/isSameDeviceId.ts new file mode 100644 index 0000000000000..ff2ed72751ed4 --- /dev/null +++ b/packages/media-signaling/src/lib/utils/isSameDeviceId.ts @@ -0,0 +1,71 @@ +function ensureStringArray(value: string | string[] | undefined): string[] { + if (!value) { + return []; + } + + if (typeof value === 'string') { + return [value]; + } + + if (Array.isArray(value)) { + return value; + } + + return []; +} + +function normalizeDeviceId(deviceId: ConstrainDOMString | null): { exact: string[]; ideal: string[] } { + if (!deviceId) { + return { + exact: [], + ideal: [], + }; + } + + if (typeof deviceId === 'object' && !Array.isArray(deviceId)) { + return { + exact: ensureStringArray(deviceId.exact), + ideal: ensureStringArray(deviceId.ideal), + }; + } + + return { + exact: [], + ideal: ensureStringArray(deviceId), + }; +} + +function isSameStringArray(array1: string[], array2: string[]): boolean { + const uniqueArray1 = [...new Set(array1)]; + const uniqueArray2 = [...new Set(array2)]; + + if (uniqueArray1.length !== uniqueArray2.length) { + return false; + } + + for (const value of uniqueArray1) { + if (!uniqueArray2.includes(value)) { + return false; + } + } + + return true; +} + +export function isSameDeviceId(deviceId1: ConstrainDOMString | null, deviceId2: ConstrainDOMString | null): boolean { + if (deviceId1 === deviceId2 || (!deviceId1 && !deviceId2)) { + return true; + } + + const normalizedDeviceId1 = normalizeDeviceId(deviceId1); + const normalizedDeviceId2 = normalizeDeviceId(deviceId2); + + if (!isSameStringArray(normalizedDeviceId1.exact, normalizedDeviceId2.exact)) { + return false; + } + if (!isSameStringArray(normalizedDeviceId1.ideal, normalizedDeviceId2.ideal)) { + return false; + } + + return true; +} From 5620611b55aeae9f98455282ed822b8014ea01e4 Mon Sep 17 00:00:00 2001 From: dougfabris Date: Tue, 23 Jun 2026 18:18:09 -0300 Subject: [PATCH 006/220] chore: Change navbar's search input icon size (#41042) --- apps/meteor/client/navbar/NavBarSearch/NavBarSearch.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/meteor/client/navbar/NavBarSearch/NavBarSearch.tsx b/apps/meteor/client/navbar/NavBarSearch/NavBarSearch.tsx index 82dcfecf2af41..ee02143e82672 100644 --- a/apps/meteor/client/navbar/NavBarSearch/NavBarSearch.tsx +++ b/apps/meteor/client/navbar/NavBarSearch/NavBarSearch.tsx @@ -93,7 +93,7 @@ const NavBarSearch = () => { isDirty ? ( ) : ( - + ) } /> From 80cddeb093572dca6540f9db64e54b536ddf566e Mon Sep 17 00:00:00 2001 From: Julio Araujo Date: Wed, 24 Jun 2026 15:47:04 +0200 Subject: [PATCH 007/220] chore(deps): bump ajv (#41049) --- apps/meteor/ee/server/services/package.json | 2 +- apps/meteor/package.json | 2 +- package.json | 6 +++ packages/http-router/package.json | 2 +- packages/livechat/package.json | 2 +- packages/media-signaling/package.json | 2 +- packages/rest-typings/package.json | 2 +- yarn.lock | 46 +++++---------------- 8 files changed, 23 insertions(+), 41 deletions(-) diff --git a/apps/meteor/ee/server/services/package.json b/apps/meteor/ee/server/services/package.json index 0e17d8f473a98..3b753e05c9e4a 100644 --- a/apps/meteor/ee/server/services/package.json +++ b/apps/meteor/ee/server/services/package.json @@ -27,7 +27,7 @@ "@rocket.chat/rest-typings": "workspace:^", "@rocket.chat/string-helpers": "~0.32.0", "@rocket.chat/ui-kit": "workspace:~", - "ajv": "^8.17.1", + "ajv": "^8.20.0", "bcrypt": "^6.0.0", "body-parser": "^1.20.4", "colorette": "^2.0.20", diff --git a/apps/meteor/package.json b/apps/meteor/package.json index 67b9fd00b0eb7..0ba981ae2952f 100644 --- a/apps/meteor/package.json +++ b/apps/meteor/package.json @@ -166,7 +166,7 @@ "@types/meteor": "^2.9.11", "@xmldom/xmldom": "~0.8.13", "adm-zip": "0.5.17", - "ajv": "^8.17.1", + "ajv": "^8.20.0", "ajv-formats": "~3.0.1", "archiver": "^7.0.1", "asterisk-manager": "^0.2.0", diff --git a/package.json b/package.json index da1754c52091c..e35116a9b2e36 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,12 @@ "cross-spawn": "7.0.6", "drachtio-srf": "patch:drachtio-srf@npm%3A5.0.12#~/.yarn/patches/drachtio-srf-npm-5.0.12-b0b1afaad6.patch", "ajv/fast-uri": "3.1.2", + "ajv@npm:^6.12.4": "6.15.0", + "ajv@npm:^6.12.5": "6.15.0", + "ajv@npm:^6.14.0": "6.15.0", + "ajv@npm:^8.0.0": "8.20.0", + "ajv@npm:^8.0.1": "8.20.0", + "ajv@npm:^8.9.0": "8.20.0", "fast-xml-parser@npm:5.3.6": "^5.5.7", "fast-xml-parser/fast-xml-builder": "^1.1.9", "is-svg/fast-xml-parser": "5.5.11", diff --git a/packages/http-router/package.json b/packages/http-router/package.json index 11288b6c09740..a235273c280dd 100644 --- a/packages/http-router/package.json +++ b/packages/http-router/package.json @@ -20,7 +20,7 @@ "@rocket.chat/core-typings": "workspace:^", "@rocket.chat/logger": "workspace:^", "@rocket.chat/rest-typings": "workspace:^", - "ajv": "^8.17.1", + "ajv": "^8.20.0", "express": "^4.21.2", "hono": "4.12.25", "qs": "^6.15.2" diff --git a/packages/livechat/package.json b/packages/livechat/package.json index 7765b926ed2a7..68b12fb7292da 100644 --- a/packages/livechat/package.json +++ b/packages/livechat/package.json @@ -33,7 +33,7 @@ "@rocket.chat/message-parser": "workspace:^", "@rocket.chat/random": "workspace:~", "@rocket.chat/ui-kit": "workspace:~", - "ajv": "^8.17.1", + "ajv": "^8.20.0", "ajv-formats": "^3.0.1", "css-vars-ponyfill": "^2.4.9", "date-fns": "~4.1.0", diff --git a/packages/media-signaling/package.json b/packages/media-signaling/package.json index b055bec3b6ed4..2b95e5496f350 100644 --- a/packages/media-signaling/package.json +++ b/packages/media-signaling/package.json @@ -30,7 +30,7 @@ }, "dependencies": { "@rocket.chat/emitter": "^0.32.0", - "ajv": "^8.17.1" + "ajv": "^8.20.0" }, "devDependencies": { "@rocket.chat/jest-presets": "workspace:~", diff --git a/packages/rest-typings/package.json b/packages/rest-typings/package.json index eba1a729124cf..4d0c63742fbc8 100644 --- a/packages/rest-typings/package.json +++ b/packages/rest-typings/package.json @@ -17,7 +17,7 @@ "@rocket.chat/core-typings": "workspace:^", "@rocket.chat/message-parser": "workspace:^", "@rocket.chat/ui-kit": "workspace:~", - "ajv": "^8.17.1", + "ajv": "^8.20.0", "ajv-formats": "^3.0.1" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index a403cb9783e68..451641c925bf6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9552,7 +9552,7 @@ __metadata: "@types/express": "npm:^4.17.25" "@types/jest": "npm:~30.0.0" "@types/supertest": "npm:~6.0.3" - ajv: "npm:^8.17.1" + ajv: "npm:^8.20.0" eslint: "npm:~9.39.4" express: "npm:^4.21.2" hono: "npm:4.12.25" @@ -9700,7 +9700,7 @@ __metadata: "@types/react": "npm:~18.3.28" "@types/webpack-env": "npm:~1.18.8" "@types/whatwg-fetch": "npm:~0.0.33" - ajv: "npm:^8.17.1" + ajv: "npm:^8.20.0" ajv-formats: "npm:^3.0.1" autoprefixer: "npm:^9.8.8" babel-loader: "npm:~10.0.0" @@ -9822,7 +9822,7 @@ __metadata: "@rocket.chat/jest-presets": "workspace:~" "@rocket.chat/tsconfig": "workspace:*" "@types/jest": "npm:~30.0.0" - ajv: "npm:^8.17.1" + ajv: "npm:^8.20.0" eslint: "npm:~9.39.4" jest: "npm:~30.2.0" typescript: "npm:~5.9.3" @@ -10072,7 +10072,7 @@ __metadata: "@types/xml-encryption": "npm:~1.2.4" "@xmldom/xmldom": "npm:~0.8.13" adm-zip: "npm:0.5.17" - ajv: "npm:^8.17.1" + ajv: "npm:^8.20.0" ajv-formats: "npm:~3.0.1" archiver: "npm:^7.0.1" asterisk-manager: "npm:^0.2.0" @@ -10759,7 +10759,7 @@ __metadata: "@rocket.chat/message-parser": "workspace:^" "@rocket.chat/ui-kit": "workspace:~" "@types/jest": "npm:~30.0.0" - ajv: "npm:^8.17.1" + ajv: "npm:^8.20.0" ajv-formats: "npm:^3.0.1" eslint: "npm:~9.39.4" mongodb: "npm:6.16.0" @@ -16004,43 +16004,19 @@ __metadata: languageName: node linkType: hard -"ajv@npm:^6.12.4, ajv@npm:^6.12.5": - version: 6.12.6 - resolution: "ajv@npm:6.12.6" +"ajv@npm:6.15.0": + version: 6.15.0 + resolution: "ajv@npm:6.15.0" dependencies: fast-deep-equal: "npm:^3.1.1" fast-json-stable-stringify: "npm:^2.0.0" json-schema-traverse: "npm:^0.4.1" uri-js: "npm:^4.2.2" - checksum: 10/48d6ad21138d12eb4d16d878d630079a2bda25a04e745c07846a4ad768319533031e28872a9b3c5790fa1ec41aabdf2abed30a56e5a03ebc2cf92184b8ee306c + checksum: 10/0916dda09c152fb5857bc1cc7ce61718e9cec5b7faeff44a74f5e324eed8a556e1a84856724ea322a067b436ecad9f74ac8295fd395449788cca52f0c25bd5fb languageName: node linkType: hard -"ajv@npm:^6.14.0": - version: 6.14.0 - resolution: "ajv@npm:6.14.0" - dependencies: - fast-deep-equal: "npm:^3.1.1" - fast-json-stable-stringify: "npm:^2.0.0" - json-schema-traverse: "npm:^0.4.1" - uri-js: "npm:^4.2.2" - checksum: 10/c71f14dd2b6f2535d043f74019c8169f7aeb1106bafbb741af96f34fdbf932255c919ddd46344043d03b62ea0ccb319f83667ec5eedf612393f29054fe5ce4a5 - languageName: node - linkType: hard - -"ajv@npm:^8.0.0, ajv@npm:^8.0.1, ajv@npm:^8.17.1, ajv@npm:^8.9.0": - version: 8.17.1 - resolution: "ajv@npm:8.17.1" - dependencies: - fast-deep-equal: "npm:^3.1.3" - fast-uri: "npm:^3.0.1" - json-schema-traverse: "npm:^1.0.0" - require-from-string: "npm:^2.0.2" - checksum: 10/ee3c62162c953e91986c838f004132b6a253d700f1e51253b99791e2dbfdb39161bc950ebdc2f156f8568035bb5ed8be7bd78289cd9ecbf3381fe8f5b82e3f33 - languageName: node - linkType: hard - -"ajv@npm:^8.18.0": +"ajv@npm:8.20.0, ajv@npm:^8.18.0, ajv@npm:^8.20.0": version: 8.20.0 resolution: "ajv@npm:8.20.0" dependencies: @@ -33058,7 +33034,7 @@ __metadata: "@types/fibers": "npm:^3.1.4" "@types/node": "npm:~22.19.17" "@types/ws": "npm:^8.18.1" - ajv: "npm:^8.17.1" + ajv: "npm:^8.20.0" bcrypt: "npm:^6.0.0" body-parser: "npm:^1.20.4" colorette: "npm:^2.0.20" From 2e8ea322b83f2382c1efe8439c078240b700eb73 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 Jun 2026 11:23:35 -0300 Subject: [PATCH 008/220] chore(deps): bump rharkor/caching-for-turbo from 2.4.2 to 2.5.0 (#41064) --- .github/workflows/ci-code-check.yml | 2 +- .github/workflows/ci-deploy-gh-pages.yml | 2 +- .github/workflows/ci-test-e2e.yml | 2 +- .github/workflows/ci-test-storybook.yml | 2 +- .github/workflows/ci-test-unit.yml | 2 +- .github/workflows/ci.yml | 4 ++-- .github/workflows/new-release.yml | 2 +- .github/workflows/pr-update-description.yml | 2 +- .github/workflows/publish-release.yml | 2 +- .github/workflows/release-candidate.yml | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci-code-check.yml b/.github/workflows/ci-code-check.yml index 21ff95c641948..a7e426728a213 100644 --- a/.github/workflows/ci-code-check.yml +++ b/.github/workflows/ci-code-check.yml @@ -41,7 +41,7 @@ jobs: install: true NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - uses: rharkor/caching-for-turbo@5d14fba18e450c09393333cfd4242e8b3cb455a6 # v2.4.2 + - uses: rharkor/caching-for-turbo@75f8ebf4a43d2c60b23bc2a27082cfea94ffdad9 # v2.5.0 - uses: ./.github/actions/restore-packages diff --git a/.github/workflows/ci-deploy-gh-pages.yml b/.github/workflows/ci-deploy-gh-pages.yml index e1b8b81517da6..fa0eff968d12a 100644 --- a/.github/workflows/ci-deploy-gh-pages.yml +++ b/.github/workflows/ci-deploy-gh-pages.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-24.04-arm steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - uses: rharkor/caching-for-turbo@5d14fba18e450c09393333cfd4242e8b3cb455a6 # v2.4.2 + - uses: rharkor/caching-for-turbo@75f8ebf4a43d2c60b23bc2a27082cfea94ffdad9 # v2.5.0 - name: Setup NodeJS uses: ./.github/actions/setup-node diff --git a/.github/workflows/ci-test-e2e.yml b/.github/workflows/ci-test-e2e.yml index c8421db957b60..e7993ea4d542e 100644 --- a/.github/workflows/ci-test-e2e.yml +++ b/.github/workflows/ci-test-e2e.yml @@ -125,7 +125,7 @@ jobs: install: true NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - uses: rharkor/caching-for-turbo@5d14fba18e450c09393333cfd4242e8b3cb455a6 # v2.4.2 + - uses: rharkor/caching-for-turbo@75f8ebf4a43d2c60b23bc2a27082cfea94ffdad9 # v2.5.0 - uses: ./.github/actions/restore-packages diff --git a/.github/workflows/ci-test-storybook.yml b/.github/workflows/ci-test-storybook.yml index 9c7732f88a48d..da296d4583fec 100644 --- a/.github/workflows/ci-test-storybook.yml +++ b/.github/workflows/ci-test-storybook.yml @@ -37,7 +37,7 @@ jobs: install: true NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - uses: rharkor/caching-for-turbo@5d14fba18e450c09393333cfd4242e8b3cb455a6 # v2.4.2 + - uses: rharkor/caching-for-turbo@75f8ebf4a43d2c60b23bc2a27082cfea94ffdad9 # v2.5.0 - uses: ./.github/actions/restore-packages diff --git a/.github/workflows/ci-test-unit.yml b/.github/workflows/ci-test-unit.yml index a13e1fe4834cd..7da2910b09c52 100644 --- a/.github/workflows/ci-test-unit.yml +++ b/.github/workflows/ci-test-unit.yml @@ -41,7 +41,7 @@ jobs: install: true NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - uses: rharkor/caching-for-turbo@5d14fba18e450c09393333cfd4242e8b3cb455a6 # v2.4.2 + - uses: rharkor/caching-for-turbo@75f8ebf4a43d2c60b23bc2a27082cfea94ffdad9 # v2.5.0 - uses: ./.github/actions/restore-packages diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fc3349487c58a..ab4cbe89c606d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -246,7 +246,7 @@ jobs: restore-keys: | vite-local-cache-${{ runner.arch }}-${{ runner.os }}- - - uses: rharkor/caching-for-turbo@5d14fba18e450c09393333cfd4242e8b3cb455a6 # v2.4.2 + - uses: rharkor/caching-for-turbo@75f8ebf4a43d2c60b23bc2a27082cfea94ffdad9 # v2.5.0 if: steps.packages-cache-build.outputs.cache-hit != 'true' - name: Build Rocket.Chat Packages @@ -695,7 +695,7 @@ jobs: cache-modules: true install: true - - uses: rharkor/caching-for-turbo@5d14fba18e450c09393333cfd4242e8b3cb455a6 # v2.4.2 + - uses: rharkor/caching-for-turbo@75f8ebf4a43d2c60b23bc2a27082cfea94ffdad9 # v2.5.0 - name: Restore turbo build uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 diff --git a/.github/workflows/new-release.yml b/.github/workflows/new-release.yml index 415e37e3c8f57..14b062a3922d7 100644 --- a/.github/workflows/new-release.yml +++ b/.github/workflows/new-release.yml @@ -38,7 +38,7 @@ jobs: install: true NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - uses: rharkor/caching-for-turbo@5d14fba18e450c09393333cfd4242e8b3cb455a6 # v2.4.2 + - uses: rharkor/caching-for-turbo@75f8ebf4a43d2c60b23bc2a27082cfea94ffdad9 # v2.5.0 - name: Build packages run: yarn build diff --git a/.github/workflows/pr-update-description.yml b/.github/workflows/pr-update-description.yml index 58fa2d371e213..edd1451665c79 100644 --- a/.github/workflows/pr-update-description.yml +++ b/.github/workflows/pr-update-description.yml @@ -25,7 +25,7 @@ jobs: install: true NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - uses: rharkor/caching-for-turbo@5d14fba18e450c09393333cfd4242e8b3cb455a6 # v2.4.2 + - uses: rharkor/caching-for-turbo@75f8ebf4a43d2c60b23bc2a27082cfea94ffdad9 # v2.5.0 - name: Build packages run: yarn build diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 7be1cf06211f2..8f35066873ea7 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -28,7 +28,7 @@ jobs: install: true NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - uses: rharkor/caching-for-turbo@5d14fba18e450c09393333cfd4242e8b3cb455a6 # v2.4.2 + - uses: rharkor/caching-for-turbo@75f8ebf4a43d2c60b23bc2a27082cfea94ffdad9 # v2.5.0 - name: Build packages run: yarn build diff --git a/.github/workflows/release-candidate.yml b/.github/workflows/release-candidate.yml index a956df9f1f018..5f915934fcbba 100644 --- a/.github/workflows/release-candidate.yml +++ b/.github/workflows/release-candidate.yml @@ -19,7 +19,7 @@ jobs: install: true NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - uses: rharkor/caching-for-turbo@5d14fba18e450c09393333cfd4242e8b3cb455a6 # v2.4.2 + - uses: rharkor/caching-for-turbo@75f8ebf4a43d2c60b23bc2a27082cfea94ffdad9 # v2.5.0 - name: Build packages run: yarn build From 0433f003d2bbe74fbbf4970d756df86ca44ac055 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Wed, 24 Jun 2026 12:24:27 -0300 Subject: [PATCH 009/220] feat(desktop): push user roles to the desktop app (#41056) --- .changeset/desktop-set-user-roles.md | 6 +++++ apps/meteor/client/views/root/AppLayout.tsx | 2 ++ .../views/root/hooks/useDesktopUserRoles.ts | 23 +++++++++++++++++++ packages/desktop-api/src/index.ts | 1 + 4 files changed, 32 insertions(+) create mode 100644 .changeset/desktop-set-user-roles.md create mode 100644 apps/meteor/client/views/root/hooks/useDesktopUserRoles.ts diff --git a/.changeset/desktop-set-user-roles.md b/.changeset/desktop-set-user-roles.md new file mode 100644 index 0000000000000..369f18c00b4de --- /dev/null +++ b/.changeset/desktop-set-user-roles.md @@ -0,0 +1,6 @@ +--- +'@rocket.chat/desktop-api': minor +'@rocket.chat/meteor': patch +--- + +Added a `setUserRoles` bridge method to the desktop API and pushed the logged-in user's roles to the desktop app. This lets the desktop client restrict supportedVersions messages (such as version-expiration warnings) to specific roles like admins, instead of showing them to every user. The push is reactive to role changes; desktop builds without the bridge method fall back to their own role lookup. diff --git a/apps/meteor/client/views/root/AppLayout.tsx b/apps/meteor/client/views/root/AppLayout.tsx index b355d9c7b44f2..108254199ae0d 100644 --- a/apps/meteor/client/views/root/AppLayout.tsx +++ b/apps/meteor/client/views/root/AppLayout.tsx @@ -18,6 +18,7 @@ import { useCodeHighlight } from './hooks/useCodeHighlight'; import { useCorsSSLConfig } from './hooks/useCorsSSLConfig'; import { useDesktopFavicon } from './hooks/useDesktopFavicon'; import { useDesktopTitle } from './hooks/useDesktopTitle'; +import { useDesktopUserRoles } from './hooks/useDesktopUserRoles'; import { useEmojiOne } from './hooks/useEmojiOne'; import { useEscapeKeyStroke } from './hooks/useEscapeKeyStroke'; import { useGoogleTagManager } from './hooks/useGoogleTagManager'; @@ -73,6 +74,7 @@ const AppLayout = () => { useLoadMissedMessages(); useDesktopFavicon(); useDesktopTitle(); + useDesktopUserRoles(); useStartupEvent(); useIframeCommands(); diff --git a/apps/meteor/client/views/root/hooks/useDesktopUserRoles.ts b/apps/meteor/client/views/root/hooks/useDesktopUserRoles.ts new file mode 100644 index 0000000000000..5b58578ede81c --- /dev/null +++ b/apps/meteor/client/views/root/hooks/useDesktopUserRoles.ts @@ -0,0 +1,23 @@ +import { useUser } from '@rocket.chat/ui-contexts'; +import { useEffect } from 'react'; + +/** + * Pushes the logged-in user's roles to the desktop app so it can decide which + * supportedVersions messages to show (e.g. restricting version-expiration + * warnings to admins). The desktop app falls back to its own role lookup when + * this bridge is unavailable, so `setUserRoles` is called optionally. + */ +export const useDesktopUserRoles = () => { + // A single canonical value derived from the reactive user. Logout, login and + // account switch all surface as a change to this key, so the effect re-runs + // and re-pushes only when the roles actually change — no userId branch and no + // effect cleanup (which would fire on every deps change and flicker + // role-targeted UI). Logged-out and "logged in with no roles" both resolve to + // an empty list, which is the correct signal for the desktop either way. + const rolesKey = (useUser()?.roles ?? []).join(','); + + useEffect(() => { + if (typeof window === 'undefined') return; + window.RocketChatDesktop?.setUserRoles?.(rolesKey ? rolesKey.split(',') : []); + }, [rolesKey]); +}; diff --git a/packages/desktop-api/src/index.ts b/packages/desktop-api/src/index.ts index 2d7b18c5cabb9..04b1b6491103a 100644 --- a/packages/desktop-api/src/index.ts +++ b/packages/desktop-api/src/index.ts @@ -38,6 +38,7 @@ export interface IRocketChatDesktop { setSidebarCustomTheme: (customTheme: string) => void; setTitle: (title: string) => void; setUserLoggedIn: (userLoggedIn: boolean) => void; + setUserRoles: (roles: string[]) => void; setUserPresenceDetection: (options: { isAutoAwayEnabled: boolean; idleThreshold: number | null; From 3d0aa3899714209ced0f4ea8be13f205544c1fd2 Mon Sep 17 00:00:00 2001 From: Pierre Lehnen <55164754+pierre-lehnen-rc@users.noreply.github.com> Date: Wed, 24 Jun 2026 18:13:46 -0300 Subject: [PATCH 010/220] chore: improve voip enums definitions (#41045) --- .../src/definition/call/IClientMediaCall.ts | 105 ++++++++++-------- .../media-signaling/src/definition/client.ts | 44 ++++---- .../media-signaling/src/definition/index.ts | 2 +- .../src/definition/signals/client/hangup.ts | 22 +--- .../definition/signals/client/local-state.ts | 21 +--- 5 files changed, 92 insertions(+), 102 deletions(-) diff --git a/packages/media-signaling/src/definition/call/IClientMediaCall.ts b/packages/media-signaling/src/definition/call/IClientMediaCall.ts index 599015597e439..f56136139725d 100644 --- a/packages/media-signaling/src/definition/call/IClientMediaCall.ts +++ b/packages/media-signaling/src/definition/call/IClientMediaCall.ts @@ -14,34 +14,39 @@ export const callFeatureList = ['audio', 'screen-share', 'transfer', 'hold'] as export type CallFeature = (typeof callFeatureList)[number]; -export type CallState = - | 'none' // trying to call with no idea if it'll reach anyone - | 'ringing' // call has been acknoledged by the callee's agent, but no response about them accepting it or not - | 'accepted' // call has been accepted and the webrtc offer is being exchanged - | 'active' // webrtc connection has been established - | 'renegotiating' // a webrtc connection had been established before, but a new one is being negotiated - | 'hangup'; // call is over - -// Changes to this list must be reflected on the enum for clientMediaSignalHangupSchema too -export type CallHangupReason = - | 'normal' // User explicitly hanged up - | 'remote' // The client was told the call is over - | 'rejected' // The callee rejected the call - | 'unavailable' // The actor is not available - | 'transfer' // one of the users requested the other be transferred to someone else - | 'not-answered' // max ringing duration was reached with no answer from the other user - | 'timeout-local-track' // Timeout waiting for the local audio track - | 'timeout-remote-sdp' // Timeout waiting for the remote SDP - | 'timeout-local-sdp' // Timeout while generating the local SDP + waiting for ICE Gathering - | 'timeout-activation' // Timeout connecting to the negotiated session - | 'timeout' // The call state hasn't progressed for too long - | 'signaling-error' // Hanging up because of an error during the signal processing - | 'service-error' // Hanging up because of an error setting up the service connection - | 'media-error' // Hanging up because of an error setting up the media connection - | 'input-error' // Something wrong with the audio input track on the client - | 'error' // Hanging up because of an unidentified error - | 'unknown' // One of the call's signed users reported they don't know this call - | 'another-client'; // One of the call's users requested a hangup from a different client session than the one where the call is happening +export const callStateList = [ + 'none', // trying to call with no idea if it'll reach anyone + 'ringing', // call has been acknoledged by the callee's agent, but no response about them accepting it or not + 'accepted', // call has been accepted and the webrtc offer is being exchanged + 'active', // webrtc connection has been established + 'renegotiating', // a webrtc connection had been established before, but a new one is being negotiated + 'hangup', // call is over +] as const; + +export type CallState = (typeof callStateList)[number]; + +export const callHangupReasonList = [ + 'normal', // User explicitly hanged up + 'remote', // The client was told the call is over + 'rejected', // The callee rejected the call + 'unavailable', // The actor is not available + 'transfer', // one of the users requested the other be transferred to someone else + 'not-answered', // max ringing duration was reached with no answer from the other user + 'timeout-local-track', // Timeout waiting for the local audio track + 'timeout-remote-sdp', // Timeout waiting for the remote SDP + 'timeout-local-sdp', // Timeout while generating the local SDP + waiting for ICE Gathering + 'timeout-activation', // Timeout connecting to the negotiated session + 'timeout', // The call state hasn't progressed for too long + 'signaling-error', // Hanging up because of an error during the signal processing + 'service-error', // Hanging up because of an error setting up the service connection + 'media-error', // Hanging up because of an error setting up the media connection + 'input-error', // Something wrong with the audio input track on the client + 'error', // Hanging up because of an unidentified error + 'unknown', // One of the call's signed users reported they don't know this call + 'another-client', // One of the call's users requested a hangup from a different client session than the one where the call is happening +] as const; + +export type CallHangupReason = (typeof callHangupReasonList)[number]; export const callAnswerList = [ 'accept', // actor accepts the call @@ -52,24 +57,32 @@ export const callAnswerList = [ export type CallAnswer = (typeof callAnswerList)[number]; -export type CallNotification = - | 'accepted' // notify that the call has been accepted by both actors - | 'active' // notify that call activity was confirmed - | 'hangup' // notify that the call is over; - | 'trying'; // notify that the other client is connecting but still need more time - -export type CallRejectedReason = - | 'invalid-call-id' // the call id can't be used for a new call - | 'invalid-contract-id' // this specific contract can't request this call - | 'existing-call-id' // the call already exists with a different callee or contract - | 'already-requested' // the request is valid, but a call matching its params is already underway - | 'unsupported' // no matching supported services between actors - | 'unavailable' // the callee is unavailable - | 'busy' // the actor who requested the call is supposedly busy - | 'invalid-call-params' // something is wrong with the params (eg. no valid route between caller and callee) - | 'forbidden'; // one of the actors on the call doesn't have permission for it - -export type CallFlag = 'internal' | 'create-data-channel'; +export const callNotificationList = [ + 'accepted', // notify that the call has been accepted by both actors + 'active', // notify that call activity was confirmed + 'hangup', // notify that the call is over; + 'trying', // notify that the other client is connecting but still need more time +] as const; + +export type CallNotification = (typeof callNotificationList)[number]; + +export const callRejectedReasonList = [ + 'invalid-call-id', // the call id can't be used for a new call + 'invalid-contract-id', // this specific contract can't request this call + 'existing-call-id', // the call already exists with a different callee or contract + 'already-requested', // the request is valid, but a call matching its params is already underway + 'unsupported', // no matching supported services between actors + 'unavailable', // the callee is unavailable + 'busy', // the actor who requested the call is supposedly busy + 'invalid-call-params', // something is wrong with the params (eg. no valid route between caller and callee) + 'forbidden', // one of the actors on the call doesn't have permission for it +] as const; + +export type CallRejectedReason = (typeof callRejectedReasonList)[number]; + +export const callFlagList = ['internal', 'create-data-channel']; + +export type CallFlag = (typeof callFlagList)[number]; export interface IClientMediaCall { callId: string; diff --git a/packages/media-signaling/src/definition/client.ts b/packages/media-signaling/src/definition/client.ts index 4ce3d11ca167e..5a6f0b9c1820e 100644 --- a/packages/media-signaling/src/definition/client.ts +++ b/packages/media-signaling/src/definition/client.ts @@ -1,22 +1,28 @@ -export type ClientState = - | 'none' // The client doesn't recognize a specific call id at all - | 'pending' // The call is ringing - | 'accepting' // The client tried to accept the call and is wating for confirmation from the server - | 'waiting-for-track' // The call was accepted, but the client doesn't have a local audio stream yet - | 'waiting-for-offer' // The call was accepted, but the client doesn't have a webrtc offer yet - | 'waiting-for-answer' // The call was accepted and an offer was already sent, but the client doesn't have an answer yet - | 'generating-local-sdp' // The client is generating its first local sdp (offer/answer) - | 'activating' // The WebRTC signaling has reached the stable state, but the connection is not yet active - | 'busy-elsewhere' // The call is happening in a different session/client - | 'active' // The webrtc call was established - | 'renegotiating' // the webrtc call was established but the client is starting a new negotiation - | 'hangup'; // The call is over, or happening in some other client +export const clientStateList = [ + 'none', // The client doesn't recognize a specific call id at all + 'pending', // The call is ringing + 'accepting', // The client tried to accept the call and is wating for confirmation from the server + 'waiting-for-track', // The call was accepted, but the client doesn't have a local audio stream yet + 'waiting-for-offer', // The call was accepted, but the client doesn't have a webrtc offer yet + 'waiting-for-answer', // The call was accepted and an offer was already sent, but the client doesn't have an answer yet + 'generating-local-sdp', // The client is generating its first local sdp (offer/answer) + 'activating', // The WebRTC signaling has reached the stable state, but the connection is not yet active + 'busy-elsewhere', // The call is happening in a different session/client + 'active', // The webrtc call was established + 'renegotiating', // the webrtc call was established but the client is starting a new negotiation + 'hangup', // The call is over, or happening in some other client +] as const; -export type ClientContractState = - | 'proposed' // we don't know if the contract will be signed - | 'signed' // the server signed this session's contract - | 'pre-signed' // the session that requested a call is assuming it will be signed into it - | 'self-signed' // the call has progressed beyond the signing stage without any signature confirmation - | 'ignored'; // the server signed a contract from a different session +export type ClientState = (typeof clientStateList)[number]; + +export const clientContractStateList = [ + 'proposed', // we don't know if the contract will be signed + 'signed', // the server signed this session's contract + 'pre-signed', // the session that requested a call is assuming it will be signed into it + 'self-signed', // the call has progressed beyond the signing stage without any signature confirmation + 'ignored', // the server signed a contract from a different session +] as const; + +export type ClientContractState = (typeof clientContractStateList)[number]; export type RandomStringFactory = () => string; diff --git a/packages/media-signaling/src/definition/index.ts b/packages/media-signaling/src/definition/index.ts index 6433fe4d41134..7f8757cbe413f 100644 --- a/packages/media-signaling/src/definition/index.ts +++ b/packages/media-signaling/src/definition/index.ts @@ -2,5 +2,5 @@ export * from './call'; export type * from './services'; export type * from './media'; export * from './signals'; -export type * from './client'; +export * from './client'; export type * from './logger'; diff --git a/packages/media-signaling/src/definition/signals/client/hangup.ts b/packages/media-signaling/src/definition/signals/client/hangup.ts index f30ba8d398149..b1863d72f4a10 100644 --- a/packages/media-signaling/src/definition/signals/client/hangup.ts +++ b/packages/media-signaling/src/definition/signals/client/hangup.ts @@ -1,6 +1,6 @@ import type { JSONSchemaType } from 'ajv'; -import type { CallHangupReason } from '../../call'; +import { callHangupReasonList, type CallHangupReason } from '../../call'; /** Client is saying they hanged up from a call. The reason specifies if its a clean hangup or an error */ export type ClientMediaSignalHangup = { @@ -30,25 +30,7 @@ export const clientMediaSignalHangupSchema: JSONSchemaType Date: Wed, 24 Jun 2026 22:27:34 -0300 Subject: [PATCH 011/220] test: fix rooms-join flaky test (#41072) --- apps/meteor/tests/e2e/rooms-join.spec.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/apps/meteor/tests/e2e/rooms-join.spec.ts b/apps/meteor/tests/e2e/rooms-join.spec.ts index 28bbdb8929069..16e9afb053739 100644 --- a/apps/meteor/tests/e2e/rooms-join.spec.ts +++ b/apps/meteor/tests/e2e/rooms-join.spec.ts @@ -55,8 +55,12 @@ test.describe.serial('Join rooms', () => { let targetChannel: string; let poHomeChannel: HomeChannel; - test.beforeEach(async ({ page }) => { - poHomeChannel = new HomeChannel(page); + // Set the precondition explicitly instead of relying on the previous block's `afterAll` + // to have restored the permission. That cross-block coupling is racy: if the restore + // hasn't propagated, the user lands on the "not subscribed" screen and the composer's + // Join button never renders. + test.beforeAll(async ({ api }) => { + await api.post('/permissions.update', { permissions: [{ _id: 'preview-c-room', roles: ['admin', 'user', 'anonymous'] }] }); }); test.beforeEach(async ({ api }) => { @@ -66,7 +70,9 @@ test.describe.serial('Join rooms', () => { test.beforeEach(async ({ page }) => { poHomeChannel = new HomeChannel(page); - await page.goto(`/channel/${targetChannel}`); + // `gotoChannel` waits for the room to finish loading, so the Join-button assertion + // below doesn't race the preview render. + await poHomeChannel.gotoChannel(targetChannel); }); test.afterEach(async ({ api }) => { @@ -93,6 +99,8 @@ test.describe.serial('Join rooms', () => { let discussion: Record; test.beforeAll(async ({ api }) => { + // Don't depend on an earlier block's `afterAll` to restore preview-c-room (racy). + await api.post('/permissions.update', { permissions: [{ _id: 'preview-c-room', roles: ['admin', 'user', 'anonymous'] }] }); discussion = await createTargetDiscussion(api); }); @@ -100,8 +108,8 @@ test.describe.serial('Join rooms', () => { await deleteRoom(api, discussion._id); }); - test('should let a non-member join a discussion', async ({ page }) => { - await page.goto(`/channel/${discussion.name}`); + test('should let a non-member join a discussion', async () => { + await poHomeChannel.gotoChannel(discussion.name); await expect(poHomeChannel.composer.btnJoinRoom).toBeVisible(); From aa96fe55f3ead594a1743dc65b571f6bc200b375 Mon Sep 17 00:00:00 2001 From: Aleksander Nicacio da Silva Date: Thu, 25 Jun 2026 02:44:50 -0300 Subject: [PATCH 012/220] refactor(ui-voip): Extract MediaCallCardList and PopoutDockPrompt from MediaCallRoomSection (#41043) Co-authored-by: Guilherme Gazzo --- ...eerCardsView.tsx => MediaCallCardList.tsx} | 43 +++------- .../ui-voip/src/views/MediaCallPopoutView.tsx | 80 ++----------------- .../MediaCallRoomSection.tsx | 5 +- .../ui-voip/src/views/PopoutDockPrompt.tsx | 33 ++++++++ 4 files changed, 54 insertions(+), 107 deletions(-) rename packages/ui-voip/src/views/{MediaCallRoomSection/PeerCardsView.tsx => MediaCallCardList.tsx} (57%) create mode 100644 packages/ui-voip/src/views/PopoutDockPrompt.tsx diff --git a/packages/ui-voip/src/views/MediaCallRoomSection/PeerCardsView.tsx b/packages/ui-voip/src/views/MediaCallCardList.tsx similarity index 57% rename from packages/ui-voip/src/views/MediaCallRoomSection/PeerCardsView.tsx rename to packages/ui-voip/src/views/MediaCallCardList.tsx index 0b25b1246df0b..597a1176e35a9 100644 --- a/packages/ui-voip/src/views/MediaCallRoomSection/PeerCardsView.tsx +++ b/packages/ui-voip/src/views/MediaCallCardList.tsx @@ -1,13 +1,10 @@ -import { Box, Button } from '@rocket.chat/fuselage'; import { useState } from 'react'; -import { useTranslation } from 'react-i18next'; -import { CardListContainer, CardListSection, PeerCard, StreamCard } from '../../components'; -import { useMediaCallView } from '../../context'; -import { useMediaCallInstance } from '../../context/MediaCallInstanceContext'; -import { usePlayMediaStream } from '../../providers/usePlayMediaStream'; +import { CardListContainer, CardListSection, PeerCard, StreamCard } from '../components'; +import { useMediaCallView } from '../context'; +import { usePlayMediaStream } from '../providers/usePlayMediaStream'; -type PeerCardsViewProps = { +type MediaCallCardListProps = { shouldWrapCards: boolean; user: { displayName: string; @@ -15,17 +12,13 @@ type PeerCardsViewProps = { }; }; -const PeerCardsView = ({ user, shouldWrapCards }: PeerCardsViewProps) => { - const { t } = useTranslation(); +const MediaCallCardList = ({ user, shouldWrapCards }: MediaCallCardListProps) => { const [focusedCard, setFocusedCard] = useState<'remote' | 'local' | null>('remote'); const { sessionState, onToggleScreenSharing, - onClosePopout, streams: { remoteScreen, localScreen }, } = useMediaCallView(); - const { currentViews } = useMediaCallInstance(); - const isPopout = currentViews.includes('popout'); const { muted, held, remoteMuted, remoteHeld, peerInfo } = sessionState; const [remoteStreamRefCallback] = usePlayMediaStream(remoteScreen?.stream ?? null); @@ -83,26 +76,14 @@ const PeerCardsView = ({ user, shouldWrapCards }: PeerCardsViewProps) => { return ( - {isPopout && ( - - - {t('Call_open_separate_window')} - - - - )} - {!isPopout && ( - - - - {focusedCard !== 'remote' && remoteStreamCard} - {focusedCard !== 'local' && localStreamCard} - - )} + + + + {focusedCard !== 'remote' && remoteStreamCard} + {focusedCard !== 'local' && localStreamCard} + ); }; -export default PeerCardsView; +export default MediaCallCardList; diff --git a/packages/ui-voip/src/views/MediaCallPopoutView.tsx b/packages/ui-voip/src/views/MediaCallPopoutView.tsx index c03827dfe51ba..36e26e869b3f4 100644 --- a/packages/ui-voip/src/views/MediaCallPopoutView.tsx +++ b/packages/ui-voip/src/views/MediaCallPopoutView.tsx @@ -1,22 +1,11 @@ import { Box, ButtonGroup } from '@rocket.chat/fuselage'; import { useResizeObserver } from '@rocket.chat/fuselage-hooks'; -import { memo, useState } from 'react'; +import { memo } from 'react'; import { useTranslation } from 'react-i18next'; -import { - ToggleButton, - Timer, - DevicePicker, - ActionButton, - CardListContainer, - CardListSection, - PeerCard, - StreamCard, - useShouldWrapCards, - ActionStrip, -} from '../components'; +import { ToggleButton, Timer, DevicePicker, ActionButton, useShouldWrapCards, ActionStrip } from '../components'; +import MediaCallCardList from './MediaCallCardList'; import { useMediaCallView } from '../context/MediaCallViewContext'; -import { usePlayMediaStream } from '../providers/usePlayMediaStream'; type MediaCallPopoutViewProps = { user: { @@ -31,7 +20,6 @@ type MediaCallPopoutViewProps = { const MediaCallPopoutView = ({ user, onClickClosePopout, onClickFullscreen, fullscreen }: MediaCallPopoutViewProps) => { const { t } = useTranslation(); - const [focusedCard, setFocusedCard] = useState<'remote' | 'local' | null>('remote'); const { sessionState, onMute, @@ -39,10 +27,10 @@ const MediaCallPopoutView = ({ user, onClickClosePopout, onClickFullscreen, full onForward, onEndCall, onToggleScreenSharing, - streams: { remoteScreen, localScreen }, + streams: { localScreen }, } = useMediaCallView(); - const { muted, held, remoteMuted, remoteHeld, peerInfo, connectionState, startedAt } = sessionState; + const { muted, held, peerInfo, connectionState, startedAt } = sessionState; const { ref, borderBoxSize } = useResizeObserver(); @@ -51,59 +39,10 @@ const MediaCallPopoutView = ({ user, onClickClosePopout, onClickFullscreen, full const connecting = connectionState === 'CONNECTING'; const reconnecting = connectionState === 'RECONNECTING'; - const [remoteStreamRefCallback] = usePlayMediaStream(remoteScreen?.stream ?? null); - const [localStreamRefCallback] = usePlayMediaStream(localScreen?.stream ?? null); - - const onClickFocusRemoteCard = () => { - setFocusedCard((prev) => (prev === 'remote' ? null : 'remote')); - }; - - const onClickFocusLocalCard = () => { - setFocusedCard((prev) => (prev === 'local' ? null : 'local')); - }; - if (!peerInfo || 'number' in peerInfo) { return null; } - const remoteStreamCard = remoteScreen?.active ? ( - - - - ) : null; - - const localStreamCard = localScreen?.active ? ( - - - - ) : null; - - const focusedCardElement = focusedCard === 'remote' ? remoteStreamCard : localStreamCard; - return ( - - - - - {focusedCard !== 'remote' && remoteStreamCard} - {focusedCard !== 'local' && localStreamCard} - - + diff --git a/packages/ui-voip/src/views/MediaCallRoomSection/MediaCallRoomSection.tsx b/packages/ui-voip/src/views/MediaCallRoomSection/MediaCallRoomSection.tsx index c0bf5f3d72766..a34b563c558f5 100644 --- a/packages/ui-voip/src/views/MediaCallRoomSection/MediaCallRoomSection.tsx +++ b/packages/ui-voip/src/views/MediaCallRoomSection/MediaCallRoomSection.tsx @@ -2,7 +2,6 @@ import { Box, ButtonGroup } from '@rocket.chat/fuselage'; import { memo } from 'react'; import { useTranslation } from 'react-i18next'; -import PeerCardsView from './PeerCardsView'; import { ToggleButton, Timer, @@ -16,6 +15,8 @@ import { import { useMediaCallInstance } from '../../context/MediaCallInstanceContext'; import { useMediaCallView } from '../../context/MediaCallViewContext'; import useRegisterView from '../../context/useRegisterView'; +import MediaCallCardList from '../MediaCallCardList'; +import PopoutDockPrompt from '../PopoutDockPrompt'; type MediaCallRoomSectionProps = { showChat: boolean; @@ -84,7 +85,7 @@ const MediaCallRoomSection = ({ showChat, onToggleChat, user, containerHeight }: aria-label={t('Voice_call')} {...getSplitStyles(showChat)} > - + {isPopout ? : } diff --git a/packages/ui-voip/src/views/PopoutDockPrompt.tsx b/packages/ui-voip/src/views/PopoutDockPrompt.tsx new file mode 100644 index 0000000000000..0798e2c87c756 --- /dev/null +++ b/packages/ui-voip/src/views/PopoutDockPrompt.tsx @@ -0,0 +1,33 @@ +import { Box, Button } from '@rocket.chat/fuselage'; +import { useTranslation } from 'react-i18next'; + +type PopoutDockPromptProps = { + onClosePopout: () => void; +}; + +const PopoutDockPrompt = ({ onClosePopout }: PopoutDockPromptProps) => { + const { t } = useTranslation(); + + return ( + + + {t('Call_open_separate_window')} + + + + ); +}; + +export default PopoutDockPrompt; From 660215aa7413c3ab11b914e9887f14c1db8aafb8 Mon Sep 17 00:00:00 2001 From: Ricardo Garim Date: Thu, 25 Jun 2026 11:06:59 -0300 Subject: [PATCH 013/220] chore: use @rocket.chat/logger in presence service (#41034) --- ee/packages/presence/package.json | 1 + ee/packages/presence/src/Presence.ts | 16 ++++++++++------ ee/packages/presence/src/lib/PresenceReaper.ts | 5 ++++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/ee/packages/presence/package.json b/ee/packages/presence/package.json index 931fc518849ae..118bef0f0c211 100644 --- a/ee/packages/presence/package.json +++ b/ee/packages/presence/package.json @@ -18,6 +18,7 @@ "dependencies": { "@rocket.chat/core-services": "workspace:^", "@rocket.chat/core-typings": "workspace:^", + "@rocket.chat/logger": "workspace:^", "@rocket.chat/models": "workspace:^", "mongodb": "6.16.0" }, diff --git a/ee/packages/presence/src/Presence.ts b/ee/packages/presence/src/Presence.ts index cb113b82e176c..0213c4e623b1d 100755 --- a/ee/packages/presence/src/Presence.ts +++ b/ee/packages/presence/src/Presence.ts @@ -4,12 +4,15 @@ import type { IPresence, IBrokerNode } from '@rocket.chat/core-services'; import { License, ServiceClass, Settings } from '@rocket.chat/core-services'; import type { IUser } from '@rocket.chat/core-typings'; import { UserStatus } from '@rocket.chat/core-typings'; +import { Logger } from '@rocket.chat/logger'; import { Users, UsersSessions } from '@rocket.chat/models'; import { PresenceReaper } from './lib/PresenceReaper'; import { normalizeStatusText } from './lib/normalizeStatusText'; import { type ClaimUpdate, processPresence } from './lib/presenceEngine'; +const logger = new Logger('Presence'); + const MAX_CONNECTIONS = 200; const MAX_TIMEOUT_DELAY_MS = 2 ** 31 - 1; @@ -146,7 +149,7 @@ export class Presence extends ServiceClass implements IPresence { const delay = Math.min(Math.max(next.statusExpiresAt.getTime() - Date.now(), 0), MAX_TIMEOUT_DELAY_MS); this.expirationTimeout = setTimeout(() => { this.expirationTimeout = undefined; - this.handleExpirationJob().catch((err) => console.error('[Presence] Error handling status expiration:', err)); + this.handleExpirationJob().catch((err) => logger.error({ msg: 'Error handling status expiration', err })); }, delay); } @@ -161,14 +164,15 @@ export class Presence extends ServiceClass implements IPresence { const rejected = results.filter((result) => result.status === 'rejected'); if (fulfilled.length > 0) { - console.debug(`[PresenceReaper] Successfully updated presence for ${fulfilled.length} users.`); + logger.debug({ msg: 'Successfully updated presence for users', count: fulfilled.length }); } if (rejected.length > 0) { - console.error( - `[PresenceReaper] Failed to update presence for ${rejected.length} users:`, - rejected.map(({ reason }) => reason), - ); + logger.error({ + msg: 'Failed to update presence for users', + count: rejected.length, + reasons: rejected.map(({ reason }): unknown => reason), + }); } } diff --git a/ee/packages/presence/src/lib/PresenceReaper.ts b/ee/packages/presence/src/lib/PresenceReaper.ts index 969465229cad1..7df6539ed911e 100644 --- a/ee/packages/presence/src/lib/PresenceReaper.ts +++ b/ee/packages/presence/src/lib/PresenceReaper.ts @@ -1,9 +1,12 @@ import { setInterval } from 'node:timers'; import type { IUserSession } from '@rocket.chat/core-typings'; +import { Logger } from '@rocket.chat/logger'; import { UsersSessions } from '@rocket.chat/models'; import type { AnyBulkWriteOperation } from 'mongodb'; +const logger = new Logger('PresenceReaper'); + type ReaperPlan = { userId: string; removeIds: NonEmptyArray; @@ -48,7 +51,7 @@ export class PresenceReaper { // Run every 1 minute this.intervalId = setInterval(() => { - this.run().catch((err) => console.error('[PresenceReaper] Error:', err)); + this.run().catch((err) => logger.error({ msg: 'Error running presence reaper', err })); }, 60 * 1000); } From 41fde25bbcae74c2fc783520b66ae49832583a7d Mon Sep 17 00:00:00 2001 From: "lingohub[bot]" <69908207+lingohub[bot]@users.noreply.github.com> Date: Thu, 25 Jun 2026 14:43:10 -0300 Subject: [PATCH 014/220] =?UTF-8?q?i18n:=20Rocket.Chat=20language=20update?= =?UTF-8?q?=20from=20Lingohub=20=F0=9F=A4=96=20on=202026-06-22Z=20(#41040)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: dougfabris --- packages/i18n/src/locales/pt-BR.i18n.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/i18n/src/locales/pt-BR.i18n.json b/packages/i18n/src/locales/pt-BR.i18n.json index a8f501c0b405c..fdd1ef5066cd3 100644 --- a/packages/i18n/src/locales/pt-BR.i18n.json +++ b/packages/i18n/src/locales/pt-BR.i18n.json @@ -1812,6 +1812,7 @@ "Devices_Set": "Conjunto de dispositivos", "Dialed_number_doesnt_exist": "O número discado não existe", "Dialed_number_is_incomplete": "O número discado não está completo", + "Dialpad": "Teclado numérico", "Different_Style_For_User_Mentions": "Estilo diferente para as menções do usuário", "Direct": "Direta", "DirectMesssage_maxUsers": "Máximo de usuários em mensagens diretas", @@ -2335,6 +2336,7 @@ "FileUpload_Enabled": "Habilitar upload de arquivos", "FileUpload_Enabled_Direct": "Uploads de arquivos ativados em mensagens diretas", "FileUpload_Error": "Erro de upload de arquivo", + "FileUpload_Error_Trying_To_Open_File": "Erro ao tentar abrir o arquivo", "FileUpload_FileSystemPath": "Caminho do sistema", "FileUpload_File_Empty": "Arquivo vazio", "FileUpload_Canceled": "Upload cancelado", @@ -2520,6 +2522,7 @@ "GoogleTagManager_id": "ID Google Tag Manager", "Google_Meet_Enterprise_only": "Google Meet (plano Enterprise apenas)", "Google_Meet_Premium_only": "Google Meet (plano Premium apenas)", + "Google_Play": "Google Play", "Got_it": "Entendi", "Government": "Governo", "Grandfathered_app": "Aplicativo isento da política de limite de aplicativos", @@ -6876,6 +6879,7 @@ "registration.page.login.errors.loginBlockedForUser": "O login foi temporariamente bloqueado para este Usuário", "registration.page.login.errors.wrongCredentials": "Usuário não encontrado ou senha incorreta", "registration.page.login.forgot": "Esqueceu sua senha?", + "registration.page.login.register": "Novo aqui? <1>Criar uma conta", "registration.page.poweredBy": "Desenvolvido por <1>Rocket.Chat", "registration.page.register.back": "Voltar para o login", "registration.page.registration.waitActivationWarning": "Antes que você possa fazer o login, sua conta deve ser manualmente ativada por um administrador.", From 64af832a54da3b63f9cda95a13bbe9bfdad93666 Mon Sep 17 00:00:00 2001 From: Douglas Gubert Date: Thu, 25 Jun 2026 14:56:57 -0300 Subject: [PATCH 015/220] chore(apps): unit test improvements (#40785) --- .github/CODEOWNERS | 3 + packages/apps/deno-runtime/deno.jsonc | 2 +- packages/apps/package.json | 1 - .../DenoRuntimeSubprocessController.test.ts | 5 +- .../apps/tests/test-data/storage/storage.ts | 165 ++++++++---------- packages/apps/tests/test-data/utilities.ts | 2 +- 6 files changed, 79 insertions(+), 99 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 699185914302b..2326ac09356fe 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,5 +1,6 @@ /packages/* @RocketChat/Architecture /packages/apps-engine/ @RocketChat/apps +/packages/apps/ @RocketChat/apps /packages/core-typings/ @RocketChat/Architecture /packages/rest-typings/ @RocketChat/Architecture @RocketChat/backend /packages/ui-contexts/ @RocketChat/frontend @@ -27,6 +28,8 @@ apps/meteor/server/startup/migrations @RocketChat/Architecture /apps/meteor/packages/rocketchat-livechat @RocketChat/omnichannel /apps/meteor/server/features/EmailInbox @RocketChat/omnichannel +/apps/meteor/ee/server/apps/ @RocketChat/apps +/apps/meteor/ee/tests/unit/server/apps/ @RocketChat/apps /apps/meteor/ee/app/canned-responses @RocketChat/omnichannel /apps/meteor/ee/app/livechat @RocketChat/omnichannel /apps/meteor/ee/app/livechat-enterprise @RocketChat/omnichannel diff --git a/packages/apps/deno-runtime/deno.jsonc b/packages/apps/deno-runtime/deno.jsonc index d19a3daac7d92..da7d145b4d1ed 100644 --- a/packages/apps/deno-runtime/deno.jsonc +++ b/packages/apps/deno-runtime/deno.jsonc @@ -16,7 +16,7 @@ }, "unstable": ["detect-cjs","sloppy-imports"], "tasks": { - "test": "deno test --no-check --allow-read=../../../,/tmp --allow-write=/tmp" + "test": "deno test --no-check --allow-read --allow-write" }, "fmt": { "lineWidth": 160, diff --git a/packages/apps/package.json b/packages/apps/package.json index 18a0a92ca3771..d2f922ab57020 100644 --- a/packages/apps/package.json +++ b/packages/apps/package.json @@ -38,7 +38,6 @@ }, "devDependencies": { "@rocket.chat/tsconfig": "workspace:*", - "@seald-io/nedb": "^4.1.2", "@types/adm-zip": "^0.5.7", "@types/debug": "^4.1.12", "@types/lodash.clonedeep": "^4.5.9", diff --git a/packages/apps/tests/server/runtime/DenoRuntimeSubprocessController.test.ts b/packages/apps/tests/server/runtime/DenoRuntimeSubprocessController.test.ts index df954811aa3ef..d569ca5627d65 100644 --- a/packages/apps/tests/server/runtime/DenoRuntimeSubprocessController.test.ts +++ b/packages/apps/tests/server/runtime/DenoRuntimeSubprocessController.test.ts @@ -2,7 +2,6 @@ import * as assert from 'node:assert'; import * as fs from 'node:fs/promises'; -import * as os from 'node:os'; import * as path from 'node:path'; import { describe, it, afterEach, mock, before, after } from 'node:test'; @@ -39,6 +38,8 @@ describe('DenoRuntimeSubprocessController', () => { const appPackageBuffer = await fs.readFile(path.join(__dirname, '../../test-data/apps/hello-world-test_0.0.1.zip')); appPackage = await manager.getParser().unpackageApp(appPackageBuffer); + await fs.unlink(path.join(manager.getTempFilePath(), 'deno-runtime')).catch(function noop() {}); + appStorageItem = { id: 'hello-world-test', status: AppStatus.MANUALLY_ENABLED, @@ -57,7 +58,7 @@ describe('DenoRuntimeSubprocessController', () => { after( async () => { await controller?.stopApp(); - await fs.unlink(path.join(os.tmpdir(), 'deno-runtime')).catch((reason) => { + await fs.unlink(path.join(manager.getTempFilePath(), 'deno-runtime')).catch((reason) => { console.warn('Failed to delete temporary Deno runtime symlink', reason); }); }, diff --git a/packages/apps/tests/test-data/storage/storage.ts b/packages/apps/tests/test-data/storage/storage.ts index 1e95f5372e41d..156d3492b9d5b 100644 --- a/packages/apps/tests/test-data/storage/storage.ts +++ b/packages/apps/tests/test-data/storage/storage.ts @@ -5,129 +5,106 @@ import type { ISetting } from '@rocket.chat/apps-engine/definition/settings'; import type { IMarketplaceInfo } from '../../../src/server/marketplace'; import type { IAppStorageItem } from '../../../src/server/storage'; import { AppMetadataStorage } from '../../../src/server/storage'; - -const Datastore = require('@seald-io/nedb') as typeof import('@seald-io/nedb').default; +import { AppInstallationSource } from '../../../src/server/storage/IAppStorageItem'; export class TestsAppStorage extends AppMetadataStorage { - private db: InstanceType; - - private static instance: TestsAppStorage; - - public static getInstance(): TestsAppStorage { - if (!TestsAppStorage.instance) { - TestsAppStorage.instance = new TestsAppStorage(); - } - - return TestsAppStorage.instance; - } + private db = new Map(); - private constructor() { - super('nedb'); - this.db = new Datastore({ filename: 'tests/test-data/dbs/apps.nedb', autoload: true }); - this.db.ensureIndex({ fieldName: 'id', unique: true }); + constructor() { + super('in-memory'); } public create(item: IAppStorageItem): Promise { - return new Promise((resolve, reject) => { - item.createdAt = new Date(); - item.updatedAt = new Date(); - - this.db.findOne({ $or: [{ id: item.id }, { 'info.nameSlug': item.info.nameSlug }] }, (err, doc: IAppStorageItem) => { - if (err) { - reject(err); - } else if (doc) { - reject(new Error('App already exists.')); - } else { - this.db.insert(item, (err2, doc2: IAppStorageItem) => { - if (err2) { - reject(err2); - } else { - resolve(doc2); - } - }); - } - }); - }); + for (const [id, value] of this.db) { + if (id === item.id || item.info.nameSlug === value.info.nameSlug) { + return Promise.reject(new Error('App already exists.')); + } + } + + const stored = { ...item, _id: item._id ?? item.id, createdAt: new Date(), updatedAt: new Date() }; + this.db.set(stored.id, stored); + return Promise.resolve(stored); } - public retrieveOne(id: string): Promise { - return new Promise((resolve, reject) => { - this.db.findOne({ id }, (err, doc: IAppStorageItem) => { - if (err) { - reject(err); - } else if (doc) { - resolve(doc); - } else { - reject(new Error(`No App found by the id: ${id}`)); - } - }); - }); + public retrieveOne(id: string): Promise { + return Promise.resolve(this.db.get(id) ?? null); } public retrieveAll(): Promise> { - return new Promise((resolve, reject) => { - this.db.find({}, (err: Error, docs: Array) => { - if (err) { - reject(err); - } else { - const items = new Map(); - - docs.forEach((i) => items.set(i.id, i)); - - resolve(items); - } - }); - }); + return Promise.resolve(new Map(this.db)); } public retrieveAllPrivate(): Promise> { - return new Promise((resolve, reject) => { - this.db.find({ installationSource: 'private' }, (err: Error, docs: Array) => { - if (err) { - reject(err); - } else { - const items = new Map(); - - docs.forEach((i) => items.set(i.id, i)); - - resolve(items); - } - }); - }); + const items = new Map(); + for (const [id, item] of this.db) { + if (item.installationSource === AppInstallationSource.PRIVATE) { + items.set(id, item); + } + } + return Promise.resolve(items); + } + + public clear(): void { + this.db.clear(); } public remove(id: string): Promise<{ success: boolean }> { - return new Promise((resolve, reject) => { - this.db.remove({ id }, (err) => { - if (err) { - reject(err); - } else { - resolve({ success: true }); - } - }); - }); + this.db.delete(id); + return Promise.resolve({ success: true }); } public updatePartialAndReturnDocument( item: Partial, - options?: { unsetPermissionsGranted?: boolean }, + _options?: { unsetPermissionsGranted?: boolean }, ): Promise { - throw new Error('Method not implemented.'); + const lookupId = item.id ?? item._id; + if (!lookupId) { + return Promise.reject(new Error('Cannot update: item has no id.')); + } + + const existing = this.db.get(lookupId); + if (!existing) { + return Promise.reject(new Error(`App not found: ${lookupId}`)); + } + + const updated = { ...existing, ...item, updatedAt: new Date() }; + this.db.set(updated.id, updated); + return Promise.resolve(updated); } - public updateStatus(_id: string, status: AppStatus): Promise { - throw new Error('Method not implemented.'); + public updateStatus(id: string, status: AppStatus): Promise { + const existing = this.db.get(id); + if (!existing) { + return Promise.resolve(false); + } + this.db.set(id, { ...existing, status, updatedAt: new Date() }); + return Promise.resolve(true); } - public updateSetting(_id: string, setting: ISetting): Promise { - throw new Error('Method not implemented.'); + public updateSetting(id: string, setting: ISetting): Promise { + const existing = this.db.get(id); + if (!existing) { + return Promise.resolve(false); + } + this.db.set(id, { ...existing, settings: { ...existing.settings, [setting.id]: setting }, updatedAt: new Date() }); + return Promise.resolve(true); } - public updateAppInfo(_id: string, info: IAppInfo): Promise { - throw new Error('Method not implemented.'); + public updateAppInfo(id: string, info: IAppInfo): Promise { + const existing = this.db.get(id); + if (!existing) { + return Promise.resolve(false); + } + this.db.set(id, { ...existing, info, updatedAt: new Date() }); + return Promise.resolve(true); } - public updateMarketplaceInfo(_id: string, marketplaceInfo: IMarketplaceInfo[]): Promise { - throw new Error('Method not implemented.'); + public updateMarketplaceInfo(id: string, marketplaceInfo: IMarketplaceInfo[]): Promise { + const existing = this.db.get(id); + if (!existing) { + return Promise.resolve(false); + } + this.db.set(id, { ...existing, marketplaceInfo, updatedAt: new Date() }); + return Promise.resolve(true); } } diff --git a/packages/apps/tests/test-data/utilities.ts b/packages/apps/tests/test-data/utilities.ts index df4e0b7da7a2e..1f08fbc4edff4 100644 --- a/packages/apps/tests/test-data/utilities.ts +++ b/packages/apps/tests/test-data/utilities.ts @@ -76,7 +76,7 @@ export class TestInfastructureSetup { private runtimeManager: AppRuntimeManager; constructor() { - this.appStorage = TestsAppStorage.getInstance(); + this.appStorage = new TestsAppStorage(); this.logStorage = new TestsAppLogStorage(); this.bridges = new TestsAppBridges(); this.sourceStorage = new TestSourceStorage(); From e4dba795638df46405a75540a3f73451bfb3ec41 Mon Sep 17 00:00:00 2001 From: Diego Sampaio Date: Thu, 25 Jun 2026 23:01:55 -0300 Subject: [PATCH 016/220] fix(federation): edited and deleted messages corrupting event tree (#41046) --- .changeset/nice-baboons-flash.md | 8 ++++++ .../ee/server/hooks/federation/index.ts | 26 +++++++++++++------ .../federation-matrix/src/FederationMatrix.ts | 5 ++++ 3 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 .changeset/nice-baboons-flash.md diff --git a/.changeset/nice-baboons-flash.md b/.changeset/nice-baboons-flash.md new file mode 100644 index 0000000000000..f6abb11c3663d --- /dev/null +++ b/.changeset/nice-baboons-flash.md @@ -0,0 +1,8 @@ +--- +'@rocket.chat/federation-matrix': patch +'@rocket.chat/meteor': patch +--- + +Fixes an issue where editing or deleting a message in a federated room caused subsequent messages to stop syncing between servers + +Note: this prevents the issue from happening, but does not restore rooms that are already affected. Recovering those requires a separate, one-time repair. diff --git a/apps/meteor/ee/server/hooks/federation/index.ts b/apps/meteor/ee/server/hooks/federation/index.ts index affbcb3192941..e0c2683041262 100644 --- a/apps/meteor/ee/server/hooks/federation/index.ts +++ b/apps/meteor/ee/server/hooks/federation/index.ts @@ -78,11 +78,16 @@ callbacks.add( callbacks.add( 'afterDeleteMessage', - async (message: IMessage, { room }) => { + async (message: IMessage, { room, user }) => { if (!message.federation?.eventId) { return; } + // deletion came from federation — don't echo + if (isUserNativeFederated(user)) { + return; + } + if (FederationActions.shouldPerformFederationAction(room)) { await FederationMatrix.deleteMessage(room.federation.mrid, message); } @@ -255,14 +260,19 @@ callbacks.add( callbacks.add( 'afterSaveMessage', - async (message: IMessage, { room }) => { - if (FederationActions.shouldPerformFederationAction(room)) { - if (!isEditedMessage(message)) { - return; - } - - await FederationMatrix.updateMessage(room, message); + async (message: IMessage, { room, user }) => { + if (!FederationActions.shouldPerformFederationAction(room)) { + return; + } + if (!isEditedMessage(message)) { + return; } + // editor is remote -> edit came from federation, don't echo + if (isUserNativeFederated(user)) { + return; + } + + await FederationMatrix.updateMessage(room, message); }, callbacks.priority.HIGH, 'federation-matrix-after-room-message-updated', diff --git a/ee/packages/federation-matrix/src/FederationMatrix.ts b/ee/packages/federation-matrix/src/FederationMatrix.ts index f903c352efb7f..50e545eb34849 100644 --- a/ee/packages/federation-matrix/src/FederationMatrix.ts +++ b/ee/packages/federation-matrix/src/FederationMatrix.ts @@ -723,6 +723,11 @@ export class FederationMatrix extends ServiceClass implements IFederationMatrixS return; } + if (isUserNativeFederated(user)) { + this.logger.debug('Edit originated from a federated user; not re-sending to Matrix'); + return; + } + const userMui = isUserNativeFederated(user) ? user.federation.mui : `@${user.username}:${this.serverName}`; const parsedMessage = await toExternalMessageFormat({ From 2c4292b8b2d1497e398753233f67d3a226b5daf8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Jun 2026 09:50:11 -0300 Subject: [PATCH 017/220] chore(deps): bump actions/cache from 5.0.5 to 6.0.0 (#41073) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci-code-check.yml | 8 ++++---- .github/workflows/ci.yml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-code-check.yml b/.github/workflows/ci-code-check.yml index a7e426728a213..83172b9232616 100644 --- a/.github/workflows/ci-code-check.yml +++ b/.github/workflows/ci-code-check.yml @@ -48,7 +48,7 @@ jobs: - name: Restore TypeScript incremental cache id: restore-typecheck if: matrix.check == 'ts' - uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + uses: actions/cache/restore@2c8a9bd7457de244a408f35966fab2fb45fda9c8 # v6.0.0 with: path: ./apps/meteor/tsconfig.typecheck.tsbuildinfo key: typecheck-cache-${{ runner.os }}-${{ hashFiles('yarn.lock') }} @@ -89,7 +89,7 @@ jobs: - name: Save TypeScript incremental cache if: matrix.check == 'ts' && github.ref == 'refs/heads/develop' && github.event_name == 'push' - uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + uses: actions/cache/save@2c8a9bd7457de244a408f35966fab2fb45fda9c8 # v6.0.0 with: path: ./apps/meteor/tsconfig.typecheck.tsbuildinfo key: typecheck-cache-${{ runner.os }}-${{ hashFiles('yarn.lock') }} @@ -97,7 +97,7 @@ jobs: - name: Restore ESLint cache id: restore-eslint if: matrix.check == 'lint' - uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + uses: actions/cache/restore@2c8a9bd7457de244a408f35966fab2fb45fda9c8 # v6.0.0 with: path: ./apps/meteor/.eslintcache key: eslintcache-${{ runner.os }}-${{ hashFiles('yarn.lock') }} @@ -118,7 +118,7 @@ jobs: - name: Save ESLint cache if: matrix.check == 'lint' && github.ref == 'refs/heads/develop' && github.event_name == 'push' - uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + uses: actions/cache/save@2c8a9bd7457de244a408f35966fab2fb45fda9c8 # v6.0.0 with: path: ./apps/meteor/.eslintcache key: eslintcache-${{ runner.os }}-${{ hashFiles('yarn.lock') }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab4cbe89c606d..b4a8a9ea8eaee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -192,7 +192,7 @@ jobs: runs-on: ubuntu-24.04-arm steps: - name: Cache build - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + uses: actions/cache@2c8a9bd7457de244a408f35966fab2fb45fda9c8 # v6.0.0 id: packages-cache-build with: path: | @@ -238,7 +238,7 @@ jobs: } >> "$GITHUB_STEP_SUMMARY" - name: Cache vite - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + uses: actions/cache@2c8a9bd7457de244a408f35966fab2fb45fda9c8 # v6.0.0 if: steps.packages-cache-build.outputs.cache-hit != 'true' with: path: ./node_modules/.vite From e929d2d3864082a6c3b34a2867e9b77e8f081ec1 Mon Sep 17 00:00:00 2001 From: Diego Sampaio Date: Fri, 26 Jun 2026 15:58:33 -0300 Subject: [PATCH 018/220] chore: improve Docker images for micro services (#41083) --- .github/actions/build-docker/action.yml | 27 +++++ docker-compose-ci.yml | 24 ++-- ee/apps/Dockerfile | 78 +++++++++++++ ee/apps/account-service/Dockerfile | 115 ------------------- ee/apps/authorization-service/Dockerfile | 121 -------------------- ee/apps/ddp-streamer/Dockerfile | 118 -------------------- ee/apps/omnichannel-transcript/Dockerfile | 128 ---------------------- ee/apps/presence-service/Dockerfile | 116 -------------------- ee/apps/queue-worker/Dockerfile | 128 ---------------------- 9 files changed, 117 insertions(+), 738 deletions(-) create mode 100644 ee/apps/Dockerfile delete mode 100644 ee/apps/account-service/Dockerfile delete mode 100644 ee/apps/authorization-service/Dockerfile delete mode 100644 ee/apps/ddp-streamer/Dockerfile delete mode 100644 ee/apps/omnichannel-transcript/Dockerfile delete mode 100644 ee/apps/presence-service/Dockerfile delete mode 100644 ee/apps/queue-worker/Dockerfile diff --git a/.github/actions/build-docker/action.yml b/.github/actions/build-docker/action.yml index 2d7b1fa736a18..87389cbf52495 100644 --- a/.github/actions/build-docker/action.yml +++ b/.github/actions/build-docker/action.yml @@ -70,6 +70,33 @@ runs: } } + # Microservice images build from a pruned, self-contained context (out/) + # produced by `turbo prune`, instead of a hand-maintained list of COPY lines. + # The rocketchat (Meteor) image is a prebuilt bundle and is staged separately above. + - name: Stage service build context + if: inputs.service != 'rocketchat' + shell: bash + env: + INPUT_SERVICE: ${{ inputs.service }} + run: | + set -o xtrace + + # The Docker SERVICE arg (folder under ee/apps) lives in the compose build args; + # the compose service name (INPUT_SERVICE) can differ (e.g. ddp-streamer-service). + SERVICE_DIR=$(docker compose -f docker-compose-ci.yml config --format json 2>/dev/null | jq -r --arg s "$INPUT_SERVICE" '.services[$s].build.args.SERVICE') + PKG_NAME=$(node -p "require('./ee/apps/${SERVICE_DIR}/package.json').name") + TURBO_VERSION=$(node -p "require('./package.json').devDependencies.turbo") + + rm -rf "out/${SERVICE_DIR}" + + # `turbo prune` derives the exact workspace dependency closure for the service — no + # hand-maintained list. --use-gitignore=false also captures the gitignored build output + # we need (dist/, generated definition/), at the cost of dragging in node_modules/.turbo, + # which we strip below; `yarn workspaces focus --production` rebuilds node_modules in-image. + npx -y "turbo@${TURBO_VERSION}" prune "$PKG_NAME" --skip-infer --use-gitignore=false --out-dir "out/${SERVICE_DIR}" + + find "out/${SERVICE_DIR}" \( -name node_modules -o -name .turbo \) -type d -prune -exec rm -rf {} + + - name: Build Docker images shell: bash env: diff --git a/docker-compose-ci.yml b/docker-compose-ci.yml index 305f0c81e2cc8..ffa7125b5f727 100644 --- a/docker-compose-ci.yml +++ b/docker-compose-ci.yml @@ -46,8 +46,8 @@ services: authorization-service: build: - dockerfile: ee/apps/authorization-service/Dockerfile - context: . + dockerfile: ${GITHUB_WORKSPACE:-}/ee/apps/Dockerfile + context: out/authorization-service x-bake: platforms: - linux/amd64 @@ -66,8 +66,8 @@ services: account-service: build: - dockerfile: ee/apps/account-service/Dockerfile - context: . + dockerfile: ${GITHUB_WORKSPACE:-}/ee/apps/Dockerfile + context: out/account-service x-bake: platforms: - linux/amd64 @@ -86,8 +86,8 @@ services: presence-service: build: - dockerfile: ee/apps/presence-service/Dockerfile - context: . + dockerfile: ${GITHUB_WORKSPACE:-}/ee/apps/Dockerfile + context: out/presence-service x-bake: platforms: - linux/amd64 @@ -106,8 +106,8 @@ services: ddp-streamer-service: build: - dockerfile: ee/apps/ddp-streamer/Dockerfile - context: . + dockerfile: ${GITHUB_WORKSPACE:-}/ee/apps/Dockerfile + context: out/ddp-streamer x-bake: platforms: - linux/amd64 @@ -132,8 +132,8 @@ services: queue-worker-service: build: - dockerfile: ee/apps/queue-worker/Dockerfile - context: . + dockerfile: ${GITHUB_WORKSPACE:-}/ee/apps/Dockerfile + context: out/queue-worker x-bake: platforms: - linux/amd64 @@ -152,8 +152,8 @@ services: omnichannel-transcript-service: build: - dockerfile: ee/apps/omnichannel-transcript/Dockerfile - context: . + dockerfile: ${GITHUB_WORKSPACE:-}/ee/apps/Dockerfile + context: out/omnichannel-transcript x-bake: platforms: - linux/amd64 diff --git a/ee/apps/Dockerfile b/ee/apps/Dockerfile new file mode 100644 index 0000000000000..380aaee56b81e --- /dev/null +++ b/ee/apps/Dockerfile @@ -0,0 +1,78 @@ +FROM node:22.22.3-alpine3.23 AS builder + +ARG SERVICE + +RUN apk update && \ + apk --no-cache add g++ python3 make py3-setuptools + +WORKDIR /app + +# The build context is the pruned, self-contained subset produced by +# `turbo prune --use-gitignore=false` (then node_modules/.turbo stripped). +# It already contains exactly this service's dependency closure: every in-scope +# workspace's package.json + built dist (+ generated files like apps-engine/definition), +# a pruned yarn.lock, and the workspace plumbing (.yarnrc.yml, .yarn/*). +COPY . . + +ENV NODE_ENV=production + +# The service's own compiled output is emitted monorepo-mirrored inside its dist +# (e.g. dist/ee/apps//src/service.js, dist/apps/meteor/... for cross-imports). +# Overlay it onto /app so the compiled entrypoint lands at its real path, matching +# `CMD node src/service.js` from the service workdir. Library packages keep their own +# (flat) packages/*/dist, resolved via each package.json "main". +RUN cp -a ee/apps/${SERVICE}/dist/. ./ && rm -rf ee/apps/${SERVICE}/dist + +WORKDIR /app/ee/apps/${SERVICE} + +RUN yarn workspaces focus --production + +# `turbo prune` derives the closure from the *whole* workspace graph (incl. devDependencies) +# and copies each in-scope package's full tree (TS sources, sourcemaps, type decls). None of +# that is needed at runtime. Trim the build context to the production payload before it is +# baked into the final image: drop staged workspace packages the production install did not +# link (dev-only internal deps), library TS sources, sourcemaps, and type declarations. +RUN set -eu; cd /app; \ + # Packages the production install linked (node-modules linker symlinks them under + # node_modules/@rocket.chat). This is the source of truth for "needed at runtime". + keep="$(find node_modules/@rocket.chat -maxdepth 1 -type l -exec readlink -f {} \; | sed 's#^/app/##')"; \ + # Guard: never proceed with an empty keep-set (e.g. a PnP linker with no symlinks), + # which would otherwise delete every workspace package below. + [ -n "$keep" ] || { echo 'trim: no linked workspace packages found — aborting'; exit 1; }; \ + for d in packages/* ee/packages/*; do \ + if printf '%s\n' "$keep" | grep -qxF "$d"; then \ + # Kept package: drop its TS sources only when it ships a dist/ (its runtime entry). + # Packages whose entry point lives in src/ (no dist) keep their sources. + [ -d "$d/dist" ] && rm -rf "$d/src" || true; \ + else \ + rm -rf "$d"; \ + fi; \ + done; \ + find packages ee/packages ee/apps \( -name '*.js.map' -o -name '*.d.ts' \) -delete + +FROM node:22.22.3-alpine3.23 + +ARG SERVICE + +ENV NODE_ENV=production \ + PORT=3000 + +RUN apk update && \ + apk --no-cache --virtual deps add shadow && \ + # Update OpenSSL + # CVE -> https://scout.docker.com/vulnerabilities/id/CVE-2025-9230?s=alpine&n=openssl&ns=alpine&t=apk&osn=alpine&osv=3.22 + apk upgrade --no-cache openssl && \ + rm -rf /var/cache/apk/* && \ + groupmod -n rocketchat nogroup && \ + useradd -u 65533 -r -g rocketchat rocketchat && \ + apk del deps + +COPY --chown=rocketchat:rocketchat --from=builder /app /app + +WORKDIR /app/ee/apps/${SERVICE} + +USER rocketchat + +EXPOSE 3000 9458 + +CMD ["node", "src/service.js"] diff --git a/ee/apps/account-service/Dockerfile b/ee/apps/account-service/Dockerfile deleted file mode 100644 index f89df4181a69f..0000000000000 --- a/ee/apps/account-service/Dockerfile +++ /dev/null @@ -1,115 +0,0 @@ -FROM node:22.22.3-alpine3.23 AS builder - -ARG SERVICE - -RUN apk update && \ - apk --no-cache add g++ python3 make py3-setuptools - -WORKDIR /app - -COPY ./packages/core-services/package.json packages/core-services/package.json -COPY ./packages/core-services/dist packages/core-services/dist - -COPY ./packages/apps-engine/package.json packages/apps-engine/package.json -COPY ./packages/apps-engine/definition packages/apps-engine/definition - -COPY ./packages/agenda/package.json packages/agenda/package.json -COPY ./packages/agenda/dist packages/agenda/dist - -COPY ./packages/core-typings/package.json packages/core-typings/package.json -COPY ./packages/core-typings/dist packages/core-typings/dist - -COPY ./packages/rest-typings/package.json packages/rest-typings/package.json -COPY ./packages/rest-typings/dist packages/rest-typings/dist - -COPY ./packages/media-signaling/package.json packages/media-signaling/package.json -COPY ./packages/media-signaling/dist packages/media-signaling/dist - -COPY ./packages/message-parser/package.json packages/message-parser/package.json -COPY ./packages/message-parser/dist packages/message-parser/dist - -COPY ./packages/peggy-loader/package.json packages/peggy-loader/package.json -COPY ./packages/peggy-loader/dist packages/peggy-loader/dist - -COPY ./packages/model-typings/package.json packages/model-typings/package.json -COPY ./packages/model-typings/dist packages/model-typings/dist - -COPY ./packages/jwt/package.json packages/jwt/package.json -COPY ./packages/jwt/dist packages/jwt/dist - -COPY ./packages/models/package.json packages/models/package.json -COPY ./packages/models/dist packages/models/dist - -COPY ./packages/logger/package.json packages/logger/package.json -COPY ./packages/logger/dist packages/logger/dist - -COPY ./packages/server-cloud-communication/ packages/server-cloud-communication/ - -COPY ./ee/packages/network-broker/package.json ee/packages/network-broker/package.json -COPY ./ee/packages/network-broker/dist ee/packages/network-broker/dist - -COPY ./ee/packages/license/package.json packages/license/package.json -COPY ./ee/packages/license/dist packages/license/dist - -COPY ./packages/random/package.json packages/random/package.json -COPY ./packages/random/dist packages/random/dist - -COPY ./packages/sha256/package.json packages/sha256/package.json -COPY ./packages/sha256/dist packages/sha256/dist - -COPY ./packages/tracing/package.json packages/tracing/package.json -COPY ./packages/tracing/dist packages/tracing/dist - -COPY ./packages/tsconfig packages/tsconfig - -COPY ./packages/ui-kit/package.json packages/ui-kit/package.json -COPY ./packages/ui-kit/dist packages/ui-kit/dist - -COPY ./packages/tools/package.json packages/tools/package.json -COPY ./packages/tools/dist packages/tools/dist - -COPY ./packages/http-router/package.json packages/http-router/package.json -COPY ./packages/http-router/dist packages/http-router/dist - -COPY ./ee/apps/${SERVICE}/dist . - -COPY ./package.json . -COPY ./yarn.lock . -COPY ./.yarnrc.yml . -COPY ./.yarn/plugins .yarn/plugins -COPY ./.yarn/releases .yarn/releases -COPY ./.yarn/patches .yarn/patches -COPY ./ee/apps/${SERVICE}/package.json ee/apps/${SERVICE}/package.json - -ENV NODE_ENV=production - -WORKDIR /app/ee/apps/${SERVICE} - -RUN yarn workspaces focus --production - -FROM node:22.22.3-alpine3.23 - -ARG SERVICE - -ENV NODE_ENV=production \ - PORT=3000 - -RUN apk update && \ - apk --no-cache --virtual deps add shadow && \ - # Update OpenSSL - # CVE -> https://scout.docker.com/vulnerabilities/id/CVE-2025-9230?s=alpine&n=openssl&ns=alpine&t=apk&osn=alpine&osv=3.22 - apk upgrade --no-cache openssl && \ - rm -rf /var/cache/apk/* && \ - groupmod -n rocketchat nogroup && \ - useradd -u 65533 -r -g rocketchat rocketchat && \ - apk del deps - -COPY --chown=rocketchat:rocketchat --from=builder /app /app - -WORKDIR /app/ee/apps/${SERVICE} - -USER rocketchat - -EXPOSE 3000 9458 - -CMD ["node", "src/service.js"] diff --git a/ee/apps/authorization-service/Dockerfile b/ee/apps/authorization-service/Dockerfile deleted file mode 100644 index cf81d8593e2a0..0000000000000 --- a/ee/apps/authorization-service/Dockerfile +++ /dev/null @@ -1,121 +0,0 @@ -FROM node:22.22.3-alpine3.23 AS builder - -ARG SERVICE - -RUN apk update && \ - apk --no-cache add g++ python3 make py3-setuptools - -WORKDIR /app - -COPY ./packages/core-services/package.json packages/core-services/package.json -COPY ./packages/core-services/dist packages/core-services/dist - -COPY ./packages/apps-engine/package.json packages/apps-engine/package.json -COPY ./packages/apps-engine/definition packages/apps-engine/definition - -COPY ./packages/agenda/package.json packages/agenda/package.json -COPY ./packages/agenda/dist packages/agenda/dist - -COPY ./packages/core-typings/package.json packages/core-typings/package.json -COPY ./packages/core-typings/dist packages/core-typings/dist - -COPY ./packages/rest-typings/package.json packages/rest-typings/package.json -COPY ./packages/rest-typings/dist packages/rest-typings/dist - -COPY ./packages/media-signaling/package.json packages/media-signaling/package.json -COPY ./packages/media-signaling/dist packages/media-signaling/dist - -COPY ./packages/message-parser/package.json packages/message-parser/package.json -COPY ./packages/message-parser/dist packages/message-parser/dist - -COPY ./packages/peggy-loader/package.json packages/peggy-loader/package.json -COPY ./packages/peggy-loader/dist packages/peggy-loader/dist - -COPY ./packages/model-typings/package.json packages/model-typings/package.json -COPY ./packages/model-typings/dist packages/model-typings/dist - -COPY ./packages/jwt/package.json packages/jwt/package.json -COPY ./packages/jwt/dist packages/jwt/dist - -COPY ./packages/models/package.json packages/models/package.json -COPY ./packages/models/dist packages/models/dist - -COPY ./packages/logger/package.json packages/logger/package.json -COPY ./packages/logger/dist packages/logger/dist - -COPY ./packages/server-cloud-communication/ packages/server-cloud-communication/ - -COPY ./ee/packages/network-broker/package.json ee/packages/network-broker/package.json -COPY ./ee/packages/network-broker/dist ee/packages/network-broker/dist - -COPY ./ee/packages/license/package.json packages/license/package.json -COPY ./ee/packages/license/dist packages/license/dist - -COPY ./packages/random/package.json packages/random/package.json -COPY ./packages/random/dist packages/random/dist - -COPY ./packages/sha256/package.json packages/sha256/package.json -COPY ./packages/sha256/dist packages/sha256/dist - -COPY ./packages/tsconfig packages/tsconfig - -COPY ./packages/tracing/package.json packages/tracing/package.json -COPY ./packages/tracing/dist packages/tracing/dist - -COPY ./packages/ui-kit/package.json packages/ui-kit/package.json -COPY ./packages/ui-kit/dist packages/ui-kit/dist - -COPY ./packages/http-router/package.json packages/http-router/package.json -COPY ./packages/http-router/dist packages/http-router/dist - -COPY ./packages/server-fetch/package.json packages/server-fetch/package.json -COPY ./packages/server-fetch/dist packages/server-fetch/dist - -COPY ./packages/tools/package.json packages/tools/package.json -COPY ./packages/tools/dist packages/tools/dist - -COPY ./ee/packages/abac/package.json ee/packages/abac/package.json -COPY ./ee/packages/abac/dist ee/packages/abac/dist - -COPY ./ee/apps/${SERVICE}/dist . - -COPY ./package.json . -COPY ./yarn.lock . -COPY ./.yarnrc.yml . -COPY ./.yarn/plugins .yarn/plugins -COPY ./.yarn/releases .yarn/releases -COPY ./.yarn/patches .yarn/patches -COPY ./ee/apps/${SERVICE}/package.json ee/apps/${SERVICE}/package.json - -ENV NODE_ENV=production - -WORKDIR /app/ee/apps/${SERVICE} - -RUN yarn workspaces focus --production - -FROM node:22.22.3-alpine3.23 - -ARG SERVICE - -ENV NODE_ENV=production \ - PORT=3000 - -RUN apk update && \ - apk --no-cache --virtual deps add shadow && \ - # Update OpenSSL - # CVE -> https://scout.docker.com/vulnerabilities/id/CVE-2025-9230?s=alpine&n=openssl&ns=alpine&t=apk&osn=alpine&osv=3.22 - apk upgrade --no-cache openssl && \ - rm -rf /var/cache/apk/* && \ - groupmod -n rocketchat nogroup && \ - useradd -u 65533 -r -g rocketchat rocketchat && \ - apk del deps - -COPY --chown=rocketchat:rocketchat --from=builder /app /app - -WORKDIR /app/ee/apps/${SERVICE} - -USER rocketchat - -EXPOSE 3000 9458 - -CMD ["node", "src/service.js"] diff --git a/ee/apps/ddp-streamer/Dockerfile b/ee/apps/ddp-streamer/Dockerfile deleted file mode 100644 index a1d430af04c90..0000000000000 --- a/ee/apps/ddp-streamer/Dockerfile +++ /dev/null @@ -1,118 +0,0 @@ -FROM node:22.22.3-alpine3.23 AS builder - -ARG SERVICE - -RUN apk update && \ - apk --no-cache add g++ python3 make py3-setuptools - -WORKDIR /app - -COPY ./packages/core-services/package.json packages/core-services/package.json -COPY ./packages/core-services/dist packages/core-services/dist - -COPY ./packages/apps-engine/package.json packages/apps-engine/package.json -COPY ./packages/apps-engine/definition packages/apps-engine/definition - -COPY ./packages/agenda/package.json packages/agenda/package.json -COPY ./packages/agenda/dist packages/agenda/dist - -COPY ./packages/core-typings/package.json packages/core-typings/package.json -COPY ./packages/core-typings/dist packages/core-typings/dist - -COPY ./packages/rest-typings/package.json packages/rest-typings/package.json -COPY ./packages/rest-typings/dist packages/rest-typings/dist - -COPY ./packages/media-signaling/package.json packages/media-signaling/package.json -COPY ./packages/media-signaling/dist packages/media-signaling/dist - -COPY ./packages/message-parser/package.json packages/message-parser/package.json -COPY ./packages/message-parser/dist packages/message-parser/dist - -COPY ./packages/peggy-loader/package.json packages/peggy-loader/package.json -COPY ./packages/peggy-loader/dist packages/peggy-loader/dist - -COPY ./packages/password-policies/package.json packages/password-policies/package.json -COPY ./packages/password-policies/dist packages/password-policies/dist - -COPY ./packages/model-typings/package.json packages/model-typings/package.json -COPY ./packages/model-typings/dist packages/model-typings/dist - -COPY ./packages/jwt/package.json packages/jwt/package.json -COPY ./packages/jwt/dist packages/jwt/dist - -COPY ./packages/models/package.json packages/models/package.json -COPY ./packages/models/dist packages/models/dist - -COPY ./packages/logger/package.json packages/logger/package.json -COPY ./packages/logger/dist packages/logger/dist - -COPY ./packages/server-cloud-communication/ packages/server-cloud-communication/ - -COPY ./ee/packages/network-broker/package.json ee/packages/network-broker/package.json -COPY ./ee/packages/network-broker/dist ee/packages/network-broker/dist - -COPY ./ee/packages/license/package.json packages/license/package.json -COPY ./ee/packages/license/dist packages/license/dist - -COPY ./packages/random/package.json packages/random/package.json -COPY ./packages/random/dist packages/random/dist - -COPY ./packages/sha256/package.json packages/sha256/package.json -COPY ./packages/sha256/dist packages/sha256/dist - -COPY ./packages/instance-status/package.json packages/instance-status/package.json -COPY ./packages/instance-status/dist packages/instance-status/dist - -COPY ./packages/tracing/package.json packages/tracing/package.json -COPY ./packages/tracing/dist packages/tracing/dist - -COPY ./packages/tsconfig packages/tsconfig - -COPY ./packages/ui-kit/package.json packages/ui-kit/package.json -COPY ./packages/ui-kit/dist packages/ui-kit/dist - -COPY ./packages/http-router/package.json packages/http-router/package.json -COPY ./packages/http-router/dist packages/http-router/dist - -COPY ./ee/apps/${SERVICE}/dist . - -COPY ./package.json . -COPY ./yarn.lock . -COPY ./.yarnrc.yml . -COPY ./.yarn/plugins .yarn/plugins -COPY ./.yarn/releases .yarn/releases -COPY ./.yarn/patches .yarn/patches -COPY ./ee/apps/${SERVICE}/package.json ee/apps/${SERVICE}/package.json - -ENV NODE_ENV=production - -WORKDIR /app/ee/apps/${SERVICE} - -RUN yarn workspaces focus --production - -FROM node:22.22.3-alpine3.23 - -ARG SERVICE - -ENV NODE_ENV=production \ - PORT=3000 - -RUN apk update && \ - apk --no-cache --virtual deps add shadow && \ - # Update OpenSSL - # CVE -> https://scout.docker.com/vulnerabilities/id/CVE-2025-9230?s=alpine&n=openssl&ns=alpine&t=apk&osn=alpine&osv=3.22 - apk upgrade --no-cache openssl && \ - rm -rf /var/cache/apk/* && \ - groupmod -n rocketchat nogroup && \ - useradd -u 65533 -r -g rocketchat rocketchat && \ - apk del deps - -COPY --chown=rocketchat:rocketchat --from=builder /app /app - -WORKDIR /app/ee/apps/${SERVICE} - -USER rocketchat - -EXPOSE 3000 9458 - -CMD ["node", "src/service.js"] diff --git a/ee/apps/omnichannel-transcript/Dockerfile b/ee/apps/omnichannel-transcript/Dockerfile deleted file mode 100644 index 9b8e8b19a8abc..0000000000000 --- a/ee/apps/omnichannel-transcript/Dockerfile +++ /dev/null @@ -1,128 +0,0 @@ -FROM node:22.22.3-alpine3.23 AS builder - -ARG SERVICE - -RUN apk update && \ - apk --no-cache add g++ python3 make py3-setuptools - -WORKDIR /app - -COPY ./packages/core-services/package.json packages/core-services/package.json -COPY ./packages/core-services/dist packages/core-services/dist - -COPY ./packages/apps-engine/package.json packages/apps-engine/package.json -COPY ./packages/apps-engine/definition packages/apps-engine/definition - -COPY ./packages/agenda/package.json packages/agenda/package.json -COPY ./packages/agenda/dist packages/agenda/dist - -COPY ./packages/core-typings/package.json packages/core-typings/package.json -COPY ./packages/core-typings/dist packages/core-typings/dist - -COPY ./packages/rest-typings/package.json packages/rest-typings/package.json -COPY ./packages/rest-typings/dist packages/rest-typings/dist - -COPY ./packages/media-signaling/package.json packages/media-signaling/package.json -COPY ./packages/media-signaling/dist packages/media-signaling/dist - -COPY ./packages/message-parser/package.json packages/message-parser/package.json -COPY ./packages/message-parser/dist packages/message-parser/dist - -COPY ./packages/peggy-loader/package.json packages/peggy-loader/package.json -COPY ./packages/peggy-loader/dist packages/peggy-loader/dist - -COPY ./packages/model-typings/package.json packages/model-typings/package.json -COPY ./packages/model-typings/dist packages/model-typings/dist - -COPY ./packages/jwt/package.json packages/jwt/package.json -COPY ./packages/jwt/dist packages/jwt/dist - -COPY ./packages/models/package.json packages/models/package.json -COPY ./packages/models/dist packages/models/dist - -COPY ./packages/logger/package.json packages/logger/package.json -COPY ./packages/logger/dist packages/logger/dist - -COPY ./packages/server-cloud-communication/ packages/server-cloud-communication/ - -COPY ./ee/packages/network-broker/package.json ee/packages/network-broker/package.json -COPY ./ee/packages/network-broker/dist ee/packages/network-broker/dist - -COPY ./ee/packages/license/package.json packages/license/package.json -COPY ./ee/packages/license/dist packages/license/dist - -COPY ./packages/random/package.json packages/random/package.json -COPY ./packages/random/dist packages/random/dist - -COPY ./packages/sha256/package.json packages/sha256/package.json -COPY ./packages/sha256/dist packages/sha256/dist - -COPY ./ee/packages/omnichannel-services/package.json ee/packages/omnichannel-services/package.json -COPY ./ee/packages/omnichannel-services/dist ee/packages/omnichannel-services/dist - -COPY ./ee/packages/pdf-worker/package.json ee/packages/pdf-worker/package.json -COPY ./ee/packages/pdf-worker/dist ee/packages/pdf-worker/dist - -COPY ./packages/message-types/package.json packages/message-types/package.json -COPY ./packages/message-types/dist packages/message-types/dist - -COPY ./packages/tools/package.json packages/tools/package.json -COPY ./packages/tools/dist packages/tools/dist - -COPY ./packages/tracing/package.json packages/tracing/package.json -COPY ./packages/tracing/dist packages/tracing/dist - -COPY ./packages/tsconfig packages/tsconfig - - -COPY ./packages/ui-kit/package.json packages/ui-kit/package.json -COPY ./packages/ui-kit/dist packages/ui-kit/dist - -COPY ./packages/i18n/package.json packages/i18n/package.json -COPY ./packages/i18n/dist packages/i18n/dist - -COPY ./packages/http-router/package.json packages/http-router/package.json -COPY ./packages/http-router/dist packages/http-router/dist - -COPY ./ee/apps/${SERVICE}/dist . - -COPY ./package.json . -COPY ./yarn.lock . -COPY ./.yarnrc.yml . -COPY ./.yarn/plugins .yarn/plugins -COPY ./.yarn/releases .yarn/releases -COPY ./.yarn/patches .yarn/patches -COPY ./ee/apps/${SERVICE}/package.json ee/apps/${SERVICE}/package.json - -ENV NODE_ENV=production - -WORKDIR /app/ee/apps/${SERVICE} - -RUN yarn workspaces focus --production - -FROM node:22.22.3-alpine3.23 - -ARG SERVICE - -ENV NODE_ENV=production \ - PORT=3000 - -RUN apk update && \ - apk --no-cache --virtual deps add shadow && \ - # Update OpenSSL - # CVE -> https://scout.docker.com/vulnerabilities/id/CVE-2025-9230?s=alpine&n=openssl&ns=alpine&t=apk&osn=alpine&osv=3.22 - apk upgrade --no-cache openssl && \ - rm -rf /var/cache/apk/* && \ - groupmod -n rocketchat nogroup && \ - useradd -u 65533 -r -g rocketchat rocketchat && \ - apk del deps - -COPY --chown=rocketchat:rocketchat --from=builder /app /app - -WORKDIR /app/ee/apps/${SERVICE} - -USER rocketchat - -EXPOSE 3000 9458 - -CMD ["node", "src/service.js"] diff --git a/ee/apps/presence-service/Dockerfile b/ee/apps/presence-service/Dockerfile deleted file mode 100644 index e4d201aa24f64..0000000000000 --- a/ee/apps/presence-service/Dockerfile +++ /dev/null @@ -1,116 +0,0 @@ -FROM node:22.22.3-alpine3.23 AS builder - -ARG SERVICE - -RUN apk update && \ - apk --no-cache add g++ python3 make py3-setuptools - -WORKDIR /app - -COPY ./ee/packages/presence/package.json ee/packages/presence/package.json -COPY ./ee/packages/presence/dist ee/packages/presence/dist - -COPY ./packages/agenda/package.json packages/agenda/package.json -COPY ./packages/agenda/dist packages/agenda/dist - -COPY ./packages/core-services/package.json packages/core-services/package.json -COPY ./packages/core-services/dist packages/core-services/dist - -COPY ./packages/apps-engine/package.json packages/apps-engine/package.json -COPY ./packages/apps-engine/definition packages/apps-engine/definition - -COPY ./packages/core-typings/package.json packages/core-typings/package.json -COPY ./packages/core-typings/dist packages/core-typings/dist - -COPY ./packages/rest-typings/package.json packages/rest-typings/package.json -COPY ./packages/rest-typings/dist packages/rest-typings/dist - -COPY ./packages/media-signaling/package.json packages/media-signaling/package.json -COPY ./packages/media-signaling/dist packages/media-signaling/dist - -COPY ./packages/message-parser/package.json packages/message-parser/package.json -COPY ./packages/message-parser/dist packages/message-parser/dist - -COPY ./packages/peggy-loader/package.json packages/peggy-loader/package.json -COPY ./packages/peggy-loader/dist packages/peggy-loader/dist - -COPY ./packages/model-typings/package.json packages/model-typings/package.json -COPY ./packages/model-typings/dist packages/model-typings/dist - -COPY ./packages/jwt/package.json packages/jwt/package.json -COPY ./packages/jwt/dist packages/jwt/dist - -COPY ./packages/models/package.json packages/models/package.json -COPY ./packages/models/dist packages/models/dist - -COPY ./packages/logger/package.json packages/logger/package.json -COPY ./packages/logger/dist packages/logger/dist - -COPY ./packages/server-cloud-communication/ packages/server-cloud-communication/ - -COPY ./ee/packages/network-broker/package.json ee/packages/network-broker/package.json -COPY ./ee/packages/network-broker/dist ee/packages/network-broker/dist - -COPY ./ee/packages/license/package.json packages/license/package.json -COPY ./ee/packages/license/dist packages/license/dist - -COPY ./packages/random/package.json packages/random/package.json -COPY ./packages/random/dist packages/random/dist - -COPY ./packages/sha256/package.json packages/sha256/package.json -COPY ./packages/sha256/dist packages/sha256/dist - -COPY ./packages/tracing/package.json packages/tracing/package.json -COPY ./packages/tracing/dist packages/tracing/dist - -COPY ./packages/tsconfig packages/tsconfig - - -COPY ./packages/ui-kit/package.json packages/ui-kit/package.json -COPY ./packages/ui-kit/dist packages/ui-kit/dist - -COPY ./packages/http-router/package.json packages/http-router/package.json -COPY ./packages/http-router/dist packages/http-router/dist - -COPY ./ee/apps/${SERVICE}/dist . - -COPY ./package.json . -COPY ./yarn.lock . -COPY ./.yarnrc.yml . -COPY ./.yarn/plugins .yarn/plugins -COPY ./.yarn/releases .yarn/releases -COPY ./.yarn/patches .yarn/patches -COPY ./ee/apps/${SERVICE}/package.json ee/apps/${SERVICE}/package.json - -ENV NODE_ENV=production - -WORKDIR /app/ee/apps/${SERVICE} - -RUN yarn workspaces focus --production - -FROM node:22.22.3-alpine3.23 - -ARG SERVICE - -ENV NODE_ENV=production \ - PORT=3000 - -RUN apk update && \ - apk --no-cache --virtual deps add shadow && \ - # Update OpenSSL - # CVE -> https://scout.docker.com/vulnerabilities/id/CVE-2025-9230?s=alpine&n=openssl&ns=alpine&t=apk&osn=alpine&osv=3.22 - apk upgrade --no-cache openssl && \ - rm -rf /var/cache/apk/* && \ - groupmod -n rocketchat nogroup && \ - useradd -u 65533 -r -g rocketchat rocketchat && \ - apk del deps - -COPY --chown=rocketchat:rocketchat --from=builder /app /app - -WORKDIR /app/ee/apps/${SERVICE} - -USER rocketchat - -EXPOSE 3000 9458 - -CMD ["node", "src/service.js"] diff --git a/ee/apps/queue-worker/Dockerfile b/ee/apps/queue-worker/Dockerfile deleted file mode 100644 index 9b8e8b19a8abc..0000000000000 --- a/ee/apps/queue-worker/Dockerfile +++ /dev/null @@ -1,128 +0,0 @@ -FROM node:22.22.3-alpine3.23 AS builder - -ARG SERVICE - -RUN apk update && \ - apk --no-cache add g++ python3 make py3-setuptools - -WORKDIR /app - -COPY ./packages/core-services/package.json packages/core-services/package.json -COPY ./packages/core-services/dist packages/core-services/dist - -COPY ./packages/apps-engine/package.json packages/apps-engine/package.json -COPY ./packages/apps-engine/definition packages/apps-engine/definition - -COPY ./packages/agenda/package.json packages/agenda/package.json -COPY ./packages/agenda/dist packages/agenda/dist - -COPY ./packages/core-typings/package.json packages/core-typings/package.json -COPY ./packages/core-typings/dist packages/core-typings/dist - -COPY ./packages/rest-typings/package.json packages/rest-typings/package.json -COPY ./packages/rest-typings/dist packages/rest-typings/dist - -COPY ./packages/media-signaling/package.json packages/media-signaling/package.json -COPY ./packages/media-signaling/dist packages/media-signaling/dist - -COPY ./packages/message-parser/package.json packages/message-parser/package.json -COPY ./packages/message-parser/dist packages/message-parser/dist - -COPY ./packages/peggy-loader/package.json packages/peggy-loader/package.json -COPY ./packages/peggy-loader/dist packages/peggy-loader/dist - -COPY ./packages/model-typings/package.json packages/model-typings/package.json -COPY ./packages/model-typings/dist packages/model-typings/dist - -COPY ./packages/jwt/package.json packages/jwt/package.json -COPY ./packages/jwt/dist packages/jwt/dist - -COPY ./packages/models/package.json packages/models/package.json -COPY ./packages/models/dist packages/models/dist - -COPY ./packages/logger/package.json packages/logger/package.json -COPY ./packages/logger/dist packages/logger/dist - -COPY ./packages/server-cloud-communication/ packages/server-cloud-communication/ - -COPY ./ee/packages/network-broker/package.json ee/packages/network-broker/package.json -COPY ./ee/packages/network-broker/dist ee/packages/network-broker/dist - -COPY ./ee/packages/license/package.json packages/license/package.json -COPY ./ee/packages/license/dist packages/license/dist - -COPY ./packages/random/package.json packages/random/package.json -COPY ./packages/random/dist packages/random/dist - -COPY ./packages/sha256/package.json packages/sha256/package.json -COPY ./packages/sha256/dist packages/sha256/dist - -COPY ./ee/packages/omnichannel-services/package.json ee/packages/omnichannel-services/package.json -COPY ./ee/packages/omnichannel-services/dist ee/packages/omnichannel-services/dist - -COPY ./ee/packages/pdf-worker/package.json ee/packages/pdf-worker/package.json -COPY ./ee/packages/pdf-worker/dist ee/packages/pdf-worker/dist - -COPY ./packages/message-types/package.json packages/message-types/package.json -COPY ./packages/message-types/dist packages/message-types/dist - -COPY ./packages/tools/package.json packages/tools/package.json -COPY ./packages/tools/dist packages/tools/dist - -COPY ./packages/tracing/package.json packages/tracing/package.json -COPY ./packages/tracing/dist packages/tracing/dist - -COPY ./packages/tsconfig packages/tsconfig - - -COPY ./packages/ui-kit/package.json packages/ui-kit/package.json -COPY ./packages/ui-kit/dist packages/ui-kit/dist - -COPY ./packages/i18n/package.json packages/i18n/package.json -COPY ./packages/i18n/dist packages/i18n/dist - -COPY ./packages/http-router/package.json packages/http-router/package.json -COPY ./packages/http-router/dist packages/http-router/dist - -COPY ./ee/apps/${SERVICE}/dist . - -COPY ./package.json . -COPY ./yarn.lock . -COPY ./.yarnrc.yml . -COPY ./.yarn/plugins .yarn/plugins -COPY ./.yarn/releases .yarn/releases -COPY ./.yarn/patches .yarn/patches -COPY ./ee/apps/${SERVICE}/package.json ee/apps/${SERVICE}/package.json - -ENV NODE_ENV=production - -WORKDIR /app/ee/apps/${SERVICE} - -RUN yarn workspaces focus --production - -FROM node:22.22.3-alpine3.23 - -ARG SERVICE - -ENV NODE_ENV=production \ - PORT=3000 - -RUN apk update && \ - apk --no-cache --virtual deps add shadow && \ - # Update OpenSSL - # CVE -> https://scout.docker.com/vulnerabilities/id/CVE-2025-9230?s=alpine&n=openssl&ns=alpine&t=apk&osn=alpine&osv=3.22 - apk upgrade --no-cache openssl && \ - rm -rf /var/cache/apk/* && \ - groupmod -n rocketchat nogroup && \ - useradd -u 65533 -r -g rocketchat rocketchat && \ - apk del deps - -COPY --chown=rocketchat:rocketchat --from=builder /app /app - -WORKDIR /app/ee/apps/${SERVICE} - -USER rocketchat - -EXPOSE 3000 9458 - -CMD ["node", "src/service.js"] From 294ee5d6f3103d60520f990b4eede893ef7be581 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Fri, 26 Jun 2026 15:33:08 -0300 Subject: [PATCH 019/220] test(e2e): close leaked browser contexts in omnichannel livechat specs (#41078) --- ...hat-queue-management-autoselection.spec.ts | 16 ++++++++----- ...ichannel-livechat-queue-management.spec.ts | 23 +++++++++++-------- ...channel-livechat-tab-communication.spec.ts | 13 +++++++---- 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/apps/meteor/tests/e2e/omnichannel/omnichannel-livechat-queue-management-autoselection.spec.ts b/apps/meteor/tests/e2e/omnichannel/omnichannel-livechat-queue-management-autoselection.spec.ts index c666d4a603a30..b9dbeb5f57241 100644 --- a/apps/meteor/tests/e2e/omnichannel/omnichannel-livechat-queue-management-autoselection.spec.ts +++ b/apps/meteor/tests/e2e/omnichannel/omnichannel-livechat-queue-management-autoselection.spec.ts @@ -1,3 +1,5 @@ +import type { BrowserContext } from '@playwright/test'; + import { createFakeVisitor } from '../../mocks/data'; import { IS_EE } from '../config/constants'; import { createAuxContext } from '../fixtures/createAuxContext'; @@ -17,6 +19,7 @@ test.describe('OC - Livechat - Queue Management', () => { let poHomeOmnichannel: HomeOmnichannel; let poLiveChat: OmnichannelLiveChat; + let liveChatContext: BrowserContext; const waitingQueueMessage = 'This is a message from Waiting Queue'; @@ -37,8 +40,8 @@ test.describe('OC - Livechat - Queue Management', () => { }); test.beforeEach(async ({ browser, api }) => { - const context = await browser.newContext(); - const page2 = await context.newPage(); + liveChatContext = await browser.newContext(); + const page2 = await liveChatContext.newPage(); poLiveChat = new OmnichannelLiveChat(page2, api); await poLiveChat.page.goto('/livechat'); @@ -56,19 +59,20 @@ test.describe('OC - Livechat - Queue Management', () => { test.describe('OC - Queue Management - Auto Selection', () => { let poLiveChat2: OmnichannelLiveChat; + let liveChat2Context: BrowserContext; test.beforeEach(async ({ browser, api }) => { - const context = await browser.newContext(); - const page = await context.newPage(); + liveChat2Context = await browser.newContext(); + const page = await liveChat2Context.newPage(); poLiveChat2 = new OmnichannelLiveChat(page, api); await poLiveChat2.page.goto('/livechat'); }); test.afterEach(async () => { await poLiveChat2.closeChat(); - await poLiveChat2.page.close(); + await liveChat2Context.close(); await poLiveChat.closeChat(); - await poLiveChat.page.close(); + await liveChatContext.close(); }); test('Update user position on Queue', async () => { diff --git a/apps/meteor/tests/e2e/omnichannel/omnichannel-livechat-queue-management.spec.ts b/apps/meteor/tests/e2e/omnichannel/omnichannel-livechat-queue-management.spec.ts index f807014636041..1ea2707f4c08c 100644 --- a/apps/meteor/tests/e2e/omnichannel/omnichannel-livechat-queue-management.spec.ts +++ b/apps/meteor/tests/e2e/omnichannel/omnichannel-livechat-queue-management.spec.ts @@ -1,3 +1,5 @@ +import type { BrowserContext } from '@playwright/test'; + import { createFakeVisitor } from '../../mocks/data'; import { IS_EE } from '../config/constants'; import { createAuxContext } from '../fixtures/createAuxContext'; @@ -17,6 +19,7 @@ test.describe('OC - Livechat - Queue Management', () => { let poHomeOmnichannel: HomeOmnichannel; let poLiveChat: OmnichannelLiveChat; + let liveChatContext: BrowserContext; const waitingQueueMessage = 'This is a message from Waiting Queue'; const queuePosition1 = 'Your spot is #1'; @@ -35,8 +38,8 @@ test.describe('OC - Livechat - Queue Management', () => { }); test.beforeEach(async ({ browser, api }) => { - const context = await browser.newContext(); - const page2 = await context.newPage(); + liveChatContext = await browser.newContext(); + const page2 = await liveChatContext.newPage(); poLiveChat = new OmnichannelLiveChat(page2, api); await poLiveChat.page.goto('/livechat'); @@ -54,7 +57,7 @@ test.describe('OC - Livechat - Queue Management', () => { test.afterEach(async () => { await poLiveChat.closeChat(); - await poLiveChat.page.close(); + await liveChatContext.close(); }); test('OC - Queue Management - Waiting Queue Message enabled', async () => { @@ -72,17 +75,18 @@ test.describe('OC - Livechat - Queue Management', () => { test.describe('OC - Queue Management - Update Queue Position', () => { let poLiveChat2: OmnichannelLiveChat; + let liveChat2Context: BrowserContext; test.beforeEach(async ({ browser, api }) => { - const context = await browser.newContext(); - const page = await context.newPage(); + liveChat2Context = await browser.newContext(); + const page = await liveChat2Context.newPage(); poLiveChat2 = new OmnichannelLiveChat(page, api); await poLiveChat2.page.goto('/livechat'); }); test.afterEach(async () => { await poLiveChat2.closeChat(); - await poLiveChat2.page.close(); + await liveChat2Context.close(); }); test('Update user position on Queue', async () => { @@ -125,6 +129,7 @@ test.describe('OC - Contact Manager Routing', () => { let poHomeOmnichannel: HomeOmnichannel; let poLiveChat: OmnichannelLiveChat; + let liveChatContext: BrowserContext; // User2 will be the contact manager let poHomeOmnichannelUser2: HomeOmnichannel; @@ -152,8 +157,8 @@ test.describe('OC - Contact Manager Routing', () => { }); test.beforeEach(async ({ browser, api }) => { - const context = await browser.newContext(); - const page = await context.newPage(); + liveChatContext = await browser.newContext(); + const page = await liveChatContext.newPage(); poLiveChat = new OmnichannelLiveChat(page, api); await poLiveChat.page.goto('/livechat'); @@ -173,7 +178,7 @@ test.describe('OC - Contact Manager Routing', () => { test.afterEach(async () => { await poLiveChat.closeChat(); - await poLiveChat.page.close(); + await liveChatContext.close(); }); test('should route inquiry only to the contact manager', async () => { diff --git a/apps/meteor/tests/e2e/omnichannel/omnichannel-livechat-tab-communication.spec.ts b/apps/meteor/tests/e2e/omnichannel/omnichannel-livechat-tab-communication.spec.ts index 3e76820283543..94fc97b1929ac 100644 --- a/apps/meteor/tests/e2e/omnichannel/omnichannel-livechat-tab-communication.spec.ts +++ b/apps/meteor/tests/e2e/omnichannel/omnichannel-livechat-tab-communication.spec.ts @@ -1,3 +1,5 @@ +import type { BrowserContext } from '@playwright/test'; + import { createFakeVisitor } from '../../mocks/data'; import { createAuxContext } from '../fixtures/createAuxContext'; import { Users } from '../fixtures/userStates'; @@ -9,6 +11,7 @@ import { test, expect } from '../utils/test'; test.describe('OC - Livechat - Cross Tab Communication', () => { let pageLivechat1: OmnichannelLiveChat; let pageLivechat2: OmnichannelLiveChat; + let livechatContext: BrowserContext; let poHomeOmnichannel: HomeOmnichannel; let agent: Awaited>; @@ -21,9 +24,9 @@ test.describe('OC - Livechat - Cross Tab Communication', () => { }); test.beforeEach(async ({ browser, api }) => { - const context = await browser.newContext(); - const p1 = await context.newPage(); - const p2 = await context.newPage(); + livechatContext = await browser.newContext(); + const p1 = await livechatContext.newPage(); + const p2 = await livechatContext.newPage(); pageLivechat1 = new OmnichannelLiveChat(p1, api); pageLivechat2 = new OmnichannelLiveChat(p2, api); @@ -33,8 +36,8 @@ test.describe('OC - Livechat - Cross Tab Communication', () => { }); test.afterEach(async () => { - await pageLivechat1.page.close(); - await pageLivechat2.page.close(); + // Both pages share the same context; closing it disposes both pages + await livechatContext.close(); }); test.afterAll(async () => { From eed19bc9d48aed70e1a3c576df590400ed06d674 Mon Sep 17 00:00:00 2001 From: Diego Sampaio Date: Mon, 29 Jun 2026 03:54:22 -0300 Subject: [PATCH 020/220] test: use gotoChannel when possible (#41084) --- apps/meteor/tests/e2e/README.md | 24 +++++++++++++++++-- apps/meteor/tests/e2e/embedded-layout.spec.ts | 15 ++++-------- apps/meteor/tests/e2e/file-upload.spec.ts | 8 +++---- apps/meteor/tests/e2e/image-upload.spec.ts | 3 +-- .../meteor/tests/e2e/quote-attachment.spec.ts | 3 +-- apps/meteor/tests/e2e/quote-messages.spec.ts | 3 +-- 6 files changed, 33 insertions(+), 23 deletions(-) diff --git a/apps/meteor/tests/e2e/README.md b/apps/meteor/tests/e2e/README.md index 90b96c356b736..6358a7c6babda 100644 --- a/apps/meteor/tests/e2e/README.md +++ b/apps/meteor/tests/e2e/README.md @@ -243,6 +243,26 @@ Do **not** apply when: - Suite covers auth, 2FA, or session lifecycle — the browser state is the subject. - Suite has more than ~15 tests: the debug cost of shared state outgrows the speed win (see "Big test files should not be `.serial`" above). +### Pattern 3 — navigate to a known room by URL, not by search + +When a test already knows the room it needs (a channel created via API, `general`, etc.), open it directly with `poHomeChannel.gotoChannel(name)` instead of `page.goto('/home')` + `navbar.openChat(name)`. + +```ts +// ❌ fragile — three independent things must align before the combobox `fill` resolves +await page.goto('/home'); +await poHomeChannel.navbar.openChat(targetChannel); + +// ✅ deterministic — navigate straight to the room, then wait for it to be ready +await poHomeChannel.gotoChannel(targetChannel); +``` + +Why: searching the navbar couples the navigation to (1) the app shell hydrating, (2) the **search index** having picked up the room — a real lag for a channel created moments earlier via API — and (3) the listbox rendering and the option becoming clickable. Any one stalling makes `searchInput.fill` hang until the test timeout, surfacing as the misleading `Target page, context or browser has been closed`. `gotoChannel` loads `/channel/` and then `waitForChannel()` (main region, heading, message list, `aria-busy` cleared), so it has a proper readiness wait without the search dependency. + +Do **not** apply when: +- The navbar search is the actual subject of the test. +- Navigating to a **DM** (`/direct/`) or a **discussion** — `gotoChannel` builds a `/channel/` URL only. +- Reaching a channel the user is **not a member of** — the direct URL hits a different preview/join flow; verify the behavior before switching. + ## API helpers for state seeding Prefer these helpers in `beforeAll` / `beforeEach` and in setup `test.step`s. All live under `apps/meteor/tests/e2e/utils/`. @@ -296,8 +316,7 @@ test.describe.serial('Feature X', () => { page = await context.newPage(); poHomeChannel = new HomeChannel(page); - await page.goto('/home'); - await poHomeChannel.navbar.openChat(targetChannel); + await poHomeChannel.gotoChannel(targetChannel); }); test.afterAll(async ({ api }) => { @@ -332,6 +351,7 @@ Recipe for a single spec. Keep PRs to at most 5 files so reviews stay tractable. - `poHomeChannel.content.sendMessage(...)` used inside `beforeEach` or `beforeAll` — that is setup, should be `sendMessage(api, ...)`. - Opening meatball menus or modals purely to create a discussion, thread, or DM as a setup step. - `test.describe.serial` combined with `beforeEach(async ({ page }) => { await page.goto(...) })` — the context should be shared in `beforeAll`. +- `page.goto('/home')` + `navbar.openChat(name)` to reach a room the test already knows — use `poHomeChannel.gotoChannel(name)` (see Pattern 3). Searching a just-created channel races the search index and hangs until timeout. - New non-serial suites whose tests still each carry >3s of UI setup. - Inline `api.post('/im.create', …)` / `api.post('/chat.sendMessage', …)` in a spec instead of extending the helpers in `utils/`. diff --git a/apps/meteor/tests/e2e/embedded-layout.spec.ts b/apps/meteor/tests/e2e/embedded-layout.spec.ts index c834d96c17da8..b4901cd04feb5 100644 --- a/apps/meteor/tests/e2e/embedded-layout.spec.ts +++ b/apps/meteor/tests/e2e/embedded-layout.spec.ts @@ -31,8 +31,7 @@ test.describe('embedded-layout', () => { test.describe('Layout elements visibility', () => { test('should hide primary navigation elements in embedded layout', async ({ page }) => { - await page.goto('/home'); - await poHomeChannel.navbar.openChat(targetChannelId); + await poHomeChannel.gotoChannel(targetChannelId); await expect(poHomeChannel.roomHeaderToolbar).toBeVisible(); await page.goto(embeddedLayoutURL(page.url())); @@ -50,8 +49,7 @@ test.describe('embedded-layout', () => { }); test('should show room header toolbar as top navbar when setting enabled', async ({ page }) => { - await page.goto('/home'); - await poHomeChannel.navbar.openChat(targetChannelId); + await poHomeChannel.gotoChannel(targetChannelId); await page.goto(embeddedLayoutURL(page.url())); await expect(poHomeChannel.roomHeaderToolbar).toBeVisible(); @@ -61,8 +59,7 @@ test.describe('embedded-layout', () => { test.describe('Channel member functionality', () => { test('should hide join button and enable messaging for members', async ({ page }) => { - await page.goto('/home'); - await poHomeChannel.navbar.openChat(targetChannelId); + await poHomeChannel.gotoChannel(targetChannelId); await page.goto(embeddedLayoutURL(page.url())); await expect(poHomeChannel.composer.inputMessage).toBeVisible(); @@ -71,8 +68,7 @@ test.describe('embedded-layout', () => { }); test('should allow sending and receiving messages', async ({ page }) => { - await page.goto('/home'); - await poHomeChannel.navbar.openChat(targetChannelId); + await poHomeChannel.gotoChannel(targetChannelId); await page.goto(embeddedLayoutURL(page.url())); const testMessage = `Embedded test message ${Date.now()}`; @@ -81,8 +77,7 @@ test.describe('embedded-layout', () => { }); test('should preserve message composer functionality', async ({ page }) => { - await page.goto('/home'); - await poHomeChannel.navbar.openChat(targetChannelId); + await poHomeChannel.gotoChannel(targetChannelId); await page.goto(embeddedLayoutURL(page.url())); await expect(poHomeChannel.composer.inputMessage).toBeVisible(); diff --git a/apps/meteor/tests/e2e/file-upload.spec.ts b/apps/meteor/tests/e2e/file-upload.spec.ts index 0b371494e5478..7e70791c368b6 100644 --- a/apps/meteor/tests/e2e/file-upload.spec.ts +++ b/apps/meteor/tests/e2e/file-upload.spec.ts @@ -24,8 +24,7 @@ test.describe.serial('file-upload', () => { test.beforeEach(async ({ page }) => { poHomeChannel = new HomeChannel(page); - await page.goto('/home'); - await poHomeChannel.navbar.openChat(targetChannel); + await poHomeChannel.gotoChannel(targetChannel); }); test.afterAll(async ({ api }) => { @@ -132,7 +131,7 @@ test.describe.serial('file-upload', () => { test('should upload file in composer after recording video message', async ({ context }) => { await context.grantPermissions(['camera', 'microphone']); - await poHomeChannel.navbar.openChat(targetChannel); + await poHomeChannel.gotoChannel(targetChannel); await test.step('should be able to record a video with text content in composer ', async () => { await poHomeChannel.composer.inputMessage.fill('this is a message with video message'); @@ -235,8 +234,7 @@ test.describe('file-upload-not-member', () => { test.beforeEach(async ({ page }) => { poHomeChannel = new HomeChannel(page); - await page.goto('/home'); - await poHomeChannel.navbar.openChat(targetChannel); + await poHomeChannel.gotoChannel(targetChannel); }); test.afterAll(async ({ api }) => { diff --git a/apps/meteor/tests/e2e/image-upload.spec.ts b/apps/meteor/tests/e2e/image-upload.spec.ts index 3e19f8ae945db..dc7de61e51751 100644 --- a/apps/meteor/tests/e2e/image-upload.spec.ts +++ b/apps/meteor/tests/e2e/image-upload.spec.ts @@ -19,8 +19,7 @@ test.describe('image-upload', () => { test.beforeEach(async ({ page }) => { poHomeChannel = new HomeChannel(page); - await page.goto('/home'); - await poHomeChannel.navbar.openChat(targetChannel); + await poHomeChannel.gotoChannel(targetChannel); }); test.afterAll(async ({ api }) => { diff --git a/apps/meteor/tests/e2e/quote-attachment.spec.ts b/apps/meteor/tests/e2e/quote-attachment.spec.ts index 2630e2bcbe3d5..9c3bbf17ac4b8 100644 --- a/apps/meteor/tests/e2e/quote-attachment.spec.ts +++ b/apps/meteor/tests/e2e/quote-attachment.spec.ts @@ -18,8 +18,7 @@ test.describe.parallel('Quote Attachment', () => { test.beforeEach(async ({ page }) => { poHomeChannel = new HomeChannel(page); - await page.goto('/home'); - await poHomeChannel.navbar.openChat(targetChannel); + await poHomeChannel.gotoChannel(targetChannel); }); test.afterAll(async ({ api }) => { diff --git a/apps/meteor/tests/e2e/quote-messages.spec.ts b/apps/meteor/tests/e2e/quote-messages.spec.ts index 334dbfcd20da7..1c98af01c898f 100644 --- a/apps/meteor/tests/e2e/quote-messages.spec.ts +++ b/apps/meteor/tests/e2e/quote-messages.spec.ts @@ -32,8 +32,7 @@ test.describe.serial('Quote Messages', () => { page = await context.newPage(); poHomeChannel = new HomeChannel(page); - await page.goto('/home'); - await poHomeChannel.navbar.openChat(targetChannel); + await poHomeChannel.gotoChannel(targetChannel); }); test.afterAll(async ({ api }) => { From 275a6eda0d36f7e6c9e33621ccf913977cc51ae8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jun 2026 09:27:19 -0300 Subject: [PATCH 021/220] chore(deps): bump actions/cache/save from 6.0.0 to 6.1.0 (#41096) --- .github/workflows/ci-code-check.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-code-check.yml b/.github/workflows/ci-code-check.yml index 83172b9232616..da140165d4230 100644 --- a/.github/workflows/ci-code-check.yml +++ b/.github/workflows/ci-code-check.yml @@ -89,7 +89,7 @@ jobs: - name: Save TypeScript incremental cache if: matrix.check == 'ts' && github.ref == 'refs/heads/develop' && github.event_name == 'push' - uses: actions/cache/save@2c8a9bd7457de244a408f35966fab2fb45fda9c8 # v6.0.0 + uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: ./apps/meteor/tsconfig.typecheck.tsbuildinfo key: typecheck-cache-${{ runner.os }}-${{ hashFiles('yarn.lock') }} @@ -118,7 +118,7 @@ jobs: - name: Save ESLint cache if: matrix.check == 'lint' && github.ref == 'refs/heads/develop' && github.event_name == 'push' - uses: actions/cache/save@2c8a9bd7457de244a408f35966fab2fb45fda9c8 # v6.0.0 + uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: ./apps/meteor/.eslintcache key: eslintcache-${{ runner.os }}-${{ hashFiles('yarn.lock') }} From 3cd35ab11616bb77200cb3e01f8dfe131769eeb4 Mon Sep 17 00:00:00 2001 From: Diego Sampaio Date: Mon, 29 Jun 2026 20:27:23 -0300 Subject: [PATCH 022/220] =?UTF-8?q?chore:=20reorganize=20backend=20folder?= =?UTF-8?q?=20structure=20=E2=80=94=20Phase=201=20(slash=20commands)=20(#4?= =?UTF-8?q?0259)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/meteor/MIGRATION_PLAN.md | 679 ++++++++++++++++++ apps/meteor/scripts/migration/move-batch.mjs | 78 ++ apps/meteor/scripts/migration/move-module.mjs | 311 ++++++++ .../scripts/migration/phase1-commands.tsv | 20 + .../migration/verify-no-old-imports.mjs | 78 ++ apps/meteor/server/importPackages.ts | 36 +- .../{app => server/lib}/bot-helpers/README.md | 0 .../lib/bot-helpers}/index.ts | 12 +- .../slashcommands/archiveroom}/index.ts | 0 .../slashcommands/archiveroom}/server.ts | 12 +- .../slashcommands/asciiarts}/gimme.ts | 4 +- .../slashcommands/asciiarts}/index.ts | 0 .../slashcommands/asciiarts}/lenny.ts | 4 +- .../slashcommands/asciiarts}/shrug.ts | 4 +- .../slashcommands/asciiarts}/tableflip.ts | 4 +- .../slashcommands/asciiarts}/unflip.ts | 4 +- .../slashcommands/ban}/ban.ts | 10 +- .../slashcommands/ban}/index.ts | 0 .../slashcommands/ban}/unban.ts | 10 +- .../slashcommands/create}/index.ts | 0 .../slashcommands/create}/server.ts | 10 +- .../slashcommands/help}/index.ts | 0 .../slashcommands/help}/server.ts | 6 +- .../slashcommands/hide}/hide.ts | 8 +- .../slashcommands/hide}/index.ts | 0 .../slashcommands/invite}/index.ts | 0 .../slashcommands/invite}/server.ts | 10 +- .../slashcommands/inviteall}/index.ts | 0 .../slashcommands/inviteall}/server.ts | 14 +- .../slashcommands/join}/index.ts | 0 .../slashcommands/join}/server.ts | 6 +- .../slashcommands/kick}/index.ts | 0 .../slashcommands/kick}/server.ts | 10 +- .../slashcommands/leave}/index.ts | 0 .../slashcommands/leave}/leave.ts | 8 +- .../slashcommands/me}/index.ts | 0 .../server => server/slashcommands/me}/me.ts | 4 +- .../slashcommands/msg}/index.ts | 0 .../slashcommands/msg}/server.ts | 10 +- .../slashcommands/mute}/index.ts | 0 .../slashcommands/mute}/mute.ts | 8 +- .../slashcommands/mute}/unmute.ts | 8 +- .../slashcommands/status}/index.ts | 0 .../slashcommands/status}/status.ts | 8 +- .../slashcommands/topic}/index.ts | 0 .../slashcommands/topic}/topic.ts | 6 +- .../slashcommands/unarchiveroom}/index.ts | 0 .../slashcommands/unarchiveroom}/server.ts | 12 +- 48 files changed, 1280 insertions(+), 114 deletions(-) create mode 100644 apps/meteor/MIGRATION_PLAN.md create mode 100644 apps/meteor/scripts/migration/move-batch.mjs create mode 100644 apps/meteor/scripts/migration/move-module.mjs create mode 100644 apps/meteor/scripts/migration/phase1-commands.tsv create mode 100644 apps/meteor/scripts/migration/verify-no-old-imports.mjs rename apps/meteor/{app => server/lib}/bot-helpers/README.md (100%) rename apps/meteor/{app/bot-helpers/server => server/lib/bot-helpers}/index.ts (92%) rename apps/meteor/{app/slashcommands-archiveroom/server => server/slashcommands/archiveroom}/index.ts (100%) rename apps/meteor/{app/slashcommands-archiveroom/server => server/slashcommands/archiveroom}/server.ts (84%) rename apps/meteor/{app/slashcommand-asciiarts/server => server/slashcommands/asciiarts}/gimme.ts (79%) rename apps/meteor/{app/slashcommand-asciiarts/server => server/slashcommands/asciiarts}/index.ts (100%) rename apps/meteor/{app/slashcommand-asciiarts/server => server/slashcommands/asciiarts}/lenny.ts (79%) rename apps/meteor/{app/slashcommand-asciiarts/server => server/slashcommands/asciiarts}/shrug.ts (78%) rename apps/meteor/{app/slashcommand-asciiarts/server => server/slashcommands/asciiarts}/tableflip.ts (79%) rename apps/meteor/{app/slashcommand-asciiarts/server => server/slashcommands/asciiarts}/unflip.ts (79%) rename apps/meteor/{app/slashcommands-ban/server => server/slashcommands/ban}/ban.ts (74%) rename apps/meteor/{app/slashcommands-ban/server => server/slashcommands/ban}/index.ts (100%) rename apps/meteor/{app/slashcommands-ban/server => server/slashcommands/ban}/unban.ts (74%) rename apps/meteor/{app/slashcommands-create/server => server/slashcommands/create}/index.ts (100%) rename apps/meteor/{app/slashcommands-create/server => server/slashcommands/create}/server.ts (82%) rename apps/meteor/{app/slashcommands-help/server => server/slashcommands/help}/index.ts (100%) rename apps/meteor/{app/slashcommands-help/server => server/slashcommands/help}/server.ts (90%) rename apps/meteor/{app/slashcommands-hide/server => server/slashcommands/hide}/hide.ts (89%) rename apps/meteor/{app/slashcommands-hide/server => server/slashcommands/hide}/index.ts (100%) rename apps/meteor/{app/slashcommands-invite/server => server/slashcommands/invite}/index.ts (100%) rename apps/meteor/{app/slashcommands-invite/server => server/slashcommands/invite}/server.ts (93%) rename apps/meteor/{app/slashcommands-inviteall/server => server/slashcommands/inviteall}/index.ts (100%) rename apps/meteor/{app/slashcommands-inviteall/server => server/slashcommands/inviteall}/server.ts (87%) rename apps/meteor/{app/slashcommands-join/server => server/slashcommands/join}/index.ts (100%) rename apps/meteor/{app/slashcommands-join/server => server/slashcommands/join}/server.ts (89%) rename apps/meteor/{app/slashcommands-kick/server => server/slashcommands/kick}/index.ts (100%) rename apps/meteor/{app/slashcommands-kick/server => server/slashcommands/kick}/server.ts (77%) rename apps/meteor/{app/slashcommands-leave/server => server/slashcommands/leave}/index.ts (100%) rename apps/meteor/{app/slashcommands-leave/server => server/slashcommands/leave}/leave.ts (83%) rename apps/meteor/{app/slashcommands-me/server => server/slashcommands/me}/index.ts (100%) rename apps/meteor/{app/slashcommands-me/server => server/slashcommands/me}/me.ts (78%) rename apps/meteor/{app/slashcommands-msg/server => server/slashcommands/msg}/index.ts (100%) rename apps/meteor/{app/slashcommands-msg/server => server/slashcommands/msg}/server.ts (84%) rename apps/meteor/{app/slashcommands-mute/server => server/slashcommands/mute}/index.ts (100%) rename apps/meteor/{app/slashcommands-mute/server => server/slashcommands/mute}/mute.ts (80%) rename apps/meteor/{app/slashcommands-mute/server => server/slashcommands/mute}/unmute.ts (81%) rename apps/meteor/{app/slashcommands-status/server => server/slashcommands/status}/index.ts (100%) rename apps/meteor/{app/slashcommands-status/server => server/slashcommands/status}/status.ts (83%) rename apps/meteor/{app/slashcommands-topic/server => server/slashcommands/topic}/index.ts (100%) rename apps/meteor/{app/slashcommands-topic/server => server/slashcommands/topic}/topic.ts (65%) rename apps/meteor/{app/slashcommands-unarchiveroom/server => server/slashcommands/unarchiveroom}/index.ts (100%) rename apps/meteor/{app/slashcommands-unarchiveroom/server => server/slashcommands/unarchiveroom}/server.ts (85%) diff --git a/apps/meteor/MIGRATION_PLAN.md b/apps/meteor/MIGRATION_PLAN.md new file mode 100644 index 0000000000000..d6c18a500f669 --- /dev/null +++ b/apps/meteor/MIGRATION_PLAN.md @@ -0,0 +1,679 @@ +# Backend Folder Structure Migration Plan + +## Goal + +Move server-side files from `apps/meteor/app/*/server/` into `apps/meteor/server/`, extending the existing responsibility-based folder structure. Files move; code stays the same. Import paths update, but no refactoring. + +## Design Principle + +The existing `server/` structure is organized by **responsibility first, domain second**: + +``` +server/// +``` + +This migration extends that pattern by: + +1. Adding domain subfolders to existing responsibility folders (e.g., `server/meteor-methods/rooms/`) +2. Creating new responsibility folders where needed (e.g., `server/api/`, `server/slashcommands/`) +3. Extending `server/lib/` with domain subfolders for functions and shared libraries +4. Preserving all existing `server/` folders untouched + +## Target Structure + +``` +apps/meteor/server/ +│ +│ ── NEW (from app/*/server/) ────────────────────────────── +│ +├── api/ # REST API (from app/api/server/) +│ ├── v1/ # endpoint files: users.ts, rooms.ts, chat.ts... +│ │ ├── omnichannel/ # livechat endpoints (from app/livechat/server/api/v1/) +│ │ └── middlewares/ # authentication.ts, cors.ts, metrics.ts... +│ ├── lib/ # helpers + lib merged: getPaginationItems.ts, getUploadFormData.ts... +│ ├── validation/ # ajv.ts — JSON schema validation +│ ├── ApiClass.ts # API framework +│ ├── api.ts # API initialization +│ ├── router.ts # Hono router +│ └── definition.ts # TypeScript types +│ +├── slashcommands/ # Slash commands (from app/slashcommands-*/server/) +│ ├── archiveroom.ts +│ ├── asciiarts/ +│ ├── ban.ts +│ ├── create.ts +│ ├── help.ts +│ ├── hide.ts +│ ├── invite.ts +│ ├── inviteall.ts +│ ├── join.ts +│ ├── kick.ts +│ ├── leave.ts +│ ├── me.ts +│ ├── msg.ts +│ ├── mute.ts +│ ├── status.ts +│ ├── topic.ts +│ ├── unarchiveroom.ts +│ └── index.ts +│ +├── bridges/ # External system adapters +│ ├── irc/ # (from app/irc/server/) +│ ├── slack/ # (from app/slackbridge/server/) +│ ├── smarsh/ # (from app/smarsh-connector/server/) +│ ├── webdav/ # (from app/webdav/server/) +│ └── nextcloud/ # (from app/nextcloud/server/) +│ # (app/apps/server/ is out of scope — handled separately) +│ +│ ── EXISTING (extended with domain subfolders) ──────────── +│ +├── meteor-methods/ # EXISTING (renamed from methods/) — Meteor methods (deprecated) +│ ├── rooms/ # from app/lib/server/methods/ + app/channel-settings/... + existing flat files +│ ├── users/ # from app/lib/server/methods/ + existing flat files +│ ├── messages/ # from app/lib/server/methods/ + existing flat files +│ ├── auth/ # from app/authorization/server/methods/ + app/2fa/... + existing flat files +│ ├── omnichannel/ # from app/livechat/server/methods/ +│ ├── settings/ # from app/lib/server/methods/ + existing flat files +│ ├── platform/ # from app/autotranslate/ + app/e2e/ + existing flat files +│ ├── import/ # from app/importer/server/methods/ +│ ├── integrations/ # from app/integrations/server/methods/ +│ └── index.ts # updated to import from domain subfolders +│ +├── hooks/ # EXISTING — event handlers +│ ├── [existing flat files] # current files stay in place +│ ├── messages/ # NEW: afterSaveMessage, threads hooks, discussion hooks +│ ├── auth/ # NEW: from app/authentication/server/hooks/ +│ ├── rooms/ # NEW: beforeAddUserToRoom +│ └── omnichannel/ # NEW: from app/livechat/server/hooks/ +│ +├── lib/ # EXISTING — shared utilities + domain functions +│ ├── [existing contents] # current files stay in place +│ ├── users/ # NEW: domain functions (setRealName.ts, deleteUser.ts, saveUserIdentity.ts...) +│ ├── rooms/ # NEW: domain functions (createRoom.ts, addUserToRoom.ts, deleteRoom.ts...) +│ ├── messages/ # NEW: domain functions (sendMessage.ts, deleteMessage.ts, insertMessage.ts...) +│ ├── omnichannel/ # NEW: domain functions + livechat lib (closeLivechatRoom.ts...) +│ ├── authorization/ # NEW: hasPermission.ts, canAccessRoom.ts (from app/authorization/server/functions/) +│ ├── cloud/ # NEW: connectWorkspace.ts, syncWorkspace/ (from app/cloud/server/functions/) +│ ├── auth-providers/ # NEW: OAuth providers (apple, github, gitlab, etc.) +│ ├── notifications/ # NEW: push, email, queue (from app/push/, app/mailer/...) +│ ├── integrations/ # NEW: webhook lib, trigger handlers +│ ├── import/ # NEW: importer classes, definitions +│ ├── media/ # NEW: file-upload, emoji, custom-sounds, assets +│ ├── search/ # NEW: from app/search/server/ +│ ├── autotranslate/ # NEW: from app/autotranslate/server/ +│ ├── e2e/ # NEW: from app/e2e/server/ +│ ├── 2fa/ # NEW: from app/2fa/server/lib/ + classes/ +│ ├── saml/ # NEW: from app/meteor-accounts-saml/server/ +│ └── messaging/ # NEW: mentions, markdown, threads lib, reactions, pins, stars +│ +├── services/ # EXISTING — unchanged +├── settings/ # EXISTING — unchanged +├── cron/ # EXISTING — unchanged +├── configuration/ # EXISTING — unchanged +├── startup/ # EXISTING — unchanged +├── publications/ # EXISTING — unchanged +├── routes/ # EXISTING — unchanged +├── modules/ # EXISTING — unchanged +├── database/ # EXISTING — unchanged +├── email/ # EXISTING — unchanged +├── ufs/ # EXISTING — unchanged +├── oauth2-server/ # EXISTING — unchanged +├── features/ # EXISTING — unchanged +├── deasync/ # EXISTING — unchanged +├── models.ts # EXISTING — unchanged +├── main.ts # EXISTING — updated imports +├── tracing.ts # EXISTING — unchanged +└── importPackages.ts # EXISTING — updated imports +``` + +--- + +## Migration Phases + +The migration is split into 7 phases, ordered by risk (lowest first) and dependency (foundations first). Each phase is independently shippable — the app works after every phase. + +### Phase 0: Preparation + +**Goal**: Write disposable migration scripts. These are one-time-use tools — run them, verify the result, delete them. They don't need to live in the repository permanently. + +**No path aliases.** Both TypeScript `paths` and Node.js subpath `imports` add configuration surface across the build system (Meteor bundler, Jest, Mocha) for little benefit. Plain relative imports are universally understood by all tools with zero config. The migration scripts handle path updates directly. + +**No re-export stubs.** We control the entire codebase, so every import can be updated in the same commit as the file move. No transition period needed. + +**Scripts** (disposable, deleted after use): + +1. **`move-module.mjs --from --to `** — Moves a module directory and fixes all imports. + + - `mkdir -p` the target directory + - `git mv` every file from old to new location + - For each moved file, recompute relative imports from the new position + - For external files importing into the moved directory, recompute their specifiers + - Supports `--dry-run` to preview changes without writing + +2. **`move-batch.mjs `** — Moves a batch of modules from a TSV manifest. + + - Reads the manifest line by line (`old-pathnew-path`) + - Calls `move-module.mjs` for each entry + - After all moves, runs `yarn lint --quiet` once to verify no imports broke + - Reports: files moved, imports updated, any errors + +3. **`verify-no-old-imports.mjs ...`** — Checks that no imports still reference given substrings (e.g., `app/slashcommand`). Run after each phase to catch stragglers. + +Each phase produces a manifest file (the tables below), feeds it to `move-batch.mjs`, verifies with `yarn lint --quiet`, and commits the result. The scripts themselves are deleted once all phases are complete. + +**Primary validation command**: `yarn lint --quiet` is the authoritative check for broken imports after a move. The `--quiet` flag suppresses warnings so unresolved-import errors stand out. Run it from the repo root after every batch. `tsc --noEmit` may additionally be used to catch type regressions, but lint is the first line of defense for import integrity. + +**Deliverable**: Scripts written and tested on a small dry-run (e.g., move one slash command file, verify, revert). + +--- + +### Phase 1: Slash Commands (18 folders → 1 directory) + +**Goal**: Quick win. 18 tiny folders with 1-3 files each consolidate into `server/slashcommands/`. + +**Risk**: Very low. Slash commands are leaf nodes — nothing imports from them. + +**Scope**: ~40 files + +| Source | Destination | +| -------------------------------------------------- | --------------------------------------- | +| `app/slashcommand-asciiarts/server/` | `server/slashcommands/asciiarts/` | +| `app/slashcommands-archiveroom/server/server.ts` | `server/slashcommands/archiveroom.ts` | +| `app/slashcommands-ban/server/server.ts` | `server/slashcommands/ban.ts` | +| `app/slashcommands-create/server/server.ts` | `server/slashcommands/create.ts` | +| `app/slashcommands-help/server/server.ts` | `server/slashcommands/help.ts` | +| `app/slashcommands-hide/server/server.ts` | `server/slashcommands/hide.ts` | +| `app/slashcommands-invite/server/server.ts` | `server/slashcommands/invite.ts` | +| `app/slashcommands-inviteall/server/server.ts` | `server/slashcommands/inviteall.ts` | +| `app/slashcommands-join/server/server.ts` | `server/slashcommands/join.ts` | +| `app/slashcommands-kick/server/server.ts` | `server/slashcommands/kick.ts` | +| `app/slashcommands-leave/server/server.ts` | `server/slashcommands/leave.ts` | +| `app/slashcommands-me/server/server.ts` | `server/slashcommands/me.ts` | +| `app/slashcommands-msg/server/server.ts` | `server/slashcommands/msg.ts` | +| `app/slashcommands-mute/server/server.ts` | `server/slashcommands/mute.ts` | +| `app/slashcommands-status/server/server.ts` | `server/slashcommands/status.ts` | +| `app/slashcommands-topic/server/server.ts` | `server/slashcommands/topic.ts` | +| `app/slashcommands-unarchiveroom/server/server.ts` | `server/slashcommands/unarchiveroom.ts` | + +**Import updates**: Each slash command file typically has 0-2 external importers. Update `server/importPackages.ts` to import from the new location. + +**Verification**: `yarn lint --quiet`, manual test of 2-3 slash commands (e.g., `/invite`, `/kick`, `/topic`). + +--- + +### Phase 2: External Bridges (5 folders → `server/bridges/`) + +**Goal**: Move isolated bridge code that has no inbound importers. + +**Risk**: Low. Bridges are leaf nodes — they import from the core but nothing imports from them. + +**Scope**: ~48 files + +| Source | Destination | +| ------------------------------ | --------------------------- | +| `app/irc/server/` | `server/bridges/irc/` | +| `app/slackbridge/server/` | `server/bridges/slack/` | +| `app/smarsh-connector/server/` | `server/bridges/smarsh/` | +| `app/webdav/server/` | `server/bridges/webdav/` | +| `app/nextcloud/server/` | `server/bridges/nextcloud/` | + +**Note**: `app/apps/server/` (Apps-Engine bridges and converters) is explicitly out of scope for this migration. It will be handled manually in a separate initiative — do not move, rename, or touch it during any phase of this plan. + +**Verification**: `yarn lint --quiet`, test an incoming webhook. + +--- + +### Phase 3: REST API Infrastructure (1 folder → `server/api/`) + +**Goal**: Move the API framework and all REST endpoints into `server/api/`. + +**Risk**: Medium. The API folder is large (92 files) and is imported by `server/main.ts`. However, it's a cohesive unit — it moves as a block. + +**Scope**: ~92 files + ~43 livechat API files + +| Source | Destination | +| --------------------------------------- | ------------------------------ | +| `app/api/server/v1/*.ts` | `server/api/v1/` | +| `app/api/server/helpers/` | `server/api/lib/` | +| `app/api/server/lib/` | `server/api/lib/` | +| `app/api/server/middlewares/` | `server/api/v1/middlewares/` | +| `app/api/server/ApiClass.ts` | `server/api/ApiClass.ts` | +| `app/api/server/api.ts` | `server/api/api.ts` | +| `app/api/server/router.ts` | `server/api/router.ts` | +| `app/api/server/definition.ts` | `server/api/definition.ts` | +| `app/api/server/ajv.ts` | `server/api/validation/ajv.ts` | +| `app/api/server/default/` | `server/api/default/` | +| `app/livechat/server/api/v1/*.ts` | `server/api/v1/omnichannel/` | +| `app/livechat/imports/server/rest/*.ts` | `server/api/v1/omnichannel/` | + +**Key import update**: `server/main.ts` currently imports `../app/api/server/api` — update to `./api/api`. + +**Sub-steps**: + +1. Move the API framework files first (ApiClass.ts, router.ts, api.ts, definition.ts) +2. Move ajv.ts into `server/api/validation/` +3. Merge helpers/ and lib/ into a single `server/api/lib/` +4. Move v1/ endpoint files and middlewares/ into `server/api/v1/` +5. Move livechat API files into v1/omnichannel/ +6. Update `server/main.ts` and all cross-references + +**Verification**: `yarn lint --quiet`, run the REST API test suite, test a few endpoints manually. + +--- + +### Phase 4: Domain Functions (into `server/lib/`) + +**Goal**: Move domain functions from `app/lib/server/functions/` and `app/*/server/functions/` into `server/lib/` with domain subfolders. This is the largest and most impactful phase. + +**Risk**: Medium-high. These functions are heavily imported across the codebase (~62 features import from `app/lib/server`). The migration script updates all import paths in the same commit. + +**Scope**: ~80 files + +**Strategy**: Move files and update all imports in a single commit per sub-phase. No re-export stubs — every importer is updated immediately. + +#### Phase 4a: User Functions (~19 files) + +| Source | Destination | +| --------------------------------------------------------------- | ------------------------------------------------------------- | +| `app/lib/server/functions/setRealName.ts` | `server/lib/users/setRealName.ts` | +| `app/lib/server/functions/setUsername.ts` | `server/lib/users/setUsername.ts` | +| `app/lib/server/functions/setEmail.ts` | `server/lib/users/setEmail.ts` | +| `app/lib/server/functions/saveUserIdentity.ts` | `server/lib/users/saveUserIdentity.ts` | +| `app/lib/server/functions/setUserAvatar.ts` | `server/lib/users/setUserAvatar.ts` | +| `app/lib/server/functions/setUserActiveStatus.ts` | `server/lib/users/setUserActiveStatus.ts` | +| `app/lib/server/functions/setStatusText.ts` | `server/lib/users/setStatusText.ts` | +| `app/lib/server/functions/getStatusText.ts` | `server/lib/users/getStatusText.ts` | +| `app/lib/server/functions/deleteUser.ts` | `server/lib/users/deleteUser.ts` | +| `app/lib/server/functions/getFullUserData.ts` | `server/lib/users/getFullUserData.ts` | +| `app/lib/server/functions/getUsernameSuggestion.ts` | `server/lib/users/getUsernameSuggestion.ts` | +| `app/lib/server/functions/getUserCreatedByApp.ts` | `server/lib/users/getUserCreatedByApp.ts` | +| `app/lib/server/functions/getUserSingleOwnedRooms.ts` | `server/lib/users/getUserSingleOwnedRooms.ts` | +| `app/lib/server/functions/getAvatarSuggestionForUser.ts` | `server/lib/users/getAvatarSuggestionForUser.ts` | +| `app/lib/server/functions/checkEmailAvailability.ts` | `server/lib/users/checkEmailAvailability.ts` | +| `app/lib/server/functions/checkUsernameAvailability.ts` | `server/lib/users/checkUsernameAvailability.ts` | +| `app/lib/server/functions/validateUsername.ts` | `server/lib/users/validateUsername.ts` | +| `app/lib/server/functions/saveCustomFields.ts` | `server/lib/users/saveCustomFields.ts` | +| `app/lib/server/functions/saveCustomFieldsWithoutValidation.ts` | `server/lib/users/saveCustomFieldsWithoutValidation.ts` | + +#### Phase 4b: Room Functions (~16 files) + +| Source | Destination | +| --------------------------------------------------------------- | ------------------------------------------------------------- | +| `app/lib/server/functions/createRoom.ts` | `server/lib/rooms/createRoom.ts` | +| `app/lib/server/functions/createDirectRoom.ts` | `server/lib/rooms/createDirectRoom.ts` | +| `app/lib/server/functions/deleteRoom.ts` | `server/lib/rooms/deleteRoom.ts` | +| `app/lib/server/functions/archiveRoom.ts` | `server/lib/rooms/archiveRoom.ts` | +| `app/lib/server/functions/unarchiveRoom.ts` | `server/lib/rooms/unarchiveRoom.ts` | +| `app/lib/server/functions/addUserToRoom.ts` | `server/lib/rooms/addUserToRoom.ts` | +| `app/lib/server/functions/addUserToDefaultChannels.ts` | `server/lib/rooms/addUserToDefaultChannels.ts` | +| `app/lib/server/functions/removeUserFromRoom.ts` | `server/lib/rooms/removeUserFromRoom.ts` | +| `app/lib/server/functions/acceptRoomInvite.ts` | `server/lib/rooms/acceptRoomInvite.ts` | +| `app/lib/server/functions/cleanRoomHistory.ts` | `server/lib/rooms/cleanRoomHistory.ts` | +| `app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.ts` | `server/lib/rooms/getRoomByNameOrIdWithOptionToJoin.ts` | +| `app/lib/server/functions/getRoomsWithSingleOwner.ts` | `server/lib/rooms/getRoomsWithSingleOwner.ts` | +| `app/lib/server/functions/joinDefaultChannels.ts` | `server/lib/rooms/joinDefaultChannels.ts` | +| `app/lib/server/functions/relinquishRoomOwnerships.ts` | `server/lib/rooms/relinquishRoomOwnerships.ts` | +| `app/lib/server/functions/setRoomAvatar.ts` | `server/lib/rooms/setRoomAvatar.ts` | +| `app/lib/server/functions/updateGroupDMsName.ts` | `server/lib/rooms/updateGroupDMsName.ts` | +| `app/lib/server/functions/banUserFromRoom.ts` | `server/lib/rooms/banUserFromRoom.ts` | +| `app/lib/server/functions/executeUnbanUserFromRoom.ts` | `server/lib/rooms/executeUnbanUserFromRoom.ts` | + +#### Phase 4c: Message Functions (~10 files) + +| Source | Destination | +| ----------------------------------------------------------- | ------------------------------------------------------------ | +| `app/lib/server/functions/sendMessage.ts` | `server/lib/messages/sendMessage.ts` | +| `app/lib/server/functions/insertMessage.ts` | `server/lib/messages/insertMessage.ts` | +| `app/lib/server/functions/deleteMessage.ts` | `server/lib/messages/deleteMessage.ts` | +| `app/lib/server/functions/updateMessage.ts` | `server/lib/messages/updateMessage.ts` | +| `app/lib/server/functions/loadMessageHistory.ts` | `server/lib/messages/loadMessageHistory.ts` | +| `app/lib/server/functions/processWebhookMessage.ts` | `server/lib/messages/processWebhookMessage.ts` | +| `app/lib/server/functions/parseUrlsInMessage.ts` | `server/lib/messages/parseUrlsInMessage.ts` | +| `app/lib/server/functions/attachMessage.ts` | `server/lib/messages/attachMessage.ts` | +| `app/lib/server/functions/isTheLastMessage.ts` | `server/lib/messages/isTheLastMessage.ts` | +| `app/lib/server/functions/extractUrlsFromMessageAST.ts` | `server/lib/messages/extractUrlsFromMessageAST.ts` | +| `app/lib/server/functions/extractMentionsFromMessageAST.ts` | `server/lib/messages/extractMentionsFromMessageAST.ts` | + +#### Phase 4d: Other Domain Functions + +| Source | Destination | +| ----------------------------------------------------------------- | --------------------------------------------------------------- | +| `app/lib/server/functions/closeLivechatRoom.ts` | `server/lib/omnichannel/closeLivechatRoom.ts` | +| `app/lib/server/functions/closeOmnichannelConversations.ts` | `server/lib/omnichannel/closeOmnichannelConversations.ts` | +| `app/lib/server/functions/syncRolePrioritiesForRoomIfRequired.ts` | `server/lib/rooms/syncRolePrioritiesForRoomIfRequired.ts` | +| `app/lib/server/functions/validateName.ts` | `server/lib/shared/validateName.ts` | +| `app/lib/server/functions/validateNameChars.ts` | `server/lib/shared/validateNameChars.ts` | +| `app/lib/server/functions/getModifiedHttpHeaders.ts` | `server/lib/shared/getModifiedHttpHeaders.ts` | +| `app/lib/server/functions/disableCustomScripts.ts` | `server/lib/shared/disableCustomScripts.ts` | +| `app/authorization/server/functions/*.ts` | `server/lib/authorization/` | +| `app/cloud/server/functions/*.ts` | `server/lib/cloud/` | +| `app/livechat/server/lib/*.ts` (functions) | `server/lib/omnichannel/` | + +**Verification per sub-phase**: `yarn lint --quiet`, run unit tests for the moved functions, run integration tests. + +--- + +### Phase 5: Meteor Methods (from app/\*/server/methods/ → `server/meteor-methods//`) + +**Goal**: Consolidate all Meteor methods from feature folders into `server/meteor-methods/` with domain subfolders. + +**Risk**: Medium. Methods are entry points — nothing imports them, they just need to be loaded at startup. The main risk is missing a method registration. + +**Scope**: ~148 files + +**Naming**: This phase introduces the `meteor-methods/` folder name (renamed from the existing `methods/`) to make it explicit that these are Meteor-specific RPC handlers — not generic class methods, REST handlers, or service methods. The rename clarifies intent and reinforces that this directory is deprecated and slated for removal as features migrate off Meteor. + +**Phase 5 first step — rename the existing folder**: Before moving any new files in, rename `apps/meteor/server/methods/` → `apps/meteor/server/meteor-methods/` with a single `git mv`, and update every importer accordingly. Run `yarn lint --quiet` to confirm no broken imports before proceeding to the moves below. + +**Note**: After the rename above, the existing flat files (now under `server/meteor-methods/`) are also moved into the appropriate domain subfolder as part of this phase. + +| Source | Destination | +| ------------------------------------------------- | ----------------------------------------------- | +| `app/lib/server/methods/setRealName.ts` | `server/meteor-methods/users/setRealName.ts` | +| `app/lib/server/methods/setEmail.ts` | `server/meteor-methods/users/setEmail.ts` | +| `app/lib/server/methods/blockUser.ts` | `server/meteor-methods/users/blockUser.ts` | +| `app/lib/server/methods/unblockUser.ts` | `server/meteor-methods/users/unblockUser.ts` | +| `app/lib/server/methods/deleteUserOwnAccount.ts` | `server/meteor-methods/users/deleteUserOwnAccount.ts` | +| `app/lib/server/methods/getUsernameSuggestion.ts` | `server/meteor-methods/users/getUsernameSuggestion.ts` | +| `app/lib/server/methods/createChannel.ts` | `server/meteor-methods/rooms/createChannel.ts` | +| `app/lib/server/methods/createPrivateGroup.ts` | `server/meteor-methods/rooms/createPrivateGroup.ts` | +| `app/lib/server/methods/addUserToRoom.ts` | `server/meteor-methods/rooms/addUserToRoom.ts` | +| `app/lib/server/methods/addUsersToRoom.ts` | `server/meteor-methods/rooms/addUsersToRoom.ts` | +| `app/lib/server/methods/archiveRoom.ts` | `server/meteor-methods/rooms/archiveRoom.ts` | +| `app/lib/server/methods/unarchiveRoom.ts` | `server/meteor-methods/rooms/unarchiveRoom.ts` | +| `app/lib/server/methods/leaveRoom.ts` | `server/meteor-methods/rooms/leaveRoom.ts` | +| `app/lib/server/methods/joinRoom.ts` | `server/meteor-methods/rooms/joinRoom.ts` | +| `app/lib/server/methods/joinDefaultChannels.ts` | `server/meteor-methods/rooms/joinDefaultChannels.ts` | +| `app/lib/server/methods/cleanRoomHistory.ts` | `server/meteor-methods/rooms/cleanRoomHistory.ts` | +| `app/lib/server/methods/getRoomJoinCode.ts` | `server/meteor-methods/rooms/getRoomJoinCode.ts` | +| `app/lib/server/methods/sendMessage.ts` | `server/meteor-methods/messages/sendMessage.ts` | +| `app/lib/server/methods/updateMessage.ts` | `server/meteor-methods/messages/updateMessage.ts` | +| `app/lib/server/methods/getChannelHistory.ts` | `server/meteor-methods/messages/getChannelHistory.ts` | +| `app/lib/server/methods/getMessages.ts` | `server/meteor-methods/messages/getMessages.ts` | +| `app/lib/server/methods/getSingleMessage.ts` | `server/meteor-methods/messages/getSingleMessage.ts` | +| `app/lib/server/methods/addOAuthService.ts` | `server/meteor-methods/auth/addOAuthService.ts` | +| `app/lib/server/methods/refreshOAuthService.ts` | `server/meteor-methods/auth/refreshOAuthService.ts` | +| `app/lib/server/methods/removeOAuthService.ts` | `server/meteor-methods/auth/removeOAuthService.ts` | +| `app/lib/server/methods/createToken.ts` | `server/meteor-methods/auth/createToken.ts` | +| `app/lib/server/methods/saveSetting.ts` | `server/meteor-methods/settings/saveSetting.ts` | +| `app/lib/server/methods/saveSettings.ts` | `server/meteor-methods/settings/saveSettings.ts` | +| `app/authorization/server/methods/*.ts` | `server/meteor-methods/auth/` | +| `app/2fa/server/methods/*.ts` | `server/meteor-methods/auth/` | +| `app/channel-settings/server/methods/*.ts` | `server/meteor-methods/rooms/` | +| `app/threads/server/methods/*.ts` | `server/meteor-methods/messages/` | +| `app/discussion/server/methods/*.ts` | `server/meteor-methods/messages/` | +| `app/livechat/server/methods/*.ts` | `server/meteor-methods/omnichannel/` | +| `app/integrations/server/methods/*.ts` | `server/meteor-methods/integrations/` | +| `app/importer/server/methods/*.ts` | `server/meteor-methods/import/` | +| `app/autotranslate/server/methods/*.ts` | `server/meteor-methods/platform/` | +| `app/e2e/server/methods/*.ts` | `server/meteor-methods/platform/` | + +**Existing `server/meteor-methods/` flat files** — also moved into domain subfolders: + +| Source | Destination | +| --------------------------------------------- | -------------------------------------------------- | +| `server/meteor-methods/deleteUser.ts` | `server/meteor-methods/users/deleteUser.ts` | +| `server/meteor-methods/setUserActiveStatus.ts` | `server/meteor-methods/users/setUserActiveStatus.ts` | +| `server/meteor-methods/registerUser.ts` | `server/meteor-methods/users/registerUser.ts` | +| `server/meteor-methods/resetAvatar.ts` | `server/meteor-methods/users/resetAvatar.ts` | +| `server/meteor-methods/setAvatarFromService.ts` | `server/meteor-methods/users/setAvatarFromService.ts` | +| `server/meteor-methods/saveUserPreferences.ts` | `server/meteor-methods/users/saveUserPreferences.ts` | +| `server/meteor-methods/saveUserProfile.ts` | `server/meteor-methods/users/saveUserProfile.ts` | +| `server/meteor-methods/getUsersOfRoom.ts` | `server/meteor-methods/users/getUsersOfRoom.ts` | +| `server/meteor-methods/userPresence.ts` | `server/meteor-methods/users/userPresence.ts` | +| `server/meteor-methods/userSetUtcOffset.ts` | `server/meteor-methods/users/userSetUtcOffset.ts` | +| `server/meteor-methods/ignoreUser.ts` | `server/meteor-methods/users/ignoreUser.ts` | +| `server/meteor-methods/addAllUserToRoom.ts` | `server/meteor-methods/rooms/addAllUserToRoom.ts` | +| `server/meteor-methods/addRoomLeader.ts` | `server/meteor-methods/rooms/addRoomLeader.ts` | +| `server/meteor-methods/addRoomModerator.ts` | `server/meteor-methods/rooms/addRoomModerator.ts` | +| `server/meteor-methods/addRoomOwner.ts` | `server/meteor-methods/rooms/addRoomOwner.ts` | +| `server/meteor-methods/removeRoomLeader.ts` | `server/meteor-methods/rooms/removeRoomLeader.ts` | +| `server/meteor-methods/removeRoomModerator.ts` | `server/meteor-methods/rooms/removeRoomModerator.ts` | +| `server/meteor-methods/removeRoomOwner.ts` | `server/meteor-methods/rooms/removeRoomOwner.ts` | +| `server/meteor-methods/removeUserFromRoom.ts` | `server/meteor-methods/rooms/removeUserFromRoom.ts` | +| `server/meteor-methods/getRoomById.ts` | `server/meteor-methods/rooms/getRoomById.ts` | +| `server/meteor-methods/getRoomIdByNameOrId.ts` | `server/meteor-methods/rooms/getRoomIdByNameOrId.ts` | +| `server/meteor-methods/getRoomNameById.ts` | `server/meteor-methods/rooms/getRoomNameById.ts` | +| `server/meteor-methods/browseChannels.ts` | `server/meteor-methods/rooms/browseChannels.ts` | +| `server/meteor-methods/channelsList.ts` | `server/meteor-methods/rooms/channelsList.ts` | +| `server/meteor-methods/getTotalChannels.ts` | `server/meteor-methods/rooms/getTotalChannels.ts` | +| `server/meteor-methods/hideRoom.ts` | `server/meteor-methods/rooms/hideRoom.ts` | +| `server/meteor-methods/openRoom.ts` | `server/meteor-methods/rooms/openRoom.ts` | +| `server/meteor-methods/toggleFavorite.ts` | `server/meteor-methods/rooms/toggleFavorite.ts` | +| `server/meteor-methods/createDirectMessage.ts` | `server/meteor-methods/messages/createDirectMessage.ts` | +| `server/meteor-methods/deleteFileMessage.ts` | `server/meteor-methods/messages/deleteFileMessage.ts` | +| `server/meteor-methods/messageSearch.ts` | `server/meteor-methods/messages/messageSearch.ts` | +| `server/meteor-methods/loadHistory.ts` | `server/meteor-methods/messages/loadHistory.ts` | +| `server/meteor-methods/loadMissedMessages.ts` | `server/meteor-methods/messages/loadMissedMessages.ts` | +| `server/meteor-methods/loadNextMessages.ts` | `server/meteor-methods/messages/loadNextMessages.ts` | +| `server/meteor-methods/loadSurroundingMessages.ts` | `server/meteor-methods/messages/loadSurroundingMessages.ts` | +| `server/meteor-methods/readMessages.ts` | `server/meteor-methods/messages/readMessages.ts` | +| `server/meteor-methods/readThreads.ts` | `server/meteor-methods/messages/readThreads.ts` | +| `server/meteor-methods/muteUserInRoom.ts` | `server/meteor-methods/rooms/muteUserInRoom.ts` | +| `server/meteor-methods/unmuteUserInRoom.ts` | `server/meteor-methods/rooms/unmuteUserInRoom.ts` | +| `server/meteor-methods/afterVerifyEmail.ts` | `server/meteor-methods/auth/afterVerifyEmail.ts` | +| `server/meteor-methods/sendConfirmationEmail.ts` | `server/meteor-methods/auth/sendConfirmationEmail.ts` | +| `server/meteor-methods/sendForgotPasswordEmail.ts` | `server/meteor-methods/auth/sendForgotPasswordEmail.ts` | +| `server/meteor-methods/logoutCleanUp.ts` | `server/meteor-methods/auth/logoutCleanUp.ts` | +| `server/meteor-methods/getSetupWizardParameters.ts` | `server/meteor-methods/settings/getSetupWizardParameters.ts` | +| `server/meteor-methods/loadLocale.ts` | `server/meteor-methods/platform/loadLocale.ts` | +| `server/meteor-methods/OEmbedCacheCleanup.ts` | `server/meteor-methods/platform/OEmbedCacheCleanup.ts` | +| `server/meteor-methods/requestDataDownload.ts` | `server/meteor-methods/platform/requestDataDownload.ts` | + +**Import updates**: Update `server/importPackages.ts` and any `server/meteor-methods/index.ts` that aggregates method registrations. + +**Verification**: `yarn lint --quiet`, test several Meteor methods via DDP client. + +--- + +### Phase 6: Lib, Hooks, and Feature-Specific Code + +**Goal**: Move remaining feature-specific code: hooks, lib files, auth providers, notification code, and other domain-specific libraries. + +**Risk**: Medium. These files have more cross-references than the previous phases. + +**Scope**: ~300 files + +#### Phase 6a: Auth Providers (~30 files) + +| Source | Destination | +| ---------------------------------------- | ------------------------------------------------ | +| `app/apple/server/` | `server/lib/auth-providers/apple.ts` | +| `app/crowd/server/` | `server/lib/auth-providers/crowd/` | +| `app/custom-oauth/server/` | `server/lib/auth-providers/custom-oauth.ts` | +| `app/dolphin/server/` | `server/lib/auth-providers/dolphin.ts` | +| `app/drupal/server/` | `server/lib/auth-providers/drupal.ts` | +| `app/github/server/` | `server/lib/auth-providers/github.ts` | +| `app/github-enterprise/server/` | `server/lib/auth-providers/github-enterprise.ts` | +| `app/gitlab/server/` | `server/lib/auth-providers/gitlab.ts` | +| `app/google-oauth/server/` | `server/lib/auth-providers/google.ts` | +| `app/iframe-login/server/` | `server/lib/auth-providers/iframe.ts` | +| `app/wordpress/server/` | `server/lib/auth-providers/wordpress.ts` | +| `app/lib/server/oauth/*.js` | `server/lib/auth-providers/oauth/` | +| `app/meteor-accounts-saml/server/` | `server/lib/saml/` | +| `app/2fa/server/` (non-methods) | `server/lib/2fa/` | +| `app/authentication/server/` (non-hooks) | `server/lib/auth/` | +| `app/token-login/server/` | `server/lib/auth/token-login.ts` | + +#### Phase 6b: Hooks (~25 files) + +| Source | Destination | +| -------------------------------------------------- | ----------------------------------------------------- | +| `app/authentication/server/hooks/*.ts` | `server/hooks/auth/` | +| `app/discussion/server/hooks/*.ts` | `server/hooks/messages/` | +| `app/threads/server/hooks/*.ts` | `server/hooks/messages/` | +| `app/livechat/server/hooks/*.ts` | `server/hooks/omnichannel/` | +| `app/lib/server/lib/afterSaveMessage.ts` | `server/hooks/messages/afterSaveMessage.ts` | +| `app/lib/server/lib/notifyUsersOnMessage.ts` | `server/hooks/messages/notifyUsersOnMessage.ts` | +| `app/lib/server/lib/sendNotificationsOnMessage.ts` | `server/hooks/messages/sendNotificationsOnMessage.ts` | +| `app/lib/server/lib/beforeAddUserToRoom.ts` | `server/hooks/rooms/beforeAddUserToRoom.ts` | + +#### Phase 6c: Notification Libraries (~20 files) + +| Source | Destination | +| -------------------------------- | ----------------------------------------- | +| `app/push/server/` | `server/lib/notifications/push/` | +| `app/push-notifications/server/` | `server/lib/notifications/push-config/` | +| `app/mailer/server/` | `server/lib/notifications/email/` | +| `app/mail-messages/server/` | `server/lib/notifications/mail-messages/` | +| `app/notification-queue/server/` | `server/lib/notifications/queue/` | +| `app/notifications/server/` | `server/lib/notifications/core/` | + +#### Phase 6d: Messaging Libraries (~25 files) + +| Source | Destination | +| ------------------------------------------------- | ----------------------------------- | +| `app/threads/server/` (non-methods, non-hooks) | `server/lib/messaging/threads/` | +| `app/discussion/server/` (non-methods, non-hooks) | `server/lib/messaging/discussions/` | +| `app/reactions/server/` | `server/lib/messaging/reactions/` | +| `app/message-pin/server/` | `server/lib/messaging/pins/` | +| `app/message-star/server/` | `server/lib/messaging/stars/` | +| `app/message-mark-as-unread/server/` | `server/lib/messaging/unread/` | +| `app/mentions/server/` | `server/lib/messaging/mentions/` | +| `app/markdown/server/` | `server/lib/messaging/markdown/` | +| `app/emoji/server/` | `server/lib/messaging/emoji/` | + +#### Phase 6e: Media, Import, Search, and Remaining Libraries + +| Source | Destination | +| ------------------------------------------- | ----------------------------------------- | +| `app/file-upload/server/` | `server/lib/media/file-upload/` | +| `app/file/server/` | `server/lib/media/file/` | +| `app/emoji-custom/server/` | `server/lib/media/emoji-custom/` | +| `app/emoji-emojione/server/` | `server/lib/media/emoji-emojione/` | +| `app/custom-sounds/server/` | `server/lib/media/custom-sounds/` | +| `app/assets/server/` | `server/lib/media/assets/` | +| `app/importer/server/` (non-methods) | `server/lib/import/` | +| `app/importer-csv/server/` | `server/lib/import/csv/` | +| `app/importer-slack/server/` | `server/lib/import/slack/` | +| `app/importer-slack-users/server/` | `server/lib/import/slack-users/` | +| `app/importer-omnichannel-contacts/server/` | `server/lib/import/omnichannel-contacts/` | +| `app/importer-pending-avatars/server/` | `server/lib/import/pending-avatars/` | +| `app/importer-pending-files/server/` | `server/lib/import/pending-files/` | +| `app/search/server/` | `server/lib/search/` | +| `app/autotranslate/server/` (non-methods) | `server/lib/autotranslate/` | +| `app/e2e/server/` (non-methods) | `server/lib/e2e/` | +| `app/integrations/server/` (non-methods) | `server/lib/integrations/` | +| `app/statistics/server/` | `server/lib/statistics/` | +| `app/metrics/server/` | `server/lib/metrics/` | +| `app/cloud/server/` (non-functions) | `server/lib/cloud/` | +| `app/version-check/server/` | `server/lib/cloud/version-check/` | +| `app/license/server/` | `server/lib/cloud/license/` | + +**Verification**: `yarn lint --quiet` after each sub-phase, full test suite at end of Phase 6. + +--- + +### Phase 7: Omnichannel and Remaining Cleanup + +**Goal**: Move the largest single feature (livechat, 132 files) and clean up remaining files. + +**Risk**: Medium-high. Livechat is the largest feature and has many internal dependencies. Move it as a cohesive unit. + +**Scope**: ~150 files + +| Source | Destination | +| ------------------------------------ | ----------------------------------------------------------- | +| `app/livechat/server/lib/` | `server/lib/omnichannel/` | +| `app/livechat/server/methods/` | Already moved in Phase 5 | +| `app/livechat/server/hooks/` | Already moved in Phase 6b | +| `app/livechat/server/api/` | Already moved in Phase 3 | +| `app/livechat/server/` (remaining) | `server/lib/omnichannel/` | +| `ee/app/livechat-enterprise/server/` | `server/lib/omnichannel/enterprise/` | + +**Remaining cleanup**: + +- `app/channel-settings/server/` (non-methods) → `server/lib/rooms/settings/` +- `app/invites/server/` → `server/lib/rooms/invites/` +- `app/retention-policy/server/` → `server/lib/rooms/retention/` +- `app/user-status/server/` → `server/lib/users/status/` +- `app/bot-helpers/server/` → `server/lib/bot-helpers/` (moved in Phase 1) +- `app/cors/server/` → `server/lib/cors/` +- `app/error-handler/server/` → `server/lib/error-handler/` +- `app/oauth2-server-config/server/` → `server/lib/auth/oauth2-server/` +- `app/settings/server/` → `server/settings/` (merge with existing) +- `app/theme/server/` → `server/settings/theme/` +- `app/utils/server/` → `server/lib/utils/` +- `app/ui-master/server/` → `server/lib/ui-master/` +- Delete `app/lib/server/index.ts` (should be empty by now) +- Update `server/importPackages.ts` to remove all `app/` imports +- Verify no remaining imports from `app/*/server/` +- Delete the migration scripts (`move-module.mjs`, `move-batch.mjs`, `verify-no-old-imports.mjs`) + +**Final verification**: `yarn lint --quiet` across the repo, full `tsc --noEmit` for type regressions, full test suite, manual smoke test of core features (login, send message, create room, livechat, file upload). + +--- + +## Cross-Cutting Concerns + +### How to Handle `app/lib/server/lib/` (Utility Files) + +These files don't fit neatly into `lib//` because they're hooks, utilities, or notification orchestration: + +| File | Destination | Reason | +| -------------------------------- | --------------------------- | -------------------------- | +| `afterSaveMessage.ts` | `server/hooks/messages/` | It's a hook | +| `notifyUsersOnMessage.ts` | `server/hooks/messages/` | It's a hook | +| `sendNotificationsOnMessage.ts` | `server/hooks/messages/` | It's a hook | +| `beforeAddUserToRoom.ts` | `server/hooks/rooms/` | It's a hook | +| `notifyListener.ts` | `server/lib/` (stays) | Already effectively in lib | +| `msgStream.ts` | `server/lib/messaging/` | Messaging utility | +| `validateCustomMessageFields.ts` | `server/lib/messaging/` | Messaging utility | +| `bugsnag.ts` | `server/lib/` | Infrastructure | +| `deprecationWarningLogger.ts` | `server/lib/` | Infrastructure | +| `passwordPolicy.ts` | `server/lib/auth/` | Auth utility | +| `generatePassword.ts` | `server/lib/auth/` | Auth utility | +| `loginErrorMessageOverride.ts` | `server/lib/auth/` | Auth utility | +| `processDirectEmail.ts` | `server/lib/notifications/` | Email processing | +| `getHiddenSystemMessages.ts` | `server/lib/messaging/` | Messaging utility | +| `defaultBlockedDomainsList.ts` | `server/lib/` | Configuration data | +| `checkSettingValueBonds.ts` | `server/settings/` | Settings utility | + +### How to Handle `app/lib/server/startup/` + +| File | Destination | +| ---------------------------- | -------------------------------------------------- | +| `index.ts` | Updated to import from new paths | +| `rateLimiter.js` | `server/startup/rateLimiter.js` | +| `robots.js` | `server/startup/robots.js` | +| `mentionUserNotInChannel.ts` | `server/hooks/messages/mentionUserNotInChannel.ts` | + +### How to Handle `app/lib/server/index.ts` + +This file is the main import aggregator for the app/lib module. As files move out, update this file to remove the corresponding imports. Once all files are moved, delete `app/lib/server/index.ts` entirely. + +--- + +## Risks and Mitigations + +| Risk | Mitigation | +| ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | +| **Broken imports** — moving 800+ files changes import paths everywhere | Migration script updates all imports in the same commit as the file move; `yarn lint --quiet` verifies after each batch (authoritative check for unresolved imports) | +| **Missing method registration** — Meteor methods must be imported to register | Each phase verifies that all methods still register by running `yarn lint --quiet` and method-specific tests | +| **Merge conflicts** — other developers working on moved files | Communicate migration schedule; do large moves in low-activity windows; each phase is a separate PR | +| **`app/lib/server/` is a dependency hub** — 62 features import from it | Migration script handles all import updates atomically per batch; `verify-no-old-imports.mjs` catches stragglers | +| **Omnichannel is huge** — 132 files in livechat | Move incrementally: API in Phase 3, methods in Phase 5, hooks in Phase 6, lib in Phase 7 | +| **Test breakage** — tests may import from old paths | Update test imports in the same PR as the file move; tests co-located with source files move together | + +--- + +## What This Plan Does NOT Do + +- **No code refactoring.** Files move as-is. Business logic stays the same. +- **No service consolidation.** Services stay in `server/services/` untouched. +- **No Meteor method removal.** Methods move to `server/meteor-methods//` but continue to work. +- **No new abstractions.** No port interfaces, no dependency injection, no new TypeScript patterns. +- **No reorganization of existing `server/` files.** Everything already in `server/` stays in place. Domain subfolders are additive. + +--- + +## After the Migration + +Once all files are in `server/`, the following improvements become possible (but are separate work): + +1. **Move business logic from `lib/` domain folders into `services/`** — the service layer becomes the single source of truth +2. **Delete Meteor methods** — the `server/meteor-methods/` directory can be emptied feature by feature +3. **Delete publications** — `server/publications/` can be emptied as DDP is removed +4. **Add `index.ts` exports** to each `lib//` for a clean public API +5. **Add ESLint layer rules** — e.g., `methods/` cannot import from `api/`, `lib/` domain folders cannot import from `methods/` +6. **Reorganize `server/lib/`** into a cleaner structure if needed (it will have grown with domain functions, auth-providers, messaging, notifications, etc.) diff --git a/apps/meteor/scripts/migration/move-batch.mjs b/apps/meteor/scripts/migration/move-batch.mjs new file mode 100644 index 0000000000000..2970caebcb621 --- /dev/null +++ b/apps/meteor/scripts/migration/move-batch.mjs @@ -0,0 +1,78 @@ +#!/usr/bin/env node + +/** + * Disposable migration script: moves multiple modules from a TSV manifest. + * + * Usage: + * node move-batch.mjs + * + * Manifest format (TSV, one pair per line): + * app/slashcommands-ban/server server/slashcommands/ban + * app/slashcommands-kick/server server/slashcommands/kick + * + * After all moves, runs `yarn lint --quiet` to verify no imports broke. + */ + +import { execFileSync, execSync } from 'node:child_process'; +import fs from 'node:fs'; +import path from 'node:path'; + +const ROOT = path.resolve(import.meta.dirname, '../..'); +const manifestPath = process.argv[2]; + +if (!manifestPath) { + console.error('Usage: node move-batch.mjs '); + process.exit(1); +} + +const manifest = fs + .readFileSync(manifestPath, 'utf8') + .split('\n') + .map((line) => line.trim()) + .filter((line) => line && !line.startsWith('#')); + +console.log(`Processing ${manifest.length} entries from ${manifestPath}\n`); + +let failed = 0; + +for (const line of manifest) { + const [fromDir, toDir] = line.split('\t').map((s) => s.trim()); + if (!fromDir || !toDir) { + console.error(`Skipping malformed line: ${line}`); + failed++; + continue; + } + + try { + const scriptPath = path.join(import.meta.dirname, 'move-module.mjs'); + execFileSync(process.execPath, [scriptPath, '--from', fromDir, '--to', toDir], { + cwd: ROOT, + stdio: 'inherit', + }); + } catch (err) { + console.error(`FAILED: ${fromDir} → ${toDir}`); + console.error(err.message); + failed++; + } +} + +console.log(`\n${'─'.repeat(60)}`); +console.log(`Batch complete. ${manifest.length - failed}/${manifest.length} succeeded.`); + +if (failed > 0) { + console.error(`${failed} entries failed.`); + process.exit(1); +} + +// Verify no imports broke. `yarn lint --quiet` is the authoritative check for +// unresolved imports (see MIGRATION_PLAN.md); `--quiet` hides warnings so +// import errors stand out. tsc is avoided here because it also surfaces +// pre-existing, unrelated type errors. +console.log('\nRunning yarn lint --quiet to verify...'); +try { + execSync('yarn lint --quiet', { cwd: ROOT, stdio: 'inherit', timeout: 300_000 }); + console.log('Lint check passed.'); +} catch { + console.error('Lint check FAILED. Fix the errors above before committing.'); + process.exit(1); +} diff --git a/apps/meteor/scripts/migration/move-module.mjs b/apps/meteor/scripts/migration/move-module.mjs new file mode 100644 index 0000000000000..fec78710cc06a --- /dev/null +++ b/apps/meteor/scripts/migration/move-module.mjs @@ -0,0 +1,311 @@ +#!/usr/bin/env node + +/** + * Disposable migration script: moves a module directory and updates all imports. + * + * Usage: + * node move-module.mjs --from app/slashcommands-ban/server --to server/slashcommands/ban + * + * All paths are relative to the Meteor app root (apps/meteor/). + * + * What it does: + * 1. git mv every file from to + * 2. Update relative imports WITHIN moved files (their position in the tree changed) + * 3. Update relative imports in OTHER files that referenced the moved module + */ + +import { execFileSync } from 'node:child_process'; +import fs from 'node:fs'; +import path from 'node:path'; + +// ── CLI args ───────────────────────────────────────────────────────────────── + +const args = process.argv.slice(2); +const fromIdx = args.indexOf('--from'); +const toIdx = args.indexOf('--to'); + +if (fromIdx === -1 || toIdx === -1 || !args[fromIdx + 1] || !args[toIdx + 1]) { + console.error('Usage: node move-module.mjs --from --to '); + console.error('Paths are relative to apps/meteor/'); + process.exit(1); +} + +const ROOT = path.resolve(import.meta.dirname, '../..'); +const fromRel = args[fromIdx + 1]; +const toRel = args[toIdx + 1]; +const fromAbs = path.resolve(ROOT, fromRel); +const toAbs = path.resolve(ROOT, toRel); + +const dryRun = args.includes('--dry-run'); + +if (!fs.existsSync(fromAbs)) { + console.error(`Source directory does not exist: ${fromAbs}`); + process.exit(1); +} + +// ── Helpers ────────────────────────────────────────────────────────────────── + +function getAllFiles(dir, exts = ['.ts', '.js', '.tsx', '.jsx']) { + const results = []; + if (!fs.existsSync(dir)) return results; + for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { + const full = path.join(dir, entry.name); + if (entry.isDirectory()) { + results.push(...getAllFiles(full, exts)); + } else if (exts.some((ext) => entry.name.endsWith(ext))) { + results.push(full); + } + } + return results; +} + +/** + * Given a file at `fromFile` that has `import ... from ''`, + * resolve that specifier to an absolute filesystem path. + * Returns null if it's not a relative import or can't be resolved. + */ +function resolveImportSpecifier(fromFile, specifier) { + if (!specifier.startsWith('.')) return null; // skip package imports + const dir = path.dirname(fromFile); + const resolved = path.resolve(dir, specifier); + // Try to find the actual file (could be .ts, /index.ts, etc.) + for (const candidate of [ + `${resolved}.ts`, + `${resolved}.tsx`, + `${resolved}.js`, + `${resolved}.jsx`, + path.join(resolved, 'index.ts'), + path.join(resolved, 'index.js'), + resolved, // exact match (rare) + ]) { + if (fs.existsSync(candidate)) return candidate; + } + // Return the resolved path even if we can't find the file + // (it might have been moved already) + return resolved; +} + +/** + * Compute a relative import specifier from `fromFile` to `targetAbs`. + * Strips extensions and /index suffix to match TypeScript conventions. + */ +function computeRelativeSpecifier(fromFile, targetAbs) { + const fromDir = path.dirname(fromFile); + let rel = path.relative(fromDir, targetAbs); + // Remove file extensions + rel = rel.replace(/\.(ts|tsx|js|jsx)$/, ''); + // Remove /index suffix + rel = rel.replace(/\/index$/, ''); + // Ensure it starts with ./ or ../ + if (!rel.startsWith('.')) { + rel = `./${rel}`; + } + return rel; +} + +// Regex to match import specifiers. Covers static `import x from 'y'`, +// re-exports `export { x } from 'y'`, bare `import 'y'`, dynamic `import('y')`, +// and CommonJS `require('y')`. +const IMPORT_RE = /(?:from\s+|import\s+|(?:import|require)\s*\(\s*)(['"])([^'"]+)\1/g; + +/** + * Update all relative imports in a file based on its old and new positions. + * `movedFiles` is a Map of all files being moved + * in the same operation, so we can resolve imports to co-moved siblings. + */ +function updateImportsInFile(filePath, oldFilePath, movedFiles = new Map()) { + let content = fs.readFileSync(filePath, 'utf8'); + let changed = false; + + content = content.replace(IMPORT_RE, (match, quote, specifier) => { + if (!specifier.startsWith('.')) return match; // skip package imports + + // Resolve the specifier relative to the OLD file location + let absoluteTarget = resolveImportSpecifier(oldFilePath, specifier); + if (!absoluteTarget) return match; + + // If the target also moved (sibling file in same module), use its new location + for (const [oldPath, newPath] of movedFiles) { + const oldNoExt = oldPath.replace(/\.(ts|tsx|js|jsx)$/, ''); + // Check exact match or match stripping extension + if (absoluteTarget === oldPath || absoluteTarget === oldNoExt) { + absoluteTarget = newPath; + break; + } + // Only treat as "inside a moved index dir" with a proper separator boundary + if (absoluteTarget.startsWith(oldNoExt + path.sep)) { + absoluteTarget = newPath + absoluteTarget.slice(oldPath.length); + break; + } + } + + // Compute new relative specifier from the NEW file location + const newSpecifier = computeRelativeSpecifier(filePath, absoluteTarget); + + if (newSpecifier !== specifier) { + changed = true; + return match.replace(specifier, newSpecifier); + } + return match; + }); + + if (changed) { + fs.writeFileSync(filePath, content, 'utf8'); + } + return changed; +} + +/** + * Check if a file imports from any path within the given directory. + * Returns the matched import specifiers. + */ +function findImportsFrom(filePath, targetDirAbs) { + const content = fs.readFileSync(filePath, 'utf8'); + const matches = []; + let m; + const re = new RegExp(IMPORT_RE.source, 'g'); + while ((m = re.exec(content)) !== null) { + const specifier = m[2]; + if (!specifier.startsWith('.')) continue; + const resolved = resolveImportSpecifier(filePath, specifier); + if (resolved && (resolved === targetDirAbs || resolved.startsWith(targetDirAbs + path.sep))) { + matches.push({ specifier, resolved }); + } + } + return matches; +} + +/** + * Update imports in external files that reference the moved directory. + */ +function updateExternalImports(externalFile, oldDirAbs, newDirAbs) { + let content = fs.readFileSync(externalFile, 'utf8'); + let changed = false; + + content = content.replace(IMPORT_RE, (match, quote, specifier) => { + if (!specifier.startsWith('.')) return match; + + const resolved = resolveImportSpecifier(externalFile, specifier); + if (!resolved) return match; + const insideOldDir = resolved === oldDirAbs || resolved.startsWith(oldDirAbs + path.sep); + if (!insideOldDir) return match; + + // Map the old absolute path to the new absolute path + const relativeToDirOld = path.relative(oldDirAbs, resolved); + const newAbsolute = path.join(newDirAbs, relativeToDirOld); + + const newSpecifier = computeRelativeSpecifier(externalFile, newAbsolute); + if (newSpecifier !== specifier) { + changed = true; + return match.replace(specifier, newSpecifier); + } + return match; + }); + + if (changed) { + fs.writeFileSync(externalFile, content, 'utf8'); + } + return changed; +} + +// ── Main ───────────────────────────────────────────────────────────────────── + +console.log(`Moving: ${fromRel} → ${toRel}`); + +// 1. Collect files to move +const filesToMove = getAllFiles(fromAbs); +if (filesToMove.length === 0) { + console.error('No .ts/.js files found in source directory'); + process.exit(1); +} +console.log(` Found ${filesToMove.length} files to move`); + +// 2. Build the old→new path mapping +const pathMap = new Map(); // oldAbsPath → newAbsPath +for (const oldFile of filesToMove) { + const relToFrom = path.relative(fromAbs, oldFile); + const newFile = path.join(toAbs, relToFrom); + pathMap.set(oldFile, newFile); +} + +// 3. Find external files that import from the old directory +console.log(' Scanning for external files that import from the moved module...'); +const searchDirs = [path.join(ROOT, 'app'), path.join(ROOT, 'server'), path.join(ROOT, 'ee'), path.join(ROOT, 'lib')]; +const externalFiles = []; +for (const dir of searchDirs) { + if (fs.existsSync(dir)) { + externalFiles.push(...getAllFiles(dir)); + } +} + +const affectedExternalFiles = []; +for (const ext of externalFiles) { + if (ext.startsWith(fromAbs)) continue; // skip files being moved + const imports = findImportsFrom(ext, fromAbs); + if (imports.length > 0) { + affectedExternalFiles.push(ext); + } +} +if (affectedExternalFiles.length > 0) { + console.log(` Found ${affectedExternalFiles.length} external files with imports to update`); +} + +// 4. Move files with git mv +if (!dryRun) { + fs.mkdirSync(toAbs, { recursive: true }); + + // Create subdirectories + for (const [, newFile] of pathMap) { + fs.mkdirSync(path.dirname(newFile), { recursive: true }); + } + + for (const [oldFile, newFile] of pathMap) { + execFileSync('git', ['mv', oldFile, newFile], { cwd: ROOT, stdio: 'pipe' }); + } + console.log(` Moved ${pathMap.size} files`); +} else { + console.log(' [DRY RUN] Would move:'); + for (const [oldFile, newFile] of pathMap) { + console.log(` ${path.relative(ROOT, oldFile)} → ${path.relative(ROOT, newFile)}`); + } +} + +// 5. Update imports WITHIN moved files +if (!dryRun) { + let updatedCount = 0; + for (const [oldFile, newFile] of pathMap) { + if (updateImportsInFile(newFile, oldFile, pathMap)) { + updatedCount++; + } + } + console.log(` Updated imports in ${updatedCount} moved files`); +} + +// 6. Update imports in external files +if (!dryRun) { + let updatedExternal = 0; + for (const ext of affectedExternalFiles) { + if (updateExternalImports(ext, fromAbs, toAbs)) { + updatedExternal++; + } + } + if (updatedExternal > 0) { + console.log(` Updated imports in ${updatedExternal} external files`); + } +} + +// 7. Clean up empty source directory +if (!dryRun) { + // Remove the now-empty source directory (if it's truly empty after git mv) + try { + const remaining = fs.readdirSync(fromAbs); + if (remaining.length === 0) { + fs.rmdirSync(fromAbs); + console.log(` Removed empty directory: ${fromRel}`); + } + } catch { + // Directory might already be gone + } +} + +console.log('Done.\n'); diff --git a/apps/meteor/scripts/migration/phase1-commands.tsv b/apps/meteor/scripts/migration/phase1-commands.tsv new file mode 100644 index 0000000000000..9dd53cc2bf36a --- /dev/null +++ b/apps/meteor/scripts/migration/phase1-commands.tsv @@ -0,0 +1,20 @@ +# Phase 1: Slash commands migration +# Format: old-pathnew-path (relative to apps/meteor/) +app/slashcommand-asciiarts/server server/slashcommands/asciiarts +app/slashcommands-archiveroom/server server/slashcommands/archiveroom +app/slashcommands-ban/server server/slashcommands/ban +app/slashcommands-create/server server/slashcommands/create +app/slashcommands-help/server server/slashcommands/help +app/slashcommands-hide/server server/slashcommands/hide +app/slashcommands-invite/server server/slashcommands/invite +app/slashcommands-inviteall/server server/slashcommands/inviteall +app/slashcommands-join/server server/slashcommands/join +app/slashcommands-kick/server server/slashcommands/kick +app/slashcommands-leave/server server/slashcommands/leave +app/slashcommands-me/server server/slashcommands/me +app/slashcommands-msg/server server/slashcommands/msg +app/slashcommands-mute/server server/slashcommands/mute +app/slashcommands-status/server server/slashcommands/status +app/slashcommands-topic/server server/slashcommands/topic +app/slashcommands-unarchiveroom/server server/slashcommands/unarchiveroom +app/bot-helpers/server server/lib/bot-helpers diff --git a/apps/meteor/scripts/migration/verify-no-old-imports.mjs b/apps/meteor/scripts/migration/verify-no-old-imports.mjs new file mode 100644 index 0000000000000..7a1b6909f0193 --- /dev/null +++ b/apps/meteor/scripts/migration/verify-no-old-imports.mjs @@ -0,0 +1,78 @@ +#!/usr/bin/env node + +/** + * Disposable verification script: checks that no imports still reference + * old paths that should have been updated during migration. + * + * Usage: + * node verify-no-old-imports.mjs ... + * + * Example: + * node verify-no-old-imports.mjs "app/slashcommand" "app/bot-helpers/server" + * + * Scans all .ts/.js files under apps/meteor/ for import statements + * containing the given patterns and reports any matches. + */ + +import fs from 'node:fs'; +import path from 'node:path'; + +const ROOT = path.resolve(import.meta.dirname, '../..'); +const patterns = process.argv.slice(2); + +if (patterns.length === 0) { + console.error('Usage: node verify-no-old-imports.mjs ...'); + console.error('Example: node verify-no-old-imports.mjs "app/slashcommand" "app/bot-helpers/server"'); + process.exit(1); +} + +function getAllFiles(dir, exts = ['.ts', '.js', '.tsx', '.jsx']) { + const results = []; + if (!fs.existsSync(dir)) return results; + for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { + const full = path.join(dir, entry.name); + if (entry.isDirectory() && entry.name !== 'node_modules' && entry.name !== '.meteor') { + results.push(...getAllFiles(full, exts)); + } else if (exts.some((ext) => entry.name.endsWith(ext))) { + results.push(full); + } + } + return results; +} + +// Matches static imports/re-exports, bare imports, dynamic import(), and require(). +const IMPORT_RE = /(?:from\s+|import\s+|(?:import|require)\s*\(\s*)(['"])([^'"]+)\1/g; + +const searchDirs = [path.join(ROOT, 'app'), path.join(ROOT, 'server'), path.join(ROOT, 'ee'), path.join(ROOT, 'lib')]; + +let violations = 0; + +for (const dir of searchDirs) { + const files = getAllFiles(dir); + for (const file of files) { + const content = fs.readFileSync(file, 'utf8'); + const lines = content.split('\n'); + for (let i = 0; i < lines.length; i++) { + const line = lines[i]; + let m; + const re = new RegExp(IMPORT_RE.source, 'g'); + while ((m = re.exec(line)) !== null) { + const specifier = m[2]; + for (const pattern of patterns) { + if (specifier.includes(pattern)) { + const relPath = path.relative(ROOT, file); + console.log(` ${relPath}:${i + 1} → ${specifier}`); + violations++; + } + } + } + } + } +} + +if (violations === 0) { + console.log(`No imports found matching patterns: ${patterns.join(', ')}`); +} else { + console.error(`\nFound ${violations} import(s) still referencing old paths.`); + process.exit(1); +} diff --git a/apps/meteor/server/importPackages.ts b/apps/meteor/server/importPackages.ts index 645ff19932e0a..d165ae56ba60a 100644 --- a/apps/meteor/server/importPackages.ts +++ b/apps/meteor/server/importPackages.ts @@ -5,7 +5,7 @@ import '../app/apple/server'; import '../app/assets/server'; import '../app/authorization/server'; import '../app/autotranslate/server'; -import '../app/bot-helpers/server'; +import './lib/bot-helpers'; import '../app/channel-settings/server'; import '../app/cloud/server'; import '../app/crowd/server'; @@ -45,23 +45,23 @@ import '../app/oauth2-server-config/server'; import '../app/push-notifications/server'; import '../app/retention-policy/server'; import '../app/slackbridge/server'; -import '../app/slashcommands-archiveroom/server'; -import '../app/slashcommand-asciiarts/server'; -import '../app/slashcommands-ban/server'; -import '../app/slashcommands-create/server'; -import '../app/slashcommands-help/server'; -import '../app/slashcommands-hide/server'; -import '../app/slashcommands-invite/server'; -import '../app/slashcommands-inviteall/server'; -import '../app/slashcommands-join/server'; -import '../app/slashcommands-kick/server'; -import '../app/slashcommands-leave/server'; -import '../app/slashcommands-me/server'; -import '../app/slashcommands-msg/server'; -import '../app/slashcommands-mute/server'; -import '../app/slashcommands-status/server'; -import '../app/slashcommands-topic/server'; -import '../app/slashcommands-unarchiveroom/server'; +import './slashcommands/archiveroom'; +import './slashcommands/asciiarts'; +import './slashcommands/ban'; +import './slashcommands/create'; +import './slashcommands/help'; +import './slashcommands/hide'; +import './slashcommands/invite'; +import './slashcommands/inviteall'; +import './slashcommands/join'; +import './slashcommands/kick'; +import './slashcommands/leave'; +import './slashcommands/me'; +import './slashcommands/msg'; +import './slashcommands/mute'; +import './slashcommands/status'; +import './slashcommands/topic'; +import './slashcommands/unarchiveroom'; import '../app/smarsh-connector/server'; import '../app/theme/server'; import '../app/threads/server'; diff --git a/apps/meteor/app/bot-helpers/README.md b/apps/meteor/server/lib/bot-helpers/README.md similarity index 100% rename from apps/meteor/app/bot-helpers/README.md rename to apps/meteor/server/lib/bot-helpers/README.md diff --git a/apps/meteor/app/bot-helpers/server/index.ts b/apps/meteor/server/lib/bot-helpers/index.ts similarity index 92% rename from apps/meteor/app/bot-helpers/server/index.ts rename to apps/meteor/server/lib/bot-helpers/index.ts index 6db9cc24c6b4b..bae2e8ef600e1 100644 --- a/apps/meteor/app/bot-helpers/server/index.ts +++ b/apps/meteor/server/lib/bot-helpers/index.ts @@ -5,12 +5,12 @@ import { Rooms, Users } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; import type { Filter, FindCursor } from 'mongodb'; -import { removeUserFromRoomMethod } from '../../../server/methods/removeUserFromRoom'; -import { hasRoleAsync } from '../../authorization/server/functions/hasRole'; -import { addUserToRole } from '../../authorization/server/methods/addUserToRole'; -import { removeUserFromRole } from '../../authorization/server/methods/removeUserFromRole'; -import { addUsersToRoomMethod } from '../../lib/server/methods/addUsersToRoom'; -import { settings } from '../../settings/server'; +import { hasRoleAsync } from '../../../app/authorization/server/functions/hasRole'; +import { addUserToRole } from '../../../app/authorization/server/methods/addUserToRole'; +import { removeUserFromRole } from '../../../app/authorization/server/methods/removeUserFromRole'; +import { addUsersToRoomMethod } from '../../../app/lib/server/methods/addUsersToRoom'; +import { settings } from '../../../app/settings/server'; +import { removeUserFromRoomMethod } from '../../methods/removeUserFromRoom'; /** * BotHelpers helps bots diff --git a/apps/meteor/app/slashcommands-archiveroom/server/index.ts b/apps/meteor/server/slashcommands/archiveroom/index.ts similarity index 100% rename from apps/meteor/app/slashcommands-archiveroom/server/index.ts rename to apps/meteor/server/slashcommands/archiveroom/index.ts diff --git a/apps/meteor/app/slashcommands-archiveroom/server/server.ts b/apps/meteor/server/slashcommands/archiveroom/server.ts similarity index 84% rename from apps/meteor/app/slashcommands-archiveroom/server/server.ts rename to apps/meteor/server/slashcommands/archiveroom/server.ts index f1b33c1022bb6..28f11b0c30d28 100644 --- a/apps/meteor/app/slashcommands-archiveroom/server/server.ts +++ b/apps/meteor/server/slashcommands/archiveroom/server.ts @@ -4,13 +4,13 @@ import { isRegisterUser } from '@rocket.chat/core-typings'; import { Users, Rooms } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; +import { hasPermissionAsync } from '../../../app/authorization/server/functions/hasPermission'; +import { archiveRoom } from '../../../app/lib/server/functions/archiveRoom'; +import { settings } from '../../../app/settings/server'; +import { slashCommands } from '../../../app/utils/server/slashCommand'; import { RoomMemberActions } from '../../../definition/IRoomTypeConfig'; -import { i18n } from '../../../server/lib/i18n'; -import { roomCoordinator } from '../../../server/lib/rooms/roomCoordinator'; -import { hasPermissionAsync } from '../../authorization/server/functions/hasPermission'; -import { archiveRoom } from '../../lib/server/functions/archiveRoom'; -import { settings } from '../../settings/server'; -import { slashCommands } from '../../utils/server/slashCommand'; +import { i18n } from '../../lib/i18n'; +import { roomCoordinator } from '../../lib/rooms/roomCoordinator'; slashCommands.add({ command: 'archive', diff --git a/apps/meteor/app/slashcommand-asciiarts/server/gimme.ts b/apps/meteor/server/slashcommands/asciiarts/gimme.ts similarity index 79% rename from apps/meteor/app/slashcommand-asciiarts/server/gimme.ts rename to apps/meteor/server/slashcommands/asciiarts/gimme.ts index f902d75f33d1d..fb6ac359facdf 100644 --- a/apps/meteor/app/slashcommand-asciiarts/server/gimme.ts +++ b/apps/meteor/server/slashcommands/asciiarts/gimme.ts @@ -1,7 +1,7 @@ import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; -import { executeSendMessage } from '../../lib/server/methods/sendMessage'; -import { slashCommands } from '../../utils/server/slashCommand'; +import { executeSendMessage } from '../../../app/lib/server/methods/sendMessage'; +import { slashCommands } from '../../../app/utils/server/slashCommand'; /* * Gimme is a named function that will replace /gimme commands * @param {Object} message - The message object diff --git a/apps/meteor/app/slashcommand-asciiarts/server/index.ts b/apps/meteor/server/slashcommands/asciiarts/index.ts similarity index 100% rename from apps/meteor/app/slashcommand-asciiarts/server/index.ts rename to apps/meteor/server/slashcommands/asciiarts/index.ts diff --git a/apps/meteor/app/slashcommand-asciiarts/server/lenny.ts b/apps/meteor/server/slashcommands/asciiarts/lenny.ts similarity index 79% rename from apps/meteor/app/slashcommand-asciiarts/server/lenny.ts rename to apps/meteor/server/slashcommands/asciiarts/lenny.ts index e760b5a1169e6..54854ff631168 100644 --- a/apps/meteor/app/slashcommand-asciiarts/server/lenny.ts +++ b/apps/meteor/server/slashcommands/asciiarts/lenny.ts @@ -1,7 +1,7 @@ import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; -import { executeSendMessage } from '../../lib/server/methods/sendMessage'; -import { slashCommands } from '../../utils/server/slashCommand'; +import { executeSendMessage } from '../../../app/lib/server/methods/sendMessage'; +import { slashCommands } from '../../../app/utils/server/slashCommand'; /* * Lenny is a named function that will replace /lenny commands * @param {Object} message - The message object diff --git a/apps/meteor/app/slashcommand-asciiarts/server/shrug.ts b/apps/meteor/server/slashcommands/asciiarts/shrug.ts similarity index 78% rename from apps/meteor/app/slashcommand-asciiarts/server/shrug.ts rename to apps/meteor/server/slashcommands/asciiarts/shrug.ts index c2e5d166bfd83..9621bf5611fba 100644 --- a/apps/meteor/app/slashcommand-asciiarts/server/shrug.ts +++ b/apps/meteor/server/slashcommands/asciiarts/shrug.ts @@ -1,7 +1,7 @@ import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; -import { executeSendMessage } from '../../lib/server/methods/sendMessage'; -import { slashCommands } from '../../utils/server/slashCommand'; +import { executeSendMessage } from '../../../app/lib/server/methods/sendMessage'; +import { slashCommands } from '../../../app/utils/server/slashCommand'; /* * Shrug is a named function that will replace /shrug commands * @param {Object} message - The message object diff --git a/apps/meteor/app/slashcommand-asciiarts/server/tableflip.ts b/apps/meteor/server/slashcommands/asciiarts/tableflip.ts similarity index 79% rename from apps/meteor/app/slashcommand-asciiarts/server/tableflip.ts rename to apps/meteor/server/slashcommands/asciiarts/tableflip.ts index ac3f599dff1d6..0020feec75eff 100644 --- a/apps/meteor/app/slashcommand-asciiarts/server/tableflip.ts +++ b/apps/meteor/server/slashcommands/asciiarts/tableflip.ts @@ -1,7 +1,7 @@ import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; -import { executeSendMessage } from '../../lib/server/methods/sendMessage'; -import { slashCommands } from '../../utils/server/slashCommand'; +import { executeSendMessage } from '../../../app/lib/server/methods/sendMessage'; +import { slashCommands } from '../../../app/utils/server/slashCommand'; /* * Tableflip is a named function that will replace /Tableflip commands * @param {Object} message - The message object diff --git a/apps/meteor/app/slashcommand-asciiarts/server/unflip.ts b/apps/meteor/server/slashcommands/asciiarts/unflip.ts similarity index 79% rename from apps/meteor/app/slashcommand-asciiarts/server/unflip.ts rename to apps/meteor/server/slashcommands/asciiarts/unflip.ts index b905ed5674478..774274a5ef5a9 100644 --- a/apps/meteor/app/slashcommand-asciiarts/server/unflip.ts +++ b/apps/meteor/server/slashcommands/asciiarts/unflip.ts @@ -1,7 +1,7 @@ import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; -import { executeSendMessage } from '../../lib/server/methods/sendMessage'; -import { slashCommands } from '../../utils/server/slashCommand'; +import { executeSendMessage } from '../../../app/lib/server/methods/sendMessage'; +import { slashCommands } from '../../../app/utils/server/slashCommand'; /* * Unflip is a named function that will replace /unflip commands * @param {Object} message - The message object diff --git a/apps/meteor/app/slashcommands-ban/server/ban.ts b/apps/meteor/server/slashcommands/ban/ban.ts similarity index 74% rename from apps/meteor/app/slashcommands-ban/server/ban.ts rename to apps/meteor/server/slashcommands/ban/ban.ts index 3ca43a3b5f4db..362796b270830 100644 --- a/apps/meteor/app/slashcommands-ban/server/ban.ts +++ b/apps/meteor/server/slashcommands/ban/ban.ts @@ -2,11 +2,11 @@ import { api } from '@rocket.chat/core-services'; import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; -import { banUserFromRoomMethod } from '../../../server/lib/banUserFromRoom'; -import { i18n } from '../../../server/lib/i18n'; -import { sanitizeUsername } from '../../lib/server/methods/addUsersToRoom'; -import { settings } from '../../settings/server'; -import { slashCommands } from '../../utils/server/slashCommand'; +import { sanitizeUsername } from '../../../app/lib/server/methods/addUsersToRoom'; +import { settings } from '../../../app/settings/server'; +import { slashCommands } from '../../../app/utils/server/slashCommand'; +import { banUserFromRoomMethod } from '../../lib/banUserFromRoom'; +import { i18n } from '../../lib/i18n'; slashCommands.add({ command: 'ban', diff --git a/apps/meteor/app/slashcommands-ban/server/index.ts b/apps/meteor/server/slashcommands/ban/index.ts similarity index 100% rename from apps/meteor/app/slashcommands-ban/server/index.ts rename to apps/meteor/server/slashcommands/ban/index.ts diff --git a/apps/meteor/app/slashcommands-ban/server/unban.ts b/apps/meteor/server/slashcommands/ban/unban.ts similarity index 74% rename from apps/meteor/app/slashcommands-ban/server/unban.ts rename to apps/meteor/server/slashcommands/ban/unban.ts index 4cb52047b651f..1c6cd262125d8 100644 --- a/apps/meteor/app/slashcommands-ban/server/unban.ts +++ b/apps/meteor/server/slashcommands/ban/unban.ts @@ -2,11 +2,11 @@ import { api } from '@rocket.chat/core-services'; import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; -import { i18n } from '../../../server/lib/i18n'; -import { unbanUserFromRoom } from '../../../server/lib/unbanUserFromRoom'; -import { sanitizeUsername } from '../../lib/server/methods/addUsersToRoom'; -import { settings } from '../../settings/server'; -import { slashCommands } from '../../utils/server/slashCommand'; +import { sanitizeUsername } from '../../../app/lib/server/methods/addUsersToRoom'; +import { settings } from '../../../app/settings/server'; +import { slashCommands } from '../../../app/utils/server/slashCommand'; +import { i18n } from '../../lib/i18n'; +import { unbanUserFromRoom } from '../../lib/unbanUserFromRoom'; slashCommands.add({ command: 'unban', diff --git a/apps/meteor/app/slashcommands-create/server/index.ts b/apps/meteor/server/slashcommands/create/index.ts similarity index 100% rename from apps/meteor/app/slashcommands-create/server/index.ts rename to apps/meteor/server/slashcommands/create/index.ts diff --git a/apps/meteor/app/slashcommands-create/server/server.ts b/apps/meteor/server/slashcommands/create/server.ts similarity index 82% rename from apps/meteor/app/slashcommands-create/server/server.ts rename to apps/meteor/server/slashcommands/create/server.ts index 6abee71c56fdd..77565602cd120 100644 --- a/apps/meteor/app/slashcommands-create/server/server.ts +++ b/apps/meteor/server/slashcommands/create/server.ts @@ -2,11 +2,11 @@ import { api } from '@rocket.chat/core-services'; import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; import { Rooms, Users } from '@rocket.chat/models'; -import { i18n } from '../../../server/lib/i18n'; -import { createChannelMethod } from '../../lib/server/methods/createChannel'; -import { createPrivateGroupMethod } from '../../lib/server/methods/createPrivateGroup'; -import { settings } from '../../settings/server'; -import { slashCommands } from '../../utils/server/slashCommand'; +import { createChannelMethod } from '../../../app/lib/server/methods/createChannel'; +import { createPrivateGroupMethod } from '../../../app/lib/server/methods/createPrivateGroup'; +import { settings } from '../../../app/settings/server'; +import { slashCommands } from '../../../app/utils/server/slashCommand'; +import { i18n } from '../../lib/i18n'; slashCommands.add({ command: 'create', diff --git a/apps/meteor/app/slashcommands-help/server/index.ts b/apps/meteor/server/slashcommands/help/index.ts similarity index 100% rename from apps/meteor/app/slashcommands-help/server/index.ts rename to apps/meteor/server/slashcommands/help/index.ts diff --git a/apps/meteor/app/slashcommands-help/server/server.ts b/apps/meteor/server/slashcommands/help/server.ts similarity index 90% rename from apps/meteor/app/slashcommands-help/server/server.ts rename to apps/meteor/server/slashcommands/help/server.ts index 4d826996b43f6..28bffbcfa8509 100644 --- a/apps/meteor/app/slashcommands-help/server/server.ts +++ b/apps/meteor/server/slashcommands/help/server.ts @@ -2,9 +2,9 @@ import { api } from '@rocket.chat/core-services'; import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; -import { i18n } from '../../../server/lib/i18n'; -import { settings } from '../../settings/server'; -import { slashCommands } from '../../utils/server/slashCommand'; +import { settings } from '../../../app/settings/server'; +import { slashCommands } from '../../../app/utils/server/slashCommand'; +import { i18n } from '../../lib/i18n'; /* * Help is a named function that will replace /help commands diff --git a/apps/meteor/app/slashcommands-hide/server/hide.ts b/apps/meteor/server/slashcommands/hide/hide.ts similarity index 89% rename from apps/meteor/app/slashcommands-hide/server/hide.ts rename to apps/meteor/server/slashcommands/hide/hide.ts index 636974297914e..8f1b6b3393543 100644 --- a/apps/meteor/app/slashcommands-hide/server/hide.ts +++ b/apps/meteor/server/slashcommands/hide/hide.ts @@ -2,10 +2,10 @@ import { api } from '@rocket.chat/core-services'; import type { IRoom, SlashCommandCallbackParams } from '@rocket.chat/core-typings'; import { Rooms, Subscriptions, Users } from '@rocket.chat/models'; -import { i18n } from '../../../server/lib/i18n'; -import { hideRoomMethod } from '../../../server/methods/hideRoom'; -import { settings } from '../../settings/server'; -import { slashCommands } from '../../utils/server/slashCommand'; +import { settings } from '../../../app/settings/server'; +import { slashCommands } from '../../../app/utils/server/slashCommand'; +import { i18n } from '../../lib/i18n'; +import { hideRoomMethod } from '../../methods/hideRoom'; /* * Hide is a named function that will replace /hide commands diff --git a/apps/meteor/app/slashcommands-hide/server/index.ts b/apps/meteor/server/slashcommands/hide/index.ts similarity index 100% rename from apps/meteor/app/slashcommands-hide/server/index.ts rename to apps/meteor/server/slashcommands/hide/index.ts diff --git a/apps/meteor/app/slashcommands-invite/server/index.ts b/apps/meteor/server/slashcommands/invite/index.ts similarity index 100% rename from apps/meteor/app/slashcommands-invite/server/index.ts rename to apps/meteor/server/slashcommands/invite/index.ts diff --git a/apps/meteor/app/slashcommands-invite/server/server.ts b/apps/meteor/server/slashcommands/invite/server.ts similarity index 93% rename from apps/meteor/app/slashcommands-invite/server/server.ts rename to apps/meteor/server/slashcommands/invite/server.ts index 9fd22b7b54ce5..b483c527028e9 100644 --- a/apps/meteor/app/slashcommands-invite/server/server.ts +++ b/apps/meteor/server/slashcommands/invite/server.ts @@ -5,11 +5,11 @@ import { validateFederatedUsername } from '@rocket.chat/federation-matrix'; import { Subscriptions, Users, Rooms } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { i18n } from '../../../server/lib/i18n'; -import { FederationActions } from '../../../server/services/room/hooks/BeforeFederationActions'; -import { addUsersToRoomMethod, sanitizeUsername } from '../../lib/server/methods/addUsersToRoom'; -import { settings } from '../../settings/server'; -import { slashCommands } from '../../utils/server/slashCommand'; +import { addUsersToRoomMethod, sanitizeUsername } from '../../../app/lib/server/methods/addUsersToRoom'; +import { settings } from '../../../app/settings/server'; +import { slashCommands } from '../../../app/utils/server/slashCommand'; +import { i18n } from '../../lib/i18n'; +import { FederationActions } from '../../services/room/hooks/BeforeFederationActions'; // Type guards for the error function isStringError(error: unknown): error is { error: string } { diff --git a/apps/meteor/app/slashcommands-inviteall/server/index.ts b/apps/meteor/server/slashcommands/inviteall/index.ts similarity index 100% rename from apps/meteor/app/slashcommands-inviteall/server/index.ts rename to apps/meteor/server/slashcommands/inviteall/index.ts diff --git a/apps/meteor/app/slashcommands-inviteall/server/server.ts b/apps/meteor/server/slashcommands/inviteall/server.ts similarity index 87% rename from apps/meteor/app/slashcommands-inviteall/server/server.ts rename to apps/meteor/server/slashcommands/inviteall/server.ts index 0ad7cebe6ecfb..a478779ec165a 100644 --- a/apps/meteor/app/slashcommands-inviteall/server/server.ts +++ b/apps/meteor/server/slashcommands/inviteall/server.ts @@ -9,13 +9,13 @@ import { Rooms, Subscriptions, Users } from '@rocket.chat/models'; import { isTruthy } from '@rocket.chat/tools'; import { Meteor } from 'meteor/meteor'; -import { i18n } from '../../../server/lib/i18n'; -import { canAccessRoomAsync } from '../../authorization/server'; -import { addUsersToRoomMethod } from '../../lib/server/methods/addUsersToRoom'; -import { createChannelMethod } from '../../lib/server/methods/createChannel'; -import { createPrivateGroupMethod } from '../../lib/server/methods/createPrivateGroup'; -import { settings } from '../../settings/server'; -import { slashCommands } from '../../utils/server/slashCommand'; +import { canAccessRoomAsync } from '../../../app/authorization/server'; +import { addUsersToRoomMethod } from '../../../app/lib/server/methods/addUsersToRoom'; +import { createChannelMethod } from '../../../app/lib/server/methods/createChannel'; +import { createPrivateGroupMethod } from '../../../app/lib/server/methods/createPrivateGroup'; +import { settings } from '../../../app/settings/server'; +import { slashCommands } from '../../../app/utils/server/slashCommand'; +import { i18n } from '../../lib/i18n'; function inviteAll(type: T): SlashCommand['callback'] { return async function inviteAll({ command, params, message, userId }: SlashCommandCallbackParams): Promise { diff --git a/apps/meteor/app/slashcommands-join/server/index.ts b/apps/meteor/server/slashcommands/join/index.ts similarity index 100% rename from apps/meteor/app/slashcommands-join/server/index.ts rename to apps/meteor/server/slashcommands/join/index.ts diff --git a/apps/meteor/app/slashcommands-join/server/server.ts b/apps/meteor/server/slashcommands/join/server.ts similarity index 89% rename from apps/meteor/app/slashcommands-join/server/server.ts rename to apps/meteor/server/slashcommands/join/server.ts index 4d7b3fe001f7b..b9d74b21c7913 100644 --- a/apps/meteor/app/slashcommands-join/server/server.ts +++ b/apps/meteor/server/slashcommands/join/server.ts @@ -3,9 +3,9 @@ import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; import { Rooms, Subscriptions, Users } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { i18n } from '../../../server/lib/i18n'; -import { settings } from '../../settings/server'; -import { slashCommands } from '../../utils/server/slashCommand'; +import { settings } from '../../../app/settings/server'; +import { slashCommands } from '../../../app/utils/server/slashCommand'; +import { i18n } from '../../lib/i18n'; slashCommands.add({ command: 'join', diff --git a/apps/meteor/app/slashcommands-kick/server/index.ts b/apps/meteor/server/slashcommands/kick/index.ts similarity index 100% rename from apps/meteor/app/slashcommands-kick/server/index.ts rename to apps/meteor/server/slashcommands/kick/index.ts diff --git a/apps/meteor/app/slashcommands-kick/server/server.ts b/apps/meteor/server/slashcommands/kick/server.ts similarity index 77% rename from apps/meteor/app/slashcommands-kick/server/server.ts rename to apps/meteor/server/slashcommands/kick/server.ts index f29a65a764e7c..9b1098fa61b11 100644 --- a/apps/meteor/app/slashcommands-kick/server/server.ts +++ b/apps/meteor/server/slashcommands/kick/server.ts @@ -3,11 +3,11 @@ import { api } from '@rocket.chat/core-services'; import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; -import { i18n } from '../../../server/lib/i18n'; -import { removeUserFromRoomMethod } from '../../../server/methods/removeUserFromRoom'; -import { sanitizeUsername } from '../../lib/server/methods/addUsersToRoom'; -import { settings } from '../../settings/server'; -import { slashCommands } from '../../utils/server/slashCommand'; +import { sanitizeUsername } from '../../../app/lib/server/methods/addUsersToRoom'; +import { settings } from '../../../app/settings/server'; +import { slashCommands } from '../../../app/utils/server/slashCommand'; +import { i18n } from '../../lib/i18n'; +import { removeUserFromRoomMethod } from '../../methods/removeUserFromRoom'; slashCommands.add({ command: 'kick', diff --git a/apps/meteor/app/slashcommands-leave/server/index.ts b/apps/meteor/server/slashcommands/leave/index.ts similarity index 100% rename from apps/meteor/app/slashcommands-leave/server/index.ts rename to apps/meteor/server/slashcommands/leave/index.ts diff --git a/apps/meteor/app/slashcommands-leave/server/leave.ts b/apps/meteor/server/slashcommands/leave/leave.ts similarity index 83% rename from apps/meteor/app/slashcommands-leave/server/leave.ts rename to apps/meteor/server/slashcommands/leave/leave.ts index 3d86b998b49c8..5575a4e4247ee 100644 --- a/apps/meteor/app/slashcommands-leave/server/leave.ts +++ b/apps/meteor/server/slashcommands/leave/leave.ts @@ -3,10 +3,10 @@ import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { i18n } from '../../../server/lib/i18n'; -import { leaveRoomMethod } from '../../lib/server/methods/leaveRoom'; -import { settings } from '../../settings/server'; -import { slashCommands } from '../../utils/server/slashCommand'; +import { leaveRoomMethod } from '../../../app/lib/server/methods/leaveRoom'; +import { settings } from '../../../app/settings/server'; +import { slashCommands } from '../../../app/utils/server/slashCommand'; +import { i18n } from '../../lib/i18n'; /* * Leave is a named function that will replace /leave commands diff --git a/apps/meteor/app/slashcommands-me/server/index.ts b/apps/meteor/server/slashcommands/me/index.ts similarity index 100% rename from apps/meteor/app/slashcommands-me/server/index.ts rename to apps/meteor/server/slashcommands/me/index.ts diff --git a/apps/meteor/app/slashcommands-me/server/me.ts b/apps/meteor/server/slashcommands/me/me.ts similarity index 78% rename from apps/meteor/app/slashcommands-me/server/me.ts rename to apps/meteor/server/slashcommands/me/me.ts index b8b4a593cb738..f976ba2b4e695 100644 --- a/apps/meteor/app/slashcommands-me/server/me.ts +++ b/apps/meteor/server/slashcommands/me/me.ts @@ -1,7 +1,7 @@ import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; -import { executeSendMessage } from '../../lib/server/methods/sendMessage'; -import { slashCommands } from '../../utils/server/slashCommand'; +import { executeSendMessage } from '../../../app/lib/server/methods/sendMessage'; +import { slashCommands } from '../../../app/utils/server/slashCommand'; /* * Me is a named function that will replace /me commands diff --git a/apps/meteor/app/slashcommands-msg/server/index.ts b/apps/meteor/server/slashcommands/msg/index.ts similarity index 100% rename from apps/meteor/app/slashcommands-msg/server/index.ts rename to apps/meteor/server/slashcommands/msg/index.ts diff --git a/apps/meteor/app/slashcommands-msg/server/server.ts b/apps/meteor/server/slashcommands/msg/server.ts similarity index 84% rename from apps/meteor/app/slashcommands-msg/server/server.ts rename to apps/meteor/server/slashcommands/msg/server.ts index e757938106eb4..9cdd529f23db7 100644 --- a/apps/meteor/app/slashcommands-msg/server/server.ts +++ b/apps/meteor/server/slashcommands/msg/server.ts @@ -3,11 +3,11 @@ import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; import { Random } from '@rocket.chat/random'; -import { i18n } from '../../../server/lib/i18n'; -import { createDirectMessage } from '../../../server/methods/createDirectMessage'; -import { executeSendMessage } from '../../lib/server/methods/sendMessage'; -import { settings } from '../../settings/server'; -import { slashCommands } from '../../utils/server/slashCommand'; +import { executeSendMessage } from '../../../app/lib/server/methods/sendMessage'; +import { settings } from '../../../app/settings/server'; +import { slashCommands } from '../../../app/utils/server/slashCommand'; +import { i18n } from '../../lib/i18n'; +import { createDirectMessage } from '../../methods/createDirectMessage'; /* * Msg is a named function that will replace /msg commands diff --git a/apps/meteor/app/slashcommands-mute/server/index.ts b/apps/meteor/server/slashcommands/mute/index.ts similarity index 100% rename from apps/meteor/app/slashcommands-mute/server/index.ts rename to apps/meteor/server/slashcommands/mute/index.ts diff --git a/apps/meteor/app/slashcommands-mute/server/mute.ts b/apps/meteor/server/slashcommands/mute/mute.ts similarity index 80% rename from apps/meteor/app/slashcommands-mute/server/mute.ts rename to apps/meteor/server/slashcommands/mute/mute.ts index da20ff4fed47f..3274f79e224dc 100644 --- a/apps/meteor/app/slashcommands-mute/server/mute.ts +++ b/apps/meteor/server/slashcommands/mute/mute.ts @@ -2,10 +2,10 @@ import { api } from '@rocket.chat/core-services'; import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; -import { i18n } from '../../../server/lib/i18n'; -import { muteUserInRoom } from '../../../server/methods/muteUserInRoom'; -import { settings } from '../../settings/server'; -import { slashCommands } from '../../utils/server/slashCommand'; +import { settings } from '../../../app/settings/server'; +import { slashCommands } from '../../../app/utils/server/slashCommand'; +import { i18n } from '../../lib/i18n'; +import { muteUserInRoom } from '../../methods/muteUserInRoom'; /* * Mute is a named function that will replace /mute commands diff --git a/apps/meteor/app/slashcommands-mute/server/unmute.ts b/apps/meteor/server/slashcommands/mute/unmute.ts similarity index 81% rename from apps/meteor/app/slashcommands-mute/server/unmute.ts rename to apps/meteor/server/slashcommands/mute/unmute.ts index 4dc683f4ca932..e0a5af5d7e4c5 100644 --- a/apps/meteor/app/slashcommands-mute/server/unmute.ts +++ b/apps/meteor/server/slashcommands/mute/unmute.ts @@ -2,10 +2,10 @@ import { api } from '@rocket.chat/core-services'; import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; -import { i18n } from '../../../server/lib/i18n'; -import { unmuteUserInRoom } from '../../../server/methods/unmuteUserInRoom'; -import { settings } from '../../settings/server'; -import { slashCommands } from '../../utils/server/slashCommand'; +import { settings } from '../../../app/settings/server'; +import { slashCommands } from '../../../app/utils/server/slashCommand'; +import { i18n } from '../../lib/i18n'; +import { unmuteUserInRoom } from '../../methods/unmuteUserInRoom'; /* * Unmute is a named function that will replace /unmute commands diff --git a/apps/meteor/app/slashcommands-status/server/index.ts b/apps/meteor/server/slashcommands/status/index.ts similarity index 100% rename from apps/meteor/app/slashcommands-status/server/index.ts rename to apps/meteor/server/slashcommands/status/index.ts diff --git a/apps/meteor/app/slashcommands-status/server/status.ts b/apps/meteor/server/slashcommands/status/status.ts similarity index 83% rename from apps/meteor/app/slashcommands-status/server/status.ts rename to apps/meteor/server/slashcommands/status/status.ts index 89bad86a4a373..147dcb4ff0b01 100644 --- a/apps/meteor/app/slashcommands-status/server/status.ts +++ b/apps/meteor/server/slashcommands/status/status.ts @@ -2,10 +2,10 @@ import { api } from '@rocket.chat/core-services'; import type { SlashCommandCallbackParams, IUser } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; -import { i18n } from '../../../server/lib/i18n'; -import { settings } from '../../settings/server'; -import { setUserStatusMethod } from '../../user-status/server/methods/setUserStatus'; -import { slashCommands } from '../../utils/server/slashCommand'; +import { settings } from '../../../app/settings/server'; +import { setUserStatusMethod } from '../../../app/user-status/server/methods/setUserStatus'; +import { slashCommands } from '../../../app/utils/server/slashCommand'; +import { i18n } from '../../lib/i18n'; slashCommands.add({ command: 'status', diff --git a/apps/meteor/app/slashcommands-topic/server/index.ts b/apps/meteor/server/slashcommands/topic/index.ts similarity index 100% rename from apps/meteor/app/slashcommands-topic/server/index.ts rename to apps/meteor/server/slashcommands/topic/index.ts diff --git a/apps/meteor/app/slashcommands-topic/server/topic.ts b/apps/meteor/server/slashcommands/topic/topic.ts similarity index 65% rename from apps/meteor/app/slashcommands-topic/server/topic.ts rename to apps/meteor/server/slashcommands/topic/topic.ts index c1fa6ea283b78..8b6499b822257 100644 --- a/apps/meteor/app/slashcommands-topic/server/topic.ts +++ b/apps/meteor/server/slashcommands/topic/topic.ts @@ -1,8 +1,8 @@ import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; -import { hasPermissionAsync } from '../../authorization/server/functions/hasPermission'; -import { saveRoomSettings } from '../../channel-settings/server/methods/saveRoomSettings'; -import { slashCommands } from '../../utils/server/slashCommand'; +import { hasPermissionAsync } from '../../../app/authorization/server/functions/hasPermission'; +import { saveRoomSettings } from '../../../app/channel-settings/server/methods/saveRoomSettings'; +import { slashCommands } from '../../../app/utils/server/slashCommand'; slashCommands.add({ command: 'topic', diff --git a/apps/meteor/app/slashcommands-unarchiveroom/server/index.ts b/apps/meteor/server/slashcommands/unarchiveroom/index.ts similarity index 100% rename from apps/meteor/app/slashcommands-unarchiveroom/server/index.ts rename to apps/meteor/server/slashcommands/unarchiveroom/index.ts diff --git a/apps/meteor/app/slashcommands-unarchiveroom/server/server.ts b/apps/meteor/server/slashcommands/unarchiveroom/server.ts similarity index 85% rename from apps/meteor/app/slashcommands-unarchiveroom/server/server.ts rename to apps/meteor/server/slashcommands/unarchiveroom/server.ts index 4c0c44269d2fa..0faeba69290b0 100644 --- a/apps/meteor/app/slashcommands-unarchiveroom/server/server.ts +++ b/apps/meteor/server/slashcommands/unarchiveroom/server.ts @@ -4,13 +4,13 @@ import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; import { Users, Rooms } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; +import { hasPermissionAsync } from '../../../app/authorization/server/functions/hasPermission'; +import { unarchiveRoom } from '../../../app/lib/server/functions/unarchiveRoom'; +import { settings } from '../../../app/settings/server'; +import { slashCommands } from '../../../app/utils/server/slashCommand'; import { RoomMemberActions } from '../../../definition/IRoomTypeConfig'; -import { i18n } from '../../../server/lib/i18n'; -import { roomCoordinator } from '../../../server/lib/rooms/roomCoordinator'; -import { hasPermissionAsync } from '../../authorization/server/functions/hasPermission'; -import { unarchiveRoom } from '../../lib/server/functions/unarchiveRoom'; -import { settings } from '../../settings/server'; -import { slashCommands } from '../../utils/server/slashCommand'; +import { i18n } from '../../lib/i18n'; +import { roomCoordinator } from '../../lib/rooms/roomCoordinator'; slashCommands.add({ command: 'unarchive', From 3cd7db677a72521439b564dca7a4ca6d6c3a1c07 Mon Sep 17 00:00:00 2001 From: jonas_florencio <79267723+jonasflorencio@users.noreply.github.com> Date: Tue, 30 Jun 2026 06:23:07 -0300 Subject: [PATCH 023/220] fix: Imported fixes 06-24-26 (#41069) Co-authored-by: Nazareno Bucciarelli <84046180+nazabucciarelli@users.noreply.github.com> Co-authored-by: Julio Araujo Co-authored-by: Nazareno Bucciarelli --- .changeset/gentle-cats-change.md | 8 ++ .../server/definition/ISAMLAssertion.ts | 2 +- .../meteor-accounts-saml/server/lib/SAML.ts | 16 ++- .../meteor-accounts-saml/server/lib/Utils.ts | 6 + .../server/lib/parsers/Response.ts | 26 +++- apps/meteor/server/models.ts | 2 + .../unit/app/meteor-accounts-saml/data.ts | 26 ++++ .../app/meteor-accounts-saml/server.tests.ts | 127 ++++++++++++++++++ .../core-typings/src/ISamlUsedAssertions.ts | 7 + packages/core-typings/src/index.ts | 1 + packages/model-typings/src/index.ts | 1 + .../src/models/ISamlUsedAssertionsModel.ts | 7 + packages/models/src/index.ts | 4 + packages/models/src/modelClasses.ts | 1 + .../models/src/models/SamlUsedAssertions.ts | 37 +++++ 15 files changed, 262 insertions(+), 9 deletions(-) create mode 100644 .changeset/gentle-cats-change.md create mode 100644 packages/core-typings/src/ISamlUsedAssertions.ts create mode 100644 packages/model-typings/src/models/ISamlUsedAssertionsModel.ts create mode 100644 packages/models/src/models/SamlUsedAssertions.ts diff --git a/.changeset/gentle-cats-change.md b/.changeset/gentle-cats-change.md new file mode 100644 index 0000000000000..da4f32ad30a64 --- /dev/null +++ b/.changeset/gentle-cats-change.md @@ -0,0 +1,8 @@ +--- +'@rocket.chat/meteor': patch +'@rocket.chat/core-typings': patch +'@rocket.chat/model-typings': patch +'@rocket.chat/models': patch +--- + +Security Hotfix (https://docs.rocket.chat/docs/security-fixes-and-updates) diff --git a/apps/meteor/app/meteor-accounts-saml/server/definition/ISAMLAssertion.ts b/apps/meteor/app/meteor-accounts-saml/server/definition/ISAMLAssertion.ts index 1744afe7b3800..7480d34cb96ea 100644 --- a/apps/meteor/app/meteor-accounts-saml/server/definition/ISAMLAssertion.ts +++ b/apps/meteor/app/meteor-accounts-saml/server/definition/ISAMLAssertion.ts @@ -1,4 +1,4 @@ export interface ISAMLAssertion { - assertion: Element | Document; + assertion: Element; xml: string; } diff --git a/apps/meteor/app/meteor-accounts-saml/server/lib/SAML.ts b/apps/meteor/app/meteor-accounts-saml/server/lib/SAML.ts index 61e4bd7421b88..015c379c408c6 100644 --- a/apps/meteor/app/meteor-accounts-saml/server/lib/SAML.ts +++ b/apps/meteor/app/meteor-accounts-saml/server/lib/SAML.ts @@ -1,7 +1,7 @@ import type { ServerResponse } from 'node:http'; import type { IUser, IIncomingMessage, IPersonalAccessToken, IRole } from '@rocket.chat/core-typings'; -import { CredentialTokens, Rooms, Users, Roles } from '@rocket.chat/models'; +import { CredentialTokens, Rooms, Users, Roles, SamlUsedAssertions } from '@rocket.chat/models'; import { Random } from '@rocket.chat/random'; import { escapeRegExp, escapeHTML } from '@rocket.chat/string-helpers'; import { Accounts } from 'meteor/accounts-base'; @@ -505,6 +505,20 @@ export class SAML { throw new Error('No user data collected from IdP response.'); } + const baseExpireAt = profile.expireAt instanceof Date ? profile.expireAt : new Date(Date.now() + 300000); + + const safeExpireAt = new Date(baseExpireAt.getTime() + (service.allowedClockDrift || 0)); + + if (!profile.assertionId || !profile.issuer) { + SAMLUtils.error({ msg: 'Invalid SAML response: missing Assertion ID or Issuer', profile }); + throw new Error('Invalid SAML response: missing Assertion ID or Issuer.'); + } + + if (!(await SamlUsedAssertions.markUsed(profile.assertionId, profile.issuer, safeExpireAt))) { + SAMLUtils.warn({ msg: 'SAML assertion replay detected', issuer: profile.issuer, assertionId: profile.assertionId }); + throw new Error('An assertion with the same ID cannot be used more than once.'); + } + // create a random token to store the login result // to test an IdP initiated login on localhost, use the following URL (assuming SimpleSAMLPHP on localhost:8080): // http://localhost:8080/simplesaml/saml2/idp/SSOService.php?spentityid=http://localhost:3000/_saml/metadata/test-sp diff --git a/apps/meteor/app/meteor-accounts-saml/server/lib/Utils.ts b/apps/meteor/app/meteor-accounts-saml/server/lib/Utils.ts index c7bd6d032fb65..6a540e56e266d 100644 --- a/apps/meteor/app/meteor-accounts-saml/server/lib/Utils.ts +++ b/apps/meteor/app/meteor-accounts-saml/server/lib/Utils.ts @@ -149,6 +149,12 @@ export class SAMLUtils { } } + public static warn(obj: object | string): void { + if (logger) { + logger.warn(obj); + } + } + public static async inflateXml(deflatedXml: Buffer): Promise> { return new Promise((resolve, reject) => { zlib.inflateRaw(deflatedXml, (err, inflatedXml) => { diff --git a/apps/meteor/app/meteor-accounts-saml/server/lib/parsers/Response.ts b/apps/meteor/app/meteor-accounts-saml/server/lib/parsers/Response.ts index 8fa5e28eb2841..0887cc8652bb2 100644 --- a/apps/meteor/app/meteor-accounts-saml/server/lib/parsers/Response.ts +++ b/apps/meteor/app/meteor-accounts-saml/server/lib/parsers/Response.ts @@ -89,7 +89,7 @@ export class ResponseParser { } SAMLUtils.log('Status ok'); - let assertion: XmlParent; + let assertion: Element; let assertionData: ISAMLAssertion; let issuer; @@ -118,6 +118,18 @@ export class ResponseParser { profile.issuer = issuer.textContent; } + if (assertion.hasAttribute('ID')) { + profile.assertionId = assertion.getAttribute('ID'); + } + + const conditions = assertion.getElementsByTagNameNS('urn:oasis:names:tc:SAML:2.0:assertion', 'Conditions')[0]; + if (conditions?.hasAttribute('NotOnOrAfter')) { + const notOnOrAfter = conditions.getAttribute('NotOnOrAfter'); + if (notOnOrAfter) { + profile.expireAt = new Date(notOnOrAfter); + } + } + const subject = this.getSubject(assertion); if (subject) { const nameID = subject.getElementsByTagNameNS('urn:oasis:names:tc:SAML:2.0:assertion', 'NameID')[0]; @@ -205,7 +217,7 @@ export class ResponseParser { throw new Error('Too many SAML assertions'); } - let assertion: XmlParent = allAssertions[0]; + let assertion: Element = allAssertions[0]; const encAssertion = allEncrypedAssertions[0]; let newXml = null; @@ -295,11 +307,11 @@ export class ResponseParser { return this.validateSignatureChildren(xml, cert, response); } - private validateAssertionSignature(xml: string, cert: string, assertion: XmlParent): boolean { + private validateAssertionSignature(xml: string, cert: string, assertion: Element): boolean { return this.validateSignatureChildren(xml, cert, assertion); } - private validateSignatureChildren(xml: string, cert: string, parent: XmlParent): boolean { + private validateSignatureChildren(xml: string, cert: string, parent: Element): boolean { const xpathSigQuery = ".//*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']"; const signatures = xmlCrypto.xpath(parent, xpathSigQuery) as Array; let signature = null; @@ -344,7 +356,7 @@ export class ResponseParser { return result; } - private getIssuer(assertion: XmlParent): any { + private getIssuer(assertion: Element): any { const issuers = assertion.getElementsByTagNameNS('urn:oasis:names:tc:SAML:2.0:assertion', 'Issuer'); if (issuers.length > 1) { throw new Error('Too many Issuers'); @@ -353,7 +365,7 @@ export class ResponseParser { return issuers[0]; } - private getSubject(assertion: XmlParent): XmlParent { + private getSubject(assertion: Element): XmlParent { let subject: XmlParent = assertion.getElementsByTagNameNS('urn:oasis:names:tc:SAML:2.0:assertion', 'Subject')[0]; const encSubject = assertion.getElementsByTagNameNS('urn:oasis:names:tc:SAML:2.0:assertion', 'EncryptedID')[0]; @@ -418,7 +430,7 @@ export class ResponseParser { return true; } - private validateAssertionConditions(assertion: XmlParent): void { + private validateAssertionConditions(assertion: Element): void { const conditions = assertion.getElementsByTagNameNS('urn:oasis:names:tc:SAML:2.0:assertion', 'Conditions')[0]; if (conditions && !this.validateNotBeforeNotOnOrAfterAssertions(conditions)) { throw new Error('NotBefore / NotOnOrAfter assertion failed'); diff --git a/apps/meteor/server/models.ts b/apps/meteor/server/models.ts index 49b5b98b19f08..98eb364cecb38 100644 --- a/apps/meteor/server/models.ts +++ b/apps/meteor/server/models.ts @@ -75,6 +75,7 @@ import { WebdavAccountsRaw, WorkspaceCredentialsRaw, AbacAttributesRaw, + SamlUsedAssertionsRaw, } from '@rocket.chat/models'; import type { Collection } from 'mongodb'; @@ -161,3 +162,4 @@ registerModel('IVideoConferenceModel', new VideoConferenceRaw(db)); registerModel('IWebdavAccountsModel', new WebdavAccountsRaw(db)); registerModel('IWorkspaceCredentialsModel', new WorkspaceCredentialsRaw(db)); registerModel('IAbacAttributesModel', new AbacAttributesRaw(db)); +registerModel('ISamlUsedAssertionsModel', new SamlUsedAssertionsRaw(db)); diff --git a/apps/meteor/tests/unit/app/meteor-accounts-saml/data.ts b/apps/meteor/tests/unit/app/meteor-accounts-saml/data.ts index 7a0c41c7667cc..6df868351c812 100644 --- a/apps/meteor/tests/unit/app/meteor-accounts-saml/data.ts +++ b/apps/meteor/tests/unit/app/meteor-accounts-saml/data.ts @@ -128,6 +128,32 @@ export const simpleSamlResponse = `${samlResponseHeader} ${samlResponseAssertion} ${samlResponseFooter}`; +export const samlResponseAssertionId = '_assertionwithconditions00000000000000001'; + +const samlResponseAssertionWithConditions = ` + [ISSUER] + + [NAMEID] + + + + + urn:oasis:names:tc:SAML:2.0:ac:classes:Password + + + + + 1 + + + `; + +export const samlResponseWithConditions = `${samlResponseHeader} + ${samlResponseIssuer} + ${samlResponseStatus} + ${samlResponseAssertionWithConditions} +${samlResponseFooter}`; + export const samlResponseMissingStatus = `${samlResponseHeader} ${samlResponseIssuer} ${samlResponseAssertion} diff --git a/apps/meteor/tests/unit/app/meteor-accounts-saml/server.tests.ts b/apps/meteor/tests/unit/app/meteor-accounts-saml/server.tests.ts index fb972157db7ce..fac3f1c039a88 100644 --- a/apps/meteor/tests/unit/app/meteor-accounts-saml/server.tests.ts +++ b/apps/meteor/tests/unit/app/meteor-accounts-saml/server.tests.ts @@ -1,6 +1,7 @@ import { isTruthy } from '@rocket.chat/tools'; import { expect } from 'chai'; import proxyquire from 'proxyquire'; +import sinon from 'sinon'; import { serviceProviderOptions, @@ -20,6 +21,8 @@ import { samlResponseMultipleAssertions, samlResponseMissingAssertion, samlResponseMultipleIssuers, + samlResponseWithConditions, + samlResponseAssertionId, samlResponseValidSignatures, samlResponseValidAssertionSignature, encryptedResponse, @@ -319,6 +322,29 @@ describe('SAML', () => { }); }); + it('should contain properties to avoid assertions replay in the profile object from the response', () => { + const notBefore = new Date(); + notBefore.setMinutes(notBefore.getMinutes() - 3); + + const notOnOrAfter = new Date(); + notOnOrAfter.setMinutes(notOnOrAfter.getMinutes() + 3); + + const response = samlResponseWithConditions + .replace('[NOTBEFORE]', notBefore.toISOString()) + .replace('[NOTONORAFTER]', notOnOrAfter.toISOString()); + + const parser = new ResponseParser(serviceProviderOptions); + parser.validate(makeLoginResponseEnvelope(response), (err, profile, loggedOut) => { + expect(err).to.be.null; + expect(profile).to.be.an('object'); + expect(profile).to.have.property('assertionId').equal(samlResponseAssertionId); + expect(profile).to.have.property('expireAt'); + // `expireAt` mirrors the assertion's NotOnOrAfter condition. + expect(new Date((profile as any).expireAt).toISOString()).to.equal(notOnOrAfter.toISOString()); + expect(loggedOut).to.be.false; + }); + }); + it('should respect NotOnOrAfter conditions', () => { const notBefore = new Date(); notBefore.setMinutes(notBefore.getMinutes() - 3); @@ -1018,4 +1044,105 @@ describe('SAML', () => { ); }); }); + + describe('[SAML.processRequest] validate action - assertion replay protection', () => { + const markUsed = sinon.stub(); + const credentialCreate = sinon.stub().resolves(); + + // `pending` captures the promise returned by the (async) validateResponse callback, + // because processValidateAction does not await it. Awaiting it in the test guarantees + // markUsed / storeCredential / redirect have already run before we assert. + let pending: Promise | undefined; + let lastRedirect: string | undefined; + + // A profile as produced by ResponseParser, carrying the replay-guard fields. + const replayProfile = { + assertionId: samlResponseAssertionId, + issuer: '[ISSUER]', + expireAt: new Date(Date.now() + 5 * 60 * 1000), + }; + + const res = { + writeHead: (_code: number, headers?: Record) => { + lastRedirect = headers?.Location; + }, + write: () => undefined, + end: () => undefined, + }; + + const loadSAML = () => + proxyquire.noCallThru().load('../../../../app/meteor-accounts-saml/server/lib/SAML', { + '@rocket.chat/models': { + SamlUsedAssertions: { markUsed }, + CredentialTokens: { create: credentialCreate }, + Users: {}, + Rooms: {}, + Roles: {}, + }, + '@rocket.chat/random': { Random: { id: () => '__credentialToken__' } }, + '@rocket.chat/string-helpers': { escapeRegExp: (s: string) => s, escapeHTML: (s: string) => s }, + 'meteor/accounts-base': { Accounts: { _generateStampedLoginToken: () => ({ token: 't' }) } }, + 'meteor/meteor': { Meteor: { absoluteUrl: (path = '') => `http://localhost:3000/${path}`, Error } }, + './ServiceProvider': { + SAMLServiceProvider: class { + validateResponse(_envelope: unknown, cb: (err: Error | null, profile: any) => Promise) { + pending = cb(null, replayProfile); + } + }, + }, + './Utils': { + SAMLUtils: { + relayState: null, + error: sinon.stub(), + warn: sinon.stub(), + log: sinon.stub(), + getValidationActionRedirectPath: (token: string) => `_saml/validate/${token}`, + }, + }, + './getSAMLEnvelope': { getSAMLEnvelope: async () => ({ relayState: null }) }, + '../../../../lib/utils/arrayUtils': { ensureArray: (v: any) => v }, + '../../../../server/lib/logger/system': { SystemLogger: { error: sinon.stub(), warn: sinon.stub() } }, + '../../../lib/server/functions/addUserToRoom': { addUserToRoom: sinon.stub() }, + '../../../lib/server/functions/createRoom': { createRoom: sinon.stub() }, + '../../../lib/server/functions/getUsernameSuggestion': { generateUsernameSuggestion: sinon.stub() }, + '../../../lib/server/functions/saveUserIdentity': { saveUserIdentity: sinon.stub() }, + '../../../settings/server': { settings: { get: sinon.stub() } }, + '../../../utils/lib/i18n': { i18n: { t: (s: string) => s, languages: [] } }, + }).SAML; + + const service = { ...serviceProviderOptions } as any; + const samlObject = { actionName: 'validate', serviceName: 'test-sp', credentialToken: '' } as any; + + beforeEach(() => { + markUsed.reset(); + credentialCreate.reset(); + credentialCreate.resolves(); + pending = undefined; + lastRedirect = undefined; + }); + + it('should mark the assertion as used and store the credential for a fresh assertion', async () => { + markUsed.resolves(true); + const SAML = loadSAML(); + + await SAML.processRequest({} as any, res as any, service, samlObject); + await pending; + + expect(markUsed.calledOnceWithExactly(replayProfile.assertionId, replayProfile.issuer, replayProfile.expireAt)).to.be.true; + expect(credentialCreate.calledOnce).to.be.true; + expect(lastRedirect).to.equal('http://localhost:3000/_saml/validate/__credentialToken__'); + }); + + it('should reject a replayed assertion: no credential stored and redirect to the base url', async () => { + markUsed.resolves(false); + const SAML = loadSAML(); + + await SAML.processRequest({} as any, res as any, service, samlObject); + await pending; + + expect(markUsed.calledOnce).to.be.true; + expect(credentialCreate.called).to.be.false; + expect(lastRedirect).to.equal('http://localhost:3000/'); + }); + }); }); diff --git a/packages/core-typings/src/ISamlUsedAssertions.ts b/packages/core-typings/src/ISamlUsedAssertions.ts new file mode 100644 index 0000000000000..6680985aa0442 --- /dev/null +++ b/packages/core-typings/src/ISamlUsedAssertions.ts @@ -0,0 +1,7 @@ +export interface ISamlUsedAssertions { + _id: string; + assertionId: string; + issuer: string; + expireAt: Date; + createdAt: Date; +} diff --git a/packages/core-typings/src/index.ts b/packages/core-typings/src/index.ts index 56ba73c7d77f9..14170eb7d971f 100644 --- a/packages/core-typings/src/index.ts +++ b/packages/core-typings/src/index.ts @@ -54,6 +54,7 @@ export type * from './IEmojiCustom'; export type * from './ICustomEmojiDescriptor'; export type * from './IAnalytics'; export type * from './ICredentialToken'; +export type * from './ISamlUsedAssertions'; export type * from './IAvatar'; export type * from './ICustomUserStatus'; export type * from './IEmailMessageHistory'; diff --git a/packages/model-typings/src/index.ts b/packages/model-typings/src/index.ts index 439447c49ea02..d6638a92c272c 100644 --- a/packages/model-typings/src/index.ts +++ b/packages/model-typings/src/index.ts @@ -81,3 +81,4 @@ export type * from './updater'; export type * from './models/IWorkspaceCredentialsModel'; export type * from './models/ICallHistoryModel'; export type * from './models/IAbacAttributesModel'; +export type * from './models/ISamlUsedAssertionsModel'; diff --git a/packages/model-typings/src/models/ISamlUsedAssertionsModel.ts b/packages/model-typings/src/models/ISamlUsedAssertionsModel.ts new file mode 100644 index 0000000000000..11cf934fa6514 --- /dev/null +++ b/packages/model-typings/src/models/ISamlUsedAssertionsModel.ts @@ -0,0 +1,7 @@ +import type { ISamlUsedAssertions } from '@rocket.chat/core-typings'; + +import type { IBaseModel } from './IBaseModel'; + +export interface ISamlUsedAssertionsModel extends IBaseModel { + markUsed(assertionId: string, issuer: string, expireAt: Date): Promise; +} diff --git a/packages/models/src/index.ts b/packages/models/src/index.ts index 099420cd2f7ae..a54acad092a2a 100644 --- a/packages/models/src/index.ts +++ b/packages/models/src/index.ts @@ -80,6 +80,7 @@ import type { IMediaCallNegotiationsModel, ICallHistoryModel, IAbacAttributesModel, + ISamlUsedAssertionsModel, } from '@rocket.chat/model-typings'; import type { Collection, Db } from 'mongodb'; @@ -106,6 +107,7 @@ import { UsersSessionsRaw, AbacAttributesRaw, ServerEventsRaw, + SamlUsedAssertionsRaw, } from './modelClasses'; import { proxify, registerModel } from './proxify'; @@ -207,6 +209,7 @@ export const Migrations = proxify('IMigrationsModel'); export const ModerationReports = proxify('IModerationReportsModel'); export const WorkspaceCredentials = proxify('IWorkspaceCredentialsModel'); export const AbacAttributes = proxify('IAbacAttributesModel'); +export const SamlUsedAssertions = proxify('ISamlUsedAssertionsModel'); export function registerServiceModels(db: Db, trash?: Collection>): void { registerModel('IUsersSessionsModel', () => new UsersSessionsRaw(db)); @@ -241,4 +244,5 @@ export function registerServiceModels(db: Db, trash?: Collection new LivechatVisitorsRaw(db)); registerModel('IAbacAttributesModel', () => new AbacAttributesRaw(db)); registerModel('IServerEventsModel', () => new ServerEventsRaw(db)); + registerModel('ISamlUsedAssertionsModel', () => new SamlUsedAssertionsRaw(db)); } diff --git a/packages/models/src/modelClasses.ts b/packages/models/src/modelClasses.ts index c554fc9698550..0807ea23a5950 100644 --- a/packages/models/src/modelClasses.ts +++ b/packages/models/src/modelClasses.ts @@ -48,6 +48,7 @@ export * from './models/PushToken'; export * from './models/Reports'; export * from './models/Roles'; export * from './models/Rooms'; +export * from './models/SamlUsedAssertions'; export * from './models/ServerEvents'; export * from './models/Sessions'; export * from './models/Settings'; diff --git a/packages/models/src/models/SamlUsedAssertions.ts b/packages/models/src/models/SamlUsedAssertions.ts new file mode 100644 index 0000000000000..8b1ccf7732a13 --- /dev/null +++ b/packages/models/src/models/SamlUsedAssertions.ts @@ -0,0 +1,37 @@ +import crypto from 'crypto'; + +import type { ISamlUsedAssertions, RocketChatRecordDeleted } from '@rocket.chat/core-typings'; +import type { ISamlUsedAssertionsModel } from '@rocket.chat/model-typings'; +import type { MongoServerError, Collection, Db, IndexDescription } from 'mongodb'; + +import { BaseRaw } from './BaseRaw'; + +const DUPLICATE_KEY_ERROR_CODE = 11000; + +export class SamlUsedAssertionsRaw extends BaseRaw implements ISamlUsedAssertionsModel { + constructor(db: Db, trash?: Collection>) { + super(db, 'saml_used_assertions', trash); + } + + protected override modelIndexes(): IndexDescription[] { + return [{ key: { expireAt: 1 }, sparse: true, expireAfterSeconds: 0 }]; + } + + async markUsed(assertionId: string, issuer: string, expireAt: Date): Promise { + try { + await this.insertOne({ + _id: crypto.createHash('sha256').update(JSON.stringify({ issuer, assertionId })).digest('hex'), + assertionId, + issuer, + expireAt, + createdAt: new Date(), + }); + return true; + } catch (error: unknown) { + if (typeof error === 'object' && error !== null && (error as MongoServerError).code === DUPLICATE_KEY_ERROR_CODE) { + return false; + } + throw error; + } + } +} From 9f08d1a98b5778f55a560dfbbd68c58ebe179012 Mon Sep 17 00:00:00 2001 From: Julio Araujo Date: Tue, 30 Jun 2026 13:58:13 +0200 Subject: [PATCH 024/220] chore(deps): bump mailparser, nodemailer, and undici, markdown-it (#41039) --- .../package-lock.json | 19 ++---- .../update-version-durability/package.json | 3 + apps/meteor/package.json | 6 +- package.json | 7 +- yarn.lock | 68 +++++++------------ 5 files changed, 40 insertions(+), 63 deletions(-) diff --git a/.github/actions/update-version-durability/package-lock.json b/.github/actions/update-version-durability/package-lock.json index c48e783a33d09..f57288ebe7dd1 100644 --- a/.github/actions/update-version-durability/package-lock.json +++ b/.github/actions/update-version-durability/package-lock.json @@ -53,14 +53,6 @@ "integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==", "license": "MIT" }, - "node_modules/@fastify/busboy": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", - "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", - "engines": { - "node": ">=14" - } - }, "node_modules/@octokit/auth-token": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-5.1.1.tgz", @@ -612,15 +604,12 @@ } }, "node_modules/undici": { - "version": "5.29.0", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.29.0.tgz", - "integrity": "sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==", + "version": "6.27.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.27.0.tgz", + "integrity": "sha512-YmfV3YnEDzXRC5lZ2jWtWWHKGUm1zIt8AhesR1tens+HTNv+YZlN/dp6G727LOvMJ8xjP9Be7Y2Sdr96LDm+pg==", "license": "MIT", - "dependencies": { - "@fastify/busboy": "^2.0.0" - }, "engines": { - "node": ">=14.0" + "node": ">=18.17" } }, "node_modules/universal-user-agent": { diff --git a/.github/actions/update-version-durability/package.json b/.github/actions/update-version-durability/package.json index b7483014396c9..71b5850b671b5 100644 --- a/.github/actions/update-version-durability/package.json +++ b/.github/actions/update-version-durability/package.json @@ -17,5 +17,8 @@ "diff": "^5.1.0", "semver": "^7.5.4", "@xmldom/xmldom": "^0.8.13" + }, + "overrides": { + "undici": "6.27.0" } } diff --git a/apps/meteor/package.json b/apps/meteor/package.json index f43fa09b3c04c..38145c76fa1a4 100644 --- a/apps/meteor/package.json +++ b/apps/meteor/package.json @@ -241,7 +241,7 @@ "lodash.debounce": "^4.0.8", "lodash.escape": "^4.0.1", "lodash.get": "^4.4.2", - "mailparser": "~3.9.10", + "mailparser": "~3.9.11", "marked": "^4.3.0", "mem": "^8.1.1", "meteor-node-stubs": "~1.2.27", @@ -257,7 +257,7 @@ "node-dogstatsd": "^0.0.7", "node-fetch": "2.7.0", "node-rsa": "^1.1.1", - "nodemailer": "^8.0.8", + "nodemailer": "^9.0.1", "object-path": "^0.11.8", "overlayscrollbars": "~2.11.5", "overlayscrollbars-react": "^0.5.6", @@ -378,7 +378,7 @@ "@types/mocha": "github:whitecolor/mocha-types", "@types/node": "~22.19.17", "@types/node-rsa": "^1.1.4", - "@types/nodemailer": "^8.0.0", + "@types/nodemailer": "^8.0.1", "@types/oauth2-server": "^3.0.18", "@types/object-path": "^0.11.4", "@types/parseurl": "^1.3.3", diff --git a/package.json b/package.json index e35116a9b2e36..24acc533cef65 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "follow-redirects": "^1.16.0", "handlebars": "^4.7.9", "lodash": "^4.18.0", - "markdown-it": "^14.1.1", + "markdown-it": "^14.2.0", "minimist": "1.2.6", "mongodb": "6.10.0", "protobufjs": "7.6.1", @@ -101,7 +101,8 @@ "ws@npm:^8": "^8.20.1", "ws@npm:^8.2.3": "^8.20.1", "ws@npm:^8.18.0": "^8.20.1", - "undici@npm:^6.19.5": "^6.24.0", + "undici@npm:^6.19.5": "^6.27.0", + "undici@npm:^6.23.0": "^6.27.0", "webpack": "~5.104.0", "yaml@npm:^1.10.0": "^1.10.3", "yaml@npm:^2.2.2": "^2.8.3", @@ -147,7 +148,7 @@ "minimatch@npm:^3.1.1": "3.1.5", "minimatch@npm:^9.0.4": "9.0.9", "minimatch@npm:^10.0.0": "10.2.5", - "nodemailer@npm:^8.0.8": "8.0.8", + "nodemailer@npm:^9.0.1": "9.0.1", "normalize-package-data@npm:2.5.0/semver": "5.7.2", "make-dir@npm:2.1.0/semver": "5.7.2", "utf7/semver": "5.7.2", diff --git a/yarn.lock b/yarn.lock index 762d3c1a558e8..c049a56aec180 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10045,7 +10045,7 @@ __metadata: "@types/mocha": "github:whitecolor/mocha-types" "@types/node": "npm:~22.19.17" "@types/node-rsa": "npm:^1.1.4" - "@types/nodemailer": "npm:^8.0.0" + "@types/nodemailer": "npm:^8.0.1" "@types/oauth2-server": "npm:^3.0.18" "@types/object-path": "npm:^0.11.4" "@types/parseurl": "npm:^1.3.3" @@ -10164,7 +10164,7 @@ __metadata: lodash.debounce: "npm:^4.0.8" lodash.escape: "npm:^4.0.1" lodash.get: "npm:^4.4.2" - mailparser: "npm:~3.9.10" + mailparser: "npm:~3.9.11" marked: "npm:^4.3.0" mem: "npm:^8.1.1" meteor-node-stubs: "npm:~1.2.27" @@ -10181,7 +10181,7 @@ __metadata: node-dogstatsd: "npm:^0.0.7" node-fetch: "npm:2.7.0" node-rsa: "npm:^1.1.1" - nodemailer: "npm:^8.0.8" + nodemailer: "npm:^9.0.1" nyc: "npm:^17.1.0" object-path: "npm:^0.11.8" outdent: "npm:~0.8.0" @@ -14600,12 +14600,12 @@ __metadata: languageName: node linkType: hard -"@types/nodemailer@npm:^8.0.0": - version: 8.0.0 - resolution: "@types/nodemailer@npm:8.0.0" +"@types/nodemailer@npm:^8.0.1": + version: 8.0.1 + resolution: "@types/nodemailer@npm:8.0.1" dependencies: "@types/node": "npm:*" - checksum: 10/d1178b557e8c547018e708459af06fdf2e9cfd6d65fed109517cddfe6b5add6201d941882a2e4eeede529de08ae71a68fb2a1d8f1c41cb3761d3a6c2458025fe + checksum: 10/ec2d9783387a0b24de0cfa76a8da6beab7342e97329fe1e2cf7a26d05e57b241f8dd45276385f1ee5bd089000f35b60beb8f31a9e2e7deaec5486ff1c640e641 languageName: node linkType: hard @@ -27001,7 +27001,7 @@ __metadata: languageName: node linkType: hard -"linkify-it@npm:5.0.1": +"linkify-it@npm:5.0.1, linkify-it@npm:^5.0.1": version: 5.0.1 resolution: "linkify-it@npm:5.0.1" dependencies: @@ -27010,15 +27010,6 @@ __metadata: languageName: node linkType: hard -"linkify-it@npm:^5.0.0": - version: 5.0.0 - resolution: "linkify-it@npm:5.0.0" - dependencies: - uc.micro: "npm:^2.0.0" - checksum: 10/ef3b7609dda6ec0c0be8a7b879cea195f0d36387b0011660cd6711bba0ad82137f59b458b7e703ec74f11d88e7c1328e2ad9b855a8500c0ded67461a8c4519e6 - languageName: node - linkType: hard - "load-json-file@npm:^4.0.0": version: 4.0.0 resolution: "load-json-file@npm:4.0.0" @@ -27414,9 +27405,9 @@ __metadata: languageName: node linkType: hard -"mailparser@npm:~3.9.10": - version: 3.9.10 - resolution: "mailparser@npm:3.9.10" +"mailparser@npm:~3.9.11": + version: 3.9.11 + resolution: "mailparser@npm:3.9.11" dependencies: "@zone-eu/mailsplit": "npm:5.4.12" encoding-japanese: "npm:2.2.0" @@ -27425,10 +27416,10 @@ __metadata: iconv-lite: "npm:0.7.2" libmime: "npm:5.3.8" linkify-it: "npm:5.0.1" - nodemailer: "npm:9.0.0" + nodemailer: "npm:9.0.1" punycode.js: "npm:2.3.1" tlds: "npm:1.261.0" - checksum: 10/427aefc17df534eeac22cb6ab6c87442115fbb000b173eea51e9286e00694c2b2e48e7b2920f8d312c59faf3c1d0babcb06f2e1c2552e207777991d31444649e + checksum: 10/b740f0ce62ada65c634ac5879bf9a71562b5656d4d805b0496b2e2f5aed3defa116f6adeba9120f76658da6288511c25e1e232a68e4e426c3ed8e9881e9c45bc languageName: node linkType: hard @@ -27532,19 +27523,19 @@ __metadata: languageName: node linkType: hard -"markdown-it@npm:^14.1.1": - version: 14.1.1 - resolution: "markdown-it@npm:14.1.1" +"markdown-it@npm:^14.2.0": + version: 14.2.0 + resolution: "markdown-it@npm:14.2.0" dependencies: argparse: "npm:^2.0.1" entities: "npm:^4.4.0" - linkify-it: "npm:^5.0.0" + linkify-it: "npm:^5.0.1" mdurl: "npm:^2.0.0" punycode.js: "npm:^2.3.1" uc.micro: "npm:^2.1.0" bin: markdown-it: bin/markdown-it.mjs - checksum: 10/088822c8aa9346ba4af6a205f6ee0f4baae55e3314f040dc5c28c897d57d0f979840c71872b3582a6a6e572d8c851c54e323c82f4559011dfa2e96224fc20fc2 + checksum: 10/f5cdb7ca9c8115114137201590b2697ee6ca69d2d4701a0313696629d5de4022525eedcad31800263c70f04dfba0a8eae835b6aa84b65e94ae32d63d04e66211 languageName: node linkType: hard @@ -28901,17 +28892,10 @@ __metadata: languageName: node linkType: hard -"nodemailer@npm:8.0.8": - version: 8.0.8 - resolution: "nodemailer@npm:8.0.8" - checksum: 10/b4d2d095355751ab4baa7047c35845a05a42eec734218e69fb36d16e9efaa0804d41741e39bbe0e22dfd416a9be835b09b82df624fd5da2b5d7aa8ca5a449e55 - languageName: node - linkType: hard - -"nodemailer@npm:9.0.0": - version: 9.0.0 - resolution: "nodemailer@npm:9.0.0" - checksum: 10/c72598e599c13e5c7d1c49e46eb6a448e615ea5abe4ba6a1c7fae1c42941689adecbdcd5b19dd6ff2d36758274832895086b0414cc6031f50a69d9e612895597 +"nodemailer@npm:9.0.1": + version: 9.0.1 + resolution: "nodemailer@npm:9.0.1" + checksum: 10/cc7782962def1575102039270ff3356535c614e6db420dda85dffe672e77e66b410198c284a508b3bc8193b9c34c8e7b4cf8c697e0de2cc978c5e02f9c708fed languageName: node linkType: hard @@ -36202,10 +36186,10 @@ __metadata: languageName: node linkType: hard -"undici@npm:^6.23.0, undici@npm:^6.24.0": - version: 6.25.0 - resolution: "undici@npm:6.25.0" - checksum: 10/a475e45da3e1d1073283bb70531666f09a432eabff2b857bd7063d469a1ee1486192ff61dc0dadbb526673ce1120fee14d66a59b6b17d1e0bd3a4d5f0a52d0a6 +"undici@npm:^6.27.0": + version: 6.27.0 + resolution: "undici@npm:6.27.0" + checksum: 10/30c18cdb235edf4dd36f8aa3ace1ffaf44060289a7d62ad44c33180d2d74a224015d25574812f62ce9c625b5beb1b0b766495b650fedf356aca11eed7ce2c816 languageName: node linkType: hard From a158ae7a5aaa8296858c767edf833d24b5b4e4d1 Mon Sep 17 00:00:00 2001 From: Tasso Evangelista Date: Tue, 30 Jun 2026 09:32:01 -0300 Subject: [PATCH 025/220] refactor: React 19 (#40796) --- ...act-pdf-layout-npm-4.6.1-b12fdb71f4.patch} | 11 +- .../ABACUpsellModal.spec.tsx.snap | 4 +- .../CreateDiscussion.spec.tsx.snap | 44 +- .../meteor/client/components/FilterByText.tsx | 4 +- .../GenericUpsellModal.spec.tsx.snap | 20 +- .../UserAutoCompleteMultiple.tsx | 2 +- .../__snapshots__/UserInfo.spec.tsx.snap | 16 +- .../TimestampPicker.spec.tsx.snap | 24 +- .../AttributesForm.spec.tsx.snap | 28 +- .../DeleteRoomModal.spec.tsx.snap | 4 +- .../EngagementDashboardCardErrorBoundary.tsx | 4 +- .../PermissionsTable.spec.tsx.snap | 8 +- .../UsersInRoleTable.spec.tsx.snap | 8 +- .../RangeSettingInput.spec.tsx.snap | 50 +- .../SettingsGroupPage/SettingsGroupPage.tsx | 4 +- .../__snapshots__/UsersTable.spec.tsx.snap | 18 +- .../SecurityLogDisplayModal.spec.tsx.snap | 12 +- .../EnterE2EPasswordModal.spec.tsx.snap | 4 +- .../AppLogsFilterCompact.spec.tsx.snap | 2 +- .../AppLogsFilterContextualBar.spec.tsx.snap | 8 +- .../AppLogsFilterExpanded.spec.tsx.snap | 10 +- .../__snapshots__/DateTimeModal.spec.tsx.snap | 4 - .../CallHistoryPageFilters.tsx | 4 +- .../CannedResponseList.spec.tsx.snap | 5 +- .../TemplatePlaceholderInput.tsx | 6 +- .../directory/contacts/RemoveContactModal.tsx | 4 +- .../ForwardChatModal.spec.tsx.snap | 16 +- .../ReturnChatQueueModal.spec.tsx.snap | 4 +- .../realTimeMonitoring/counter/CounterRow.tsx | 4 +- .../contexts/SelectedMessagesContext.tsx | 4 +- .../room/composer/messageBox/MessageBox.tsx | 4 +- .../__snapshots__/BannedUsers.spec.tsx.snap | 12 +- .../DiscussionsList.spec.tsx.snap | 8 +- .../__snapshots__/RoomFiles.spec.tsx.snap | 20 +- .../__snapshots__/InviteUsers.spec.tsx.snap | 20 +- .../__snapshots__/RoomMembers.spec.tsx.snap | 36 +- .../FileUploadModal.spec.tsx.snap | 10 +- .../meteor/client/views/root/AppErrorPage.tsx | 9 +- .../views/root/OutermostErrorBoundary.tsx | 6 +- apps/meteor/package.json | 36 +- apps/meteor/tests/e2e/messaging.spec.ts | 98 +- .../e2e/page-objects/fragments/toolbar.ts | 4 + apps/uikit-playground/package.json | 20 +- ee/apps/omnichannel-transcript/package.json | 6 +- ee/packages/pdf-worker/jest.config.ts | 2 +- ee/packages/pdf-worker/package.json | 10 +- ee/packages/pdf-worker/src/worker.spec.ts | 1 + package.json | 4 +- packages/fuselage-ui-kit/package.json | 16 +- packages/gazzodown/package.json | 18 +- .../src/katex/KatexErrorBoundary.tsx | 4 +- packages/livechat/package.json | 12 +- packages/mock-providers/package.json | 8 +- packages/storybook-config/package.json | 10 +- packages/ui-avatar/package.json | 14 +- packages/ui-client/package.json | 24 +- .../__snapshots__/GenericModal.spec.tsx.snap | 4 +- .../MultiSelectCustom/MultiSelectCustom.tsx | 4 +- packages/ui-composer/package.json | 14 +- packages/ui-contexts/package.json | 14 +- packages/ui-video-conf/package.json | 16 +- packages/ui-voip/package.json | 16 +- .../CallHistoryContextualbar.spec.tsx.snap | 4 +- .../MediaCallWidget.spec.tsx.snap | 4 +- .../PermissionFlowModal.spec.tsx.snap | 16 +- packages/web-ui-registration/package.json | 18 +- yarn.lock | 889 +++++++----------- 67 files changed, 784 insertions(+), 963 deletions(-) rename .yarn/patches/{@react-pdf-layout-npm-4.4.2-6c2e3312fa.patch => @react-pdf-layout-npm-4.6.1-b12fdb71f4.patch} (56%) diff --git a/.yarn/patches/@react-pdf-layout-npm-4.4.2-6c2e3312fa.patch b/.yarn/patches/@react-pdf-layout-npm-4.6.1-b12fdb71f4.patch similarity index 56% rename from .yarn/patches/@react-pdf-layout-npm-4.4.2-6c2e3312fa.patch rename to .yarn/patches/@react-pdf-layout-npm-4.6.1-b12fdb71f4.patch index a8271b2de103b..740c1484bde8c 100644 --- a/.yarn/patches/@react-pdf-layout-npm-4.4.2-6c2e3312fa.patch +++ b/.yarn/patches/@react-pdf-layout-npm-4.6.1-b12fdb71f4.patch @@ -1,5 +1,5 @@ diff --git a/lib/index.js b/lib/index.js -index c64bdf2d5f7e704a65be4e9a7116c5ee6a582701..ce6641d0b63daf7c5d3f8a1de773f290c0e9d51c 100644 +index b7ea5e30fddb9bdef0034c00f28bbd4f0dee584a..47f7717632bd55d3c42ebb39f1ef5a23c14cfa3a 100644 --- a/lib/index.js +++ b/lib/index.js @@ -2,8 +2,8 @@ import { upperFirst, capitalize, parseFloat as parseFloat$1, without, pick, comp @@ -13,3 +13,12 @@ index c64bdf2d5f7e704a65be4e9a7116c5ee6a582701..ce6641d0b63daf7c5d3f8a1de773f290 import emojiRegex from 'emoji-regex-xs'; import resolveImage from '@react-pdf/image'; +@@ -2998,7 +2998,7 @@ const splitPage = (page, pageNumber, fontStore, yoga) => { + const dynamicPage = resolveDynamicPage({ pageNumber }, page, fontStore, yoga); + const height = page.style.height; + const [currentChilds, nextChilds] = splitNodes(wrapArea, contentArea, dynamicPage.children); +- const relayout = (node) => ++ const relayout = (node) => + // @ts-expect-error rework pagination + relayoutPage(node, fontStore, yoga); + const currentBox = { ...page.box, height }; diff --git a/apps/meteor/client/components/ABAC/ABACUpsellModal/__snapshots__/ABACUpsellModal.spec.tsx.snap b/apps/meteor/client/components/ABAC/ABACUpsellModal/__snapshots__/ABACUpsellModal.spec.tsx.snap index 3d544cb7d96a3..0dce937dd6791 100644 --- a/apps/meteor/client/components/ABAC/ABACUpsellModal/__snapshots__/ABACUpsellModal.spec.tsx.snap +++ b/apps/meteor/client/components/ABAC/ABACUpsellModal/__snapshots__/ABACUpsellModal.spec.tsx.snap @@ -4,7 +4,7 @@ exports[`ABACUpsellModal should render the modal with correct content 1`] = `

Attribute-Based Access Control

diff --git a/apps/meteor/client/components/CreateDiscussion/__snapshots__/CreateDiscussion.spec.tsx.snap b/apps/meteor/client/components/CreateDiscussion/__snapshots__/CreateDiscussion.spec.tsx.snap index 915ce0fc0ed33..46c6c43304368 100644 --- a/apps/meteor/client/components/CreateDiscussion/__snapshots__/CreateDiscussion.spec.tsx.snap +++ b/apps/meteor/client/components/CreateDiscussion/__snapshots__/CreateDiscussion.spec.tsx.snap @@ -4,7 +4,7 @@ exports[`CreateDiscussion renders Default without crashing 1`] = `

Discussion_title

@@ -63,7 +63,7 @@ exports[`CreateDiscussion renders Default without crashing 1`] = ` > Parent channel or team
+
+ + +
+
+ + + + + + +`; diff --git a/apps/meteor/client/views/admin/subscription/components/cards/PlanCard/PlanCardLicenseDetails.tsx b/apps/meteor/client/views/admin/subscription/components/cards/PlanCard/PlanCardLicenseDetails.tsx index c804ec96899cc..b5928fd0fcf2e 100644 --- a/apps/meteor/client/views/admin/subscription/components/cards/PlanCard/PlanCardLicenseDetails.tsx +++ b/apps/meteor/client/views/admin/subscription/components/cards/PlanCard/PlanCardLicenseDetails.tsx @@ -1,28 +1,34 @@ import { IconButton, Divider, Box } from '@rocket.chat/fuselage'; -import { useClipboard } from '@rocket.chat/fuselage-hooks'; import { ActionLink } from '@rocket.chat/layout'; -import { useSetModal, useSetting } from '@rocket.chat/ui-contexts'; +import { usePermission, useSetModal, useSetting } from '@rocket.chat/ui-contexts'; import { useCallback } from 'react'; import { useTranslation } from 'react-i18next'; import ManageLicenseModal from './ManageLicenseModal'; +import useClipboardWithToast from '../../../../../../hooks/useClipboardWithToast'; import { useServerInfo } from '../../../../../../hooks/useWorkspaceInfo'; const PlanCardLicenseDetails = () => { const { t } = useTranslation(); const setModal = useSetModal(); + const hasPermission = usePermission('edit-privileged-setting'); const siteURL = useSetting('Site_Url', ''); const enterpriseLicense = useSetting('Enterprise_License', ''); const { data: serverInfo } = useServerInfo(); + const hashedSiteURL = serverInfo?.hashedWorkspaceUrl ?? ''; - const { copy: copySiteURL, hasCopied: hasCopiedSiteURL } = useClipboard(siteURL); - const { copy: copyHashed, hasCopied: hasCopiedHashed } = useClipboard(hashedSiteURL); + const { copy: copySiteURL, hasCopied: hasCopiedSiteURL } = useClipboardWithToast(siteURL); + const { copy: copyHashed, hasCopied: hasCopiedHashed } = useClipboardWithToast(hashedSiteURL); const handleOpenModal = useCallback( () => setModal( setModal(null)} />), [enterpriseLicense, setModal], ); + if (!hasPermission) { + return null; + } + return ( <> @@ -32,7 +38,7 @@ const PlanCardLicenseDetails = () => { {hasCopiedSiteURL ? ( ) : ( - copySiteURL()} /> + !hasCopiedSiteURL && copySiteURL()} /> )}
@@ -45,26 +51,14 @@ const PlanCardLicenseDetails = () => { {hasCopiedHashed ? ( ) : ( - copyHashed()} /> + !hasCopiedHashed && copyHashed()} /> )} {hashedSiteURL}
- - - {t('License_key')} - {enterpriseLicense && } - - {enterpriseLicense ? ( - - {enterpriseLicense} - - ) : ( - {t('Add_license')} - )} - + {t('Manage_license')} ); }; diff --git a/apps/meteor/client/views/admin/subscription/hooks/useValidateLicense.ts b/apps/meteor/client/views/admin/subscription/hooks/useValidateLicense.ts index c11386ebce0b6..6253345e76007 100644 --- a/apps/meteor/client/views/admin/subscription/hooks/useValidateLicense.ts +++ b/apps/meteor/client/views/admin/subscription/hooks/useValidateLicense.ts @@ -11,7 +11,7 @@ export const isPlausibleLicense = (license: string): boolean => license.trim().l const isValidationFailure = (error: unknown): error is { reasons: BehaviorWithContext[] } => typeof error === 'object' && error !== null && Array.isArray((error as { reasons?: unknown }).reasons); -export const useValidateLicense = (license: string) => { +export const useValidateLicense = (license: string, enabled = true) => { const validateLicense = useEndpoint('POST', '/v1/licenses.validate'); const trimmedLicense = license.trim(); @@ -28,7 +28,7 @@ export const useValidateLicense = (license: string) => { throw error; } }, - enabled: isPlausibleLicense(trimmedLicense), + enabled: enabled && isPlausibleLicense(trimmedLicense), staleTime: Infinity, gcTime: Infinity, retry: false, diff --git a/packages/i18n/src/locales/en.i18n.json b/packages/i18n/src/locales/en.i18n.json index 16a25861a4260..4d8bb8bf8c7b7 100644 --- a/packages/i18n/src/locales/en.i18n.json +++ b/packages/i18n/src/locales/en.i18n.json @@ -489,7 +489,6 @@ "Add_email": "Add email", "Add_emoji": "Add emoji", "Add_files_from": "Add files from", - "Add_license": "Add license", "Add_link": "Add link", "Add_manager": "Add manager", "Add_members": "Add Members", @@ -3416,6 +3415,7 @@ "Managers": "Managers", "Managing_assets": "Managing assets", "Managing_integrations": "Managing integrations", + "Manual_license_management_deprecated": "Manual license management (deprecated)", "Manual_Selection": "Manual Selection", "Manually_created_users_briefing": "Manually created users will initially be shown as pending. Once they log in for the first time, they will be shown as active.", "Manufacturing": "Manufacturing", From 0e7b205e1cbefa00ce775a4a12f3c3d4f28cb33b Mon Sep 17 00:00:00 2001 From: Diego Sampaio Date: Wed, 15 Jul 2026 15:21:49 -0300 Subject: [PATCH 142/220] =?UTF-8?q?chore:=20reorganize=20backend=20folder?= =?UTF-8?q?=20structure=20=E2=80=94=20Phase=207=20(omnichannel=20and=20fin?= =?UTF-8?q?al=20cleanup)=20(#41381)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/CODEOWNERS | 19 +- apps/meteor/.mocharc.js | 9 +- apps/meteor/MIGRATION_PLAN.md | 820 ------------------ .../app/apps/server/bridges/commands.ts | 2 +- .../meteor/app/apps/server/bridges/contact.ts | 4 +- apps/meteor/app/apps/server/bridges/email.ts | 2 +- apps/meteor/app/apps/server/bridges/http.ts | 2 +- .../app/apps/server/bridges/livechat.ts | 20 +- .../server/bridges/outboundCommunication.ts | 2 +- .../app/apps/server/bridges/settings.ts | 2 +- apps/meteor/app/apps/server/bridges/users.ts | 2 +- apps/meteor/app/authorization/server/index.ts | 7 - .../app/channel-settings/server/index.ts | 2 - apps/meteor/app/custom-oauth/.gitignore | 1 - apps/meteor/app/error-handler/server/index.ts | 1 - apps/meteor/app/lib/server/index.ts | 12 - apps/meteor/app/lib/server/lib/index.ts | 15 - apps/meteor/app/lib/server/lib/msgStream.ts | 3 - apps/meteor/app/lib/server/startup/index.ts | 2 - .../app/livechat/lib/stream/constants.ts | 1 - apps/meteor/app/livechat/server/index.ts | 24 - apps/meteor/app/logger/README.md | 79 -- .../app/oauth2-server-config/.gitignore | 1 - .../app/oauth2-server-config/server/index.ts | 4 - apps/meteor/app/retention-policy/README.md | 0 apps/meteor/app/settings/server/index.ts | 24 - apps/meteor/app/ui-utils/server/index.ts | 1 - apps/meteor/app/user-status/server/index.ts | 5 - .../app/livechat-enterprise/server/index.ts | 39 - apps/meteor/ee/server/api/abac/index.ts | 2 +- apps/meteor/ee/server/api/api.ts | 2 +- apps/meteor/ee/server/api/ldap.ts | 2 +- apps/meteor/ee/server/api/licenses.ts | 4 +- apps/meteor/ee/server/api/roles.ts | 2 +- .../ee/server/api/v1/omnichannel/agents.ts | 6 +- .../api/v1/omnichannel/business-hours.ts | 2 +- .../ee/server/api/v1/omnichannel/contacts.ts | 2 +- .../server/api/v1/omnichannel/departments.ts | 6 +- .../server/api/v1/omnichannel/lib/contacts.ts | 2 +- .../api/v1/omnichannel/lib/departments.ts | 2 +- .../server/api/v1/omnichannel/lib/outbound.ts | 2 +- .../api/v1/omnichannel/lib/priorities.ts | 4 +- .../ee/server/api/v1/omnichannel/lib/sla.ts | 2 +- .../ee/server/api/v1/omnichannel/lib/tags.ts | 2 +- .../ee/server/api/v1/omnichannel/monitors.ts | 2 +- .../ee/server/api/v1/omnichannel/outbound.ts | 2 +- .../server/api/v1/omnichannel/priorities.ts | 2 +- .../ee/server/api/v1/omnichannel/reports.ts | 2 +- .../ee/server/api/v1/omnichannel/sla.ts | 2 +- .../ee/server/api/v1/omnichannel/tags.ts | 2 +- .../server/api/v1/omnichannel/transcript.ts | 2 +- .../ee/server/api/v1/omnichannel/triggers.ts | 2 +- .../ee/server/api/v1/omnichannel/units.ts | 4 +- apps/meteor/ee/server/apps/appRequestsCron.ts | 2 +- .../ee/server/apps/communication/rest.ts | 2 +- .../ee/server/apps/communication/uikit.ts | 2 +- .../ee/server/apps/marketplace/appInstall.ts | 2 +- .../apps/marketplace/fetchMarketplaceApps.ts | 2 +- .../marketplace/fetchMarketplaceCategories.ts | 2 +- apps/meteor/ee/server/apps/orchestrator.js | 2 +- apps/meteor/ee/server/apps/startup.ts | 2 +- apps/meteor/ee/server/configuration/abac.ts | 2 +- apps/meteor/ee/server/configuration/ldap.ts | 2 +- apps/meteor/ee/server/configuration/oauth.ts | 2 +- apps/meteor/ee/server/configuration/saml.ts | 2 +- .../server/cron/readReceiptsArchive.spec.ts | 4 +- .../ee/server/cron/readReceiptsArchive.ts | 2 +- .../server/hooks/abac/beforeAddUserToRoom.ts | 2 +- .../hooks/abac/scopeAdminRoomsForAbac.ts | 2 +- .../hooks/canned-responses/cannedResponses.ts | 2 +- .../ee/server/hooks/federation/index.ts | 2 +- .../hooks/messages/afterReadMessages.ts | 2 +- .../omnichannel/addDepartmentAncestors.ts | 2 +- .../afterForwardChatToDepartment.ts | 2 +- .../hooks/omnichannel/afterInquiryQueued.ts | 6 +- .../server/hooks/omnichannel/afterOnHold.ts | 6 +- .../omnichannel/afterOnHoldChatResumed.ts | 4 +- .../omnichannel/afterRemoveDepartment.ts | 2 +- .../omnichannel/afterReturnRoomAsInquiry.ts | 2 +- .../hooks/omnichannel/afterTakeInquiry.ts | 14 +- .../omnichannel/applyRoomRestrictions.ts | 2 +- .../applySimultaneousChatsRestrictions.ts | 2 +- .../hooks/omnichannel/beforeJoinRoom.ts | 4 +- .../server/hooks/omnichannel/beforeNewRoom.ts | 2 +- .../hooks/omnichannel/beforeRoutingChat.ts | 16 +- .../checkAgentBeforeTakeInquiry.ts | 10 +- .../handleNextAgentPreferredEvents.ts | 10 +- .../omnichannel/onAgentAssignmentFailed.ts | 2 +- .../hooks/omnichannel/onBusinessHourStart.ts | 4 +- .../hooks/omnichannel/onCloseLivechat.ts | 6 +- .../hooks/omnichannel/onLoadConfigApi.ts | 2 +- .../hooks/omnichannel/onTransferFailure.ts | 6 +- .../server/hooks/omnichannel/resumeOnHold.ts | 2 +- .../hooks/omnichannel/scheduleAutoTransfer.ts | 6 +- .../omnichannel/sendPdfTranscriptOnClose.ts | 4 +- .../setPredictedVisitorAbandonmentTime.ts | 4 +- apps/meteor/ee/server/index.ts | 4 +- .../lib/authorization}/guestPermissions.ts | 0 .../resetEnterprisePermissions.ts | 2 +- .../server/lib/canned-responses/settings.ts | 2 +- .../ee/server/lib/deviceManagement/session.ts | 4 +- .../ee/server/lib/deviceManagement/startup.ts | 2 +- .../meteor/ee/server/lib/ldap/Manager.spec.ts | 4 +- apps/meteor/ee/server/lib/ldap/Manager.ts | 4 +- .../server/lib/ldap/copyCustomFieldsLDAP.ts | 2 +- .../lib/license/airGappedRestrictions.ts | 2 +- .../lib/license/license.internalService.ts | 2 +- apps/meteor/ee/server/lib/license/settings.ts | 2 +- apps/meteor/ee/server/lib/license/startup.ts | 4 +- .../lib/message-read-receipt/ReadReceipt.ts | 4 +- apps/meteor/ee/server/lib/oauth/Manager.ts | 2 +- .../omnichannel}/AutoCloseOnHoldScheduler.ts | 2 +- .../omnichannel}/AutoTransferChatScheduler.ts | 8 +- .../lib/omnichannel}/Department.ts | 0 .../lib => server/lib/omnichannel}/Helper.ts | 8 +- .../lib/omnichannel}/LivechatEnterprise.ts | 6 +- .../omnichannel}/QueueInactivityMonitor.ts | 6 +- .../lib/omnichannel}/SlaHelper.ts | 4 +- .../omnichannel}/VisitorInactivityMonitor.ts | 10 +- .../lib/omnichannel}/business-hour/Custom.ts | 10 +- .../lib/omnichannel}/business-hour/Helper.ts | 6 +- .../omnichannel}/business-hour/Multiple.ts | 14 +- .../lib/omnichannel}/business-hour/index.ts | 0 .../business-hour/lib/business-hour.ts | 2 +- .../lib/omnichannel}/debounceByParams.ts | 0 .../meteor/ee/server/lib/omnichannel/index.ts | 39 + .../lib => server/lib/omnichannel}/logger.ts | 0 .../lib/omnichannel}/outboundcomms/rest.ts | 2 +- .../lib/omnichannel}/permissions.ts | 0 .../lib/omnichannel}/priorities.ts | 0 .../lib/omnichannel}/requestPdfTranscript.ts | 0 .../lib/omnichannel}/restrictQuery.ts | 0 .../lib/omnichannel}/routing/LoadBalancing.ts | 8 +- .../lib/omnichannel}/routing/LoadRotation.ts | 8 +- .../lib/omnichannel}/settings.ts | 2 +- .../lib/omnichannel}/startup.ts | 12 +- .../lib => server/lib/omnichannel}/unit.ts | 4 +- apps/meteor/ee/server/lib/roles/insertRole.ts | 2 +- apps/meteor/ee/server/lib/roles/updateRole.ts | 2 +- apps/meteor/ee/server/lib/syncUserRoles.ts | 2 +- .../omnichannel.internalService.ts | 12 +- .../ee/server/meteor-methods/license.ts | 2 +- .../ee/server/patches/closeBusinessHour.ts | 4 +- .../ee/server/patches/fetchContactHistory.ts | 2 +- .../isAgentAvailableToTakeContactInquiry.ts | 6 +- .../meteor/ee/server/patches/mergeContacts.ts | 8 +- .../ee/server/patches/verifyContactChannel.ts | 8 +- apps/meteor/ee/server/settings/abac.ts | 2 +- .../server/settings/contact-verification.ts | 2 +- .../ee/server/settings/deviceManagement.ts | 2 +- .../server => server/settings}/index.ts | 0 apps/meteor/ee/server/settings/ldap.ts | 2 +- .../ee/server/settings/outlookCalendar.ts | 2 +- apps/meteor/ee/server/settings/saml.ts | 2 +- .../settings}/settings.internalService.ts | 0 .../server => server/settings}/settings.ts | 4 +- .../ee/server/settings/video-conference.ts | 2 +- apps/meteor/ee/server/settings/voip.ts | 2 +- apps/meteor/ee/server/startup/federation.ts | 2 +- .../ee/server/startup/readReceiptsArchive.ts | 2 +- apps/meteor/ee/server/startup/services.ts | 4 +- apps/meteor/ee/server/startup/upsell.ts | 2 +- ...AgentAvailableToTakeContactInquiry.spec.ts | 2 +- .../server/lib/mergeContacts.spec.ts | 8 +- .../server/lib/verifyContactChannel.spec.ts | 8 +- .../airgappedRestrictions.spec.ts | 2 +- .../omnichannel/afterInquiryQueued.spec.ts | 6 +- .../server/lib/license}/canEnableApp.spec.ts | 2 +- .../lib/omnichannel}/AutoCloseOnHold.tests.ts | 4 +- .../AutoTransferChatsScheduler.tests.ts | 10 +- .../lib/omnichannel}/Helper.tests.ts | 8 +- .../QueueInactivityMonitor.spec.ts | 8 +- .../omnichannel}/business-hour/Custom.spec.ts | 6 +- .../omnichannel}/requestPdfTranscript.spec.ts | 20 +- .../lib/omnichannel}/restrictQuery.tests.ts | 2 +- apps/meteor/jest.config.ts | 7 +- .../migration/check-broken-imports.mjs | 72 -- .../scripts/migration/check-mock-keys.mjs | 106 --- apps/meteor/scripts/migration/move-batch.mjs | 93 -- apps/meteor/scripts/migration/move-module.mjs | 368 -------- .../scripts/migration/phase1-commands.tsv | 20 - .../scripts/migration/phase2-bridges.tsv | 7 - .../migration/phase4-ee-authorization.tsv | 6 - .../scripts/migration/phase4-test-mirrors.tsv | 17 - .../scripts/migration/phase4a-users.tsv | 26 - .../scripts/migration/phase4b-rooms.tsv | 21 - .../scripts/migration/phase4c-messages.tsv | 14 - .../scripts/migration/phase4d-other.tsv | 11 - .../scripts/migration/phase5-ee-methods.tsv | 7 - .../migration/phase5a-flat-methods.tsv | 49 -- .../scripts/migration/phase5b-lib-methods.tsv | 37 - .../migration/phase5c-feature-methods.tsv | 33 - .../migration/phase6a-auth-providers.tsv | 31 - .../migration/phase6a-followup-oauth.tsv | 3 - .../scripts/migration/phase6b-ee-hooks.tsv | 8 - .../scripts/migration/phase6b-hooks.tsv | 13 - .../migration/phase6c-notifications.tsv | 10 - .../scripts/migration/phase6d-messaging.tsv | 14 - .../migration/phase6e-media-import-libs.tsv | 49 -- .../migration/verify-no-old-imports.mjs | 78 -- apps/meteor/server/api/ApiClass.ts | 14 +- apps/meteor/{app => server}/api/README.md | 0 apps/meteor/server/api/api.helpers.ts | 4 +- apps/meteor/server/api/api.ts | 2 +- apps/meteor/server/api/default/openApi.ts | 2 +- apps/meteor/server/api/definition.ts | 2 +- .../api/lib/composeRoomWithLastMessage.ts | 2 +- apps/meteor/server/api/lib/emailInbox.ts | 2 +- .../server/api/lib/getPaginationItems.ts | 2 +- .../server/api/lib/getServerInfo.spec.ts | 2 +- apps/meteor/server/api/lib/getServerInfo.ts | 2 +- .../meteor/server/api/lib/getUserInfo.spec.ts | 4 +- apps/meteor/server/api/lib/getUserInfo.ts | 6 +- .../api/lib/maybeMigrateLivechatRoom.ts | 2 +- apps/meteor/server/api/lib/parseJsonQuery.ts | 2 +- apps/meteor/server/api/lib/rooms.ts | 2 +- apps/meteor/server/api/lib/users.ts | 2 +- apps/meteor/server/api/v1/assets.ts | 4 +- apps/meteor/server/api/v1/autotranslate.ts | 4 +- apps/meteor/server/api/v1/channels.ts | 6 +- apps/meteor/server/api/v1/chat.ts | 6 +- apps/meteor/server/api/v1/commands.ts | 2 +- .../server/api/v1/custom-user-status.ts | 4 +- apps/meteor/server/api/v1/e2e.ts | 2 +- apps/meteor/server/api/v1/emoji-custom.ts | 2 +- apps/meteor/server/api/v1/groups.ts | 4 +- apps/meteor/server/api/v1/im.ts | 4 +- apps/meteor/server/api/v1/invites.ts | 12 +- apps/meteor/server/api/v1/ldap.ts | 2 +- .../api/v1/middlewares/authentication.ts | 2 +- .../api/v1/middlewares/authenticationHono.ts | 2 +- .../server/api/v1/middlewares/cors.spec.ts | 2 +- apps/meteor/server/api/v1/middlewares/cors.ts | 2 +- .../server/api/v1/middlewares/metrics.spec.ts | 2 +- .../server/api/v1/middlewares/metrics.ts | 2 +- apps/meteor/server/api/v1/misc.ts | 12 +- apps/meteor/server/api/v1/oauthapps.ts | 6 +- .../meteor/server/api/v1/omnichannel/agent.ts | 8 +- .../server/api/v1/omnichannel/appearance.ts | 2 +- .../api/v1/omnichannel/businessHours.ts | 2 +- .../server/api/v1/omnichannel/config.ts | 6 +- .../server/api/v1/omnichannel/contact.ts | 16 +- .../server/api/v1/omnichannel/customField.ts | 2 +- .../server/api/v1/omnichannel/dashboards.ts | 2 +- .../server/api/v1/omnichannel/departments.ts | 6 +- .../server/api/v1/omnichannel/inquiries.ts | 4 +- .../server/api/v1/omnichannel/integration.ts | 2 +- .../api/v1/omnichannel/lib/businessHours.ts | 2 +- .../api/v1/omnichannel/lib/inquiries.ts | 2 +- .../server/api/v1/omnichannel/lib/livechat.ts | 4 +- .../server/api/v1/omnichannel/message.ts | 6 +- .../api/v1/omnichannel/offlineMessage.ts | 2 +- .../server/api/v1/omnichannel/pageVisited.ts | 2 +- apps/meteor/server/api/v1/omnichannel/room.ts | 18 +- apps/meteor/server/api/v1/omnichannel/sms.ts | 8 +- .../server/api/v1/omnichannel/statistics.ts | 4 +- .../server/api/v1/omnichannel/transcript.ts | 2 +- .../server/api/v1/omnichannel/upload.ts | 4 +- .../meteor/server/api/v1/omnichannel/users.ts | 2 +- .../server/api/v1/omnichannel/visitor.ts | 10 +- .../server/api/v1/omnichannel/visitors.ts | 4 +- .../server/api/v1/omnichannel/webhooks.ts | 2 +- apps/meteor/server/api/v1/permissions.ts | 4 +- apps/meteor/server/api/v1/push.ts | 2 +- apps/meteor/server/api/v1/roles.ts | 4 +- apps/meteor/server/api/v1/rooms.ts | 6 +- apps/meteor/server/api/v1/settings.ts | 10 +- apps/meteor/server/api/v1/teams.ts | 4 +- apps/meteor/server/api/v1/users.ts | 8 +- apps/meteor/server/api/webhooks.ts | 8 +- .../server/bridges/irc/irc-bridge/index.js | 6 +- .../irc-bridge/peerHandlers/disconnected.js | 2 +- .../irc-bridge/peerHandlers/nickChanged.js | 2 +- .../irc-bridge/peerHandlers/userRegistered.js | 2 +- .../bridges/irc/methods/resetIrcConnection.ts | 4 +- .../bridges/nextcloud/addWebdavServer.ts | 2 +- apps/meteor/server/bridges/nextcloud/lib.ts | 2 +- .../bridges/slack}/README.md | 0 .../server/bridges/slack/RocketAdapter.ts | 2 +- .../server/bridges/slack/SlackAdapter.ts | 6 +- .../bridges/slack/removeChannelLinks.ts | 2 +- .../server/bridges/slack/slackbridge.ts | 2 +- .../slack/slackbridge_import.server.ts | 4 +- .../bridges/smarsh/functions/generateEml.ts | 2 +- .../bridges/smarsh/functions/sendEmail.ts | 2 +- apps/meteor/server/bridges/smarsh/startup.ts | 2 +- .../webdav/methods/addWebdavAccount.ts | 2 +- .../webdav/methods/getFileFromWebdav.ts | 2 +- .../webdav/methods/getWebdavFileList.ts | 2 +- .../webdav/methods/getWebdavFilePreview.ts | 2 +- .../webdav/methods/uploadFileToWebdav.ts | 2 +- apps/meteor/server/configuration/cas.ts | 2 +- .../server/configuration/configureAssets.ts | 2 +- .../configuration/configureBoilerplate.ts | 2 +- .../server/configuration/configureCDN.ts | 2 +- .../server/configuration/configureCORS.ts | 4 +- .../configuration/configureDirectReply.ts | 4 +- .../server/configuration/configureIRC.ts | 2 +- .../server/configuration/configureLogLevel.ts | 2 +- .../server/configuration/configurePassport.ts | 2 +- .../server/configuration/configureSMTP.ts | 2 +- apps/meteor/server/configuration/index.ts | 2 +- apps/meteor/server/configuration/ldap.ts | 2 +- apps/meteor/server/configuration/oauth.ts | 2 +- .../server/configuration/pushNotification.ts | 2 +- apps/meteor/server/cron/nps.ts | 2 +- apps/meteor/server/cron/userDataDownloads.ts | 2 +- apps/meteor/server/email/IMAPInterceptor.ts | 2 +- .../server/features/EmailInbox/EmailInbox.ts | 2 +- .../EmailInbox/EmailInbox_Incoming.ts | 10 +- .../EmailInbox/EmailInbox_Outgoing.ts | 6 +- .../lib => server/hooks}/afterUserActions.ts | 6 +- apps/meteor/server/hooks/auth/login.ts | 2 +- .../messages}/mentionUserNotInChannel.ts | 8 +- .../hooks/messages/notifyUsersOnMessage.ts | 8 +- .../server/hooks/messages/processThreads.ts | 4 +- .../messages/propagateDiscussionMetadata.ts | 2 +- .../messages/sendNotificationsOnMessage.ts | 12 +- .../hooks/omnichannel/afterAgentRemoved.ts | 2 +- .../hooks/omnichannel/afterUserActions.ts | 2 +- .../server/hooks/omnichannel/leadCapture.ts | 2 +- .../hooks/omnichannel/markRoomResponded.ts | 6 +- .../hooks/omnichannel/offlineMessage.ts | 4 +- .../omnichannel/offlineMessageToChannel.ts | 2 +- .../omnichannel/processRoomAbandonment.ts | 6 +- .../hooks/omnichannel/saveAnalyticsData.ts | 6 +- .../omnichannel/saveLastMessageToInquiry.ts | 6 +- .../omnichannel/sendEmailTranscriptOnClose.ts | 4 +- .../server/hooks/omnichannel/sendToCRM.ts | 8 +- apps/meteor/server/importPackages.ts | 33 +- .../server/lib/2fa/code/EmailCheck.spec.ts | 2 +- apps/meteor/server/lib/2fa/code/EmailCheck.ts | 2 +- .../lib/2fa/code/PasswordCheckFallback.ts | 2 +- apps/meteor/server/lib/2fa/code/TOTPCheck.ts | 2 +- .../lib/2fa/code/checkCodeForUser.spec.ts | 2 +- apps/meteor/server/lib/2fa/code/index.spec.ts | 2 +- apps/meteor/server/lib/2fa/code/index.ts | 2 +- .../server/lib/2fa/functions/resetTOTP.ts | 4 +- apps/meteor/server/lib/2fa/lib/totp.ts | 2 +- .../{app/lib => }/server/lib/RateLimiter.js | 0 .../auth-providers/apple/AppleCustomOAuth.ts | 4 +- .../apple/appleOauthRegisterService.ts | 2 +- .../apple/applePassportOAuth.ts | 4 +- .../apple}/handleIdentityToken.spec.ts | 0 .../apple}/handleIdentityToken.ts | 0 .../auth-providers/apple/loginHandler.spec.ts | 8 +- .../lib/auth-providers/apple/loginHandler.ts | 4 +- .../server/lib/auth-providers/crowd/crowd.ts | 4 +- .../auth-providers}/custom-oauth/README.md | 0 .../custom-oauth/customOAuth.ts | 4 +- .../custom-oauth/custom_oauth_server.js | 4 +- .../server/lib/auth-providers/dolphin.ts | 2 +- .../lib/auth-providers/drupal.README.md} | 0 .../server/lib/auth-providers/drupal.ts | 2 +- .../lib/auth-providers/github-enterprise.ts | 2 +- .../server/lib/auth-providers/gitlab.ts | 2 +- .../server/lib/auth-providers/linkedin.ts | 2 +- .../lib/auth-providers/meteor-developer.ts | 2 +- .../server/lib/auth-providers/oauth/proxy.js | 2 +- .../server/lib/auth-providers/wordpress.ts | 2 +- .../lib/auth}/generatePassword.ts | 0 .../server/lib/auth/logLoginAttempts.ts | 2 +- .../lib/auth}/loginErrorMessageOverride.ts | 0 .../lib/auth/oauth2-server}/addOAuthApp.ts | 4 +- .../server/lib/auth/oauth2-server/index.ts | 4 + .../lib/auth/oauth2-server}/oauth2-server.ts | 4 +- .../lib/auth/oauth2-server}/parseUriList.ts | 0 .../lib => server/lib/auth}/passwordPolicy.ts | 2 +- .../server/lib/auth/restrictLoginAttempts.ts | 2 +- apps/meteor/server/lib/auth/startup.js | 6 +- .../lib}/authorization/README.md | 0 .../lib/authorization/canDeleteMessage.ts | 2 +- .../authorization}/constant/permissions.ts | 0 apps/meteor/server/lib/authorization/index.ts | 7 + .../lib/authorization}/isABACManagedRoom.ts | 2 +- .../lib/authorization/permissionRole.ts | 2 +- .../streamer/permissions/index.ts | 0 .../lib/authorization/upsertPermissions.ts | 4 +- .../lib}/autotranslate/README.md | 0 .../server/lib/autotranslate/autotranslate.ts | 4 +- .../lib/autotranslate/deeplTranslate.ts | 2 +- .../functions/getSupportedLanguages.ts | 2 +- .../autotranslate/functions/saveSettings.ts | 2 +- .../lib/autotranslate/googleTranslate.ts | 2 +- .../lib/autotranslate/libreTranslate.ts | 2 +- .../server/lib/autotranslate/msTranslate.ts | 2 +- apps/meteor/server/lib/banUserFromRoom.ts | 2 +- apps/meteor/server/lib/bot-helpers/index.ts | 2 +- .../{app/lib => }/server/lib/bugsnag.ts | 4 +- apps/meteor/server/lib/callbacks.ts | 4 +- .../server/lib/cas/findExistingCASUser.ts | 2 +- .../server/lib/cas/loginHandler.spec.ts | 2 +- apps/meteor/server/lib/cas/loginHandler.ts | 2 +- apps/meteor/server/lib/cas/middleware.ts | 2 +- .../meteor/server/lib/cas/updateCasService.ts | 2 +- .../server/lib/cloud/buildRegistrationData.ts | 2 +- .../server/lib/cloud/connectWorkspace.ts | 2 +- .../lib/cloud/finishOAuthAuthorization.ts | 2 +- .../meteor/server/lib/cloud/getCheckoutUrl.ts | 4 +- .../server/lib/cloud/getConfirmationPoll.ts | 2 +- .../lib/cloud/getOAuthAuthorizationUrl.ts | 4 +- .../meteor/server/lib/cloud/getRedirectUri.ts | 2 +- .../cloud/getWorkspaceAccessTokenWithScope.ts | 2 +- .../server/lib/cloud/getWorkspaceKey.ts | 2 +- .../server/lib/cloud/getWorkspaceLicense.ts | 2 +- .../cloud/registerPreIntentWorkspaceWizard.ts | 2 +- apps/meteor/server/lib/cloud/removeLicense.ts | 2 +- .../cloud/removeWorkspaceRegistrationInfo.ts | 2 +- .../lib/cloud/retrieveRegistrationStatus.ts | 2 +- .../server/lib/cloud/saveRegistrationData.ts | 4 +- .../lib/cloud/startRegisterWorkspace.ts | 4 +- .../startRegisterWorkspaceSetupWizard.ts | 2 +- .../supportedVersionsToken.ts | 4 +- .../cloud/syncWorkspace/announcementSync.ts | 4 +- .../fetchWorkspaceSyncPayload.ts | 2 +- .../syncWorkspace/legacySyncWorkspace.ts | 4 +- apps/meteor/server/lib/cloud/userLogout.ts | 2 +- .../buildVersionUpdateMessage.spec.ts | 4 +- .../functions/buildVersionUpdateMessage.ts | 4 +- .../server/lib/cloud/version-check/index.ts | 2 +- .../server/lib/compareUserPasswordHistory.ts | 2 +- .../cors/server => server/lib/cors}/cors.ts | 4 +- .../cors/server => server/lib/cors}/index.ts | 2 +- .../dataExport/exportRoomMessagesToFile.ts | 2 +- .../dataExport/processDataDownloads.spec.ts | 8 +- .../lib/dataExport/processDataDownloads.ts | 4 +- .../meteor/server/lib/dataExport/sendEmail.ts | 2 +- apps/meteor/server/lib/dataExport/sendFile.ts | 2 +- .../server/lib/dataExport/sendViaEmail.ts | 4 +- apps/meteor/{app/lib => }/server/lib/debug.js | 8 +- .../server/lib/defaultBlockedDomainsList.ts | 0 .../server/lib/deprecationWarningLogger.ts | 2 +- .../meteor/server/lib/e2e/beforeCreateRoom.ts | 2 +- .../e2e/functions/handleSuggestedGroupKey.ts | 2 +- .../provideUsersSuggestedGroupKeys.ts | 2 +- .../server/lib/e2e/functions/resetRoomKey.ts | 2 +- .../error-handler}/RocketChat.ErrorHandler.ts | 6 +- apps/meteor/server/lib/error-handler/index.ts | 1 + apps/meteor/server/lib/findUsersOfRoom.ts | 2 +- .../lib/findUsersOfRoomOrderedByRole.ts | 2 +- ...tSubscriptionAutotranslateDefaultConfig.ts | 2 +- .../server/lib/import/classes/Importer.ts | 2 +- .../classes/converters/ContactConverter.ts | 6 +- .../classes/converters/RoomConverter.ts | 2 +- .../classes/converters/UserConverter.ts | 2 +- .../server/lib/import/csv/CsvImporter.ts | 2 +- .../import/slack-users/SlackUsersImporter.ts | 2 +- .../server/lib/import/slack/SlackImporter.ts | 6 +- .../meteor/server/lib/import/startup/store.js | 2 +- .../lib/integrations/lib/triggerHandler.ts | 4 +- .../lib/integrations/lib/updateHistory.ts | 2 +- apps/meteor/server/lib/ldap/Connection.ts | 2 +- apps/meteor/server/lib/ldap/Manager.ts | 2 +- apps/meteor/server/lib/ldap/UserConverter.ts | 2 +- .../lib/ldap/getLDAPConditionalSetting.ts | 2 +- apps/meteor/server/lib/media/assets/assets.ts | 6 +- .../custom-sounds/startup/custom-sounds.js | 2 +- .../emoji-custom/startup/emoji-custom.js | 2 +- .../lib/media/file-upload/config/AmazonS3.ts | 2 +- .../media/file-upload/config/FileSystem.ts | 2 +- .../media/file-upload/config/GoogleStorage.ts | 2 +- .../lib/media/file-upload/config/Webdav.ts | 2 +- .../config/_configUploadStorage.ts | 2 +- .../server/lib/media/file-upload/index.ts | 2 +- .../media/file-upload/lib/FileUpload.spec.ts | 6 +- .../lib/media/file-upload/lib/FileUpload.ts | 6 +- .../media}/file-upload/lib/FileUploadBase.ts | 2 +- .../server/lib/messages/attachMessage.ts | 4 +- .../server/lib/messages/deleteMessage.ts | 8 +- .../server/lib/messages/isTheLastMessage.ts | 2 +- .../server/lib/messages/loadMessageHistory.ts | 6 +- .../server/lib/messages/parseUrlsInMessage.ts | 2 +- .../lib/messages/processWebhookMessage.ts | 2 +- .../meteor/server/lib/messages/sendMessage.ts | 6 +- .../server/lib/messages/updateMessage.ts | 6 +- .../lib/messaging}/Message.ts | 4 +- .../lib/messaging}/getHiddenSystemMessages.ts | 0 .../mentions/getMentionedTeamMembers.ts | 2 +- apps/meteor/server/lib/messaging/msgStream.ts | 3 + .../server/lib/messaging/pins/pinMessage.ts | 10 +- .../lib/messaging/reactions/setReaction.ts | 4 +- .../server/lib/messaging/stars/starMessage.ts | 8 +- .../lib/messaging}/threads/README.md | 0 .../server/lib/messaging/threads/functions.ts | 5 +- .../lib/messaging/unread/unreadMessages.ts | 4 +- .../messaging}/validateCustomMessageFields.ts | 0 .../server/lib/metrics/lib/collectMetrics.ts | 2 +- .../lib/moderation/deleteReportedMessages.ts | 2 +- .../server/lib/notifications/email/api.ts | 4 +- .../interceptDirectReplyEmails.js | 4 +- .../mail-messages/functions/sendMail.ts | 2 +- .../lib/notifications/message}/desktop.ts | 6 +- .../lib/notifications/message}/email.js | 16 +- .../lib/notifications/message}/index.ts | 6 +- .../message}/messageContainsHighlight.ts | 0 .../lib/notifications/message}/mobile.js | 8 +- .../lib/notifications}/processDirectEmail.ts | 10 +- .../push-config/lib/PushNotification.ts | 6 +- .../server/lib/notifications/push/push.ts | 2 +- .../notifications/queue/NotificationQueue.ts | 2 +- .../lib => }/server/lib/notifyListener.ts | 4 +- .../server/lib/oauth/addOAuthService.ts | 2 +- .../lib/oauth/addPassportCustomOAuth.ts | 2 +- .../lib/oauth/allowPassportOAuthMiddleware.ts | 2 +- .../lib/oauth/configureOAuthServices.ts | 2 +- .../lib/oauth/createOAuthServiceConfig.ts | 2 +- .../server/lib/oauth/getOAuthServices.ts | 2 +- .../server/lib/oauth/updateOAuthServices.ts | 7 +- .../lib/omnichannel}/AnalyticsTyped.ts | 0 .../lib => server/lib/omnichannel}/Assets.ts | 0 .../lib => server/lib/omnichannel}/Helper.ts | 12 +- .../lib/omnichannel}/QueueManager.ts | 14 +- .../lib/omnichannel}/RoutingManager.ts | 6 +- .../lib/omnichannel}/Visitors.ts | 0 .../lib/omnichannel}/analytics/agents.ts | 0 .../lib/omnichannel}/analytics/dashboards.ts | 4 +- .../lib/omnichannel}/analytics/departments.ts | 2 +- .../business-hour/AbstractBusinessHour.ts | 2 +- .../business-hour/BusinessHourManager.ts | 8 +- .../lib/omnichannel}/business-hour/Default.ts | 0 .../lib/omnichannel}/business-hour/Helper.ts | 4 +- .../business-hour/LivechatBusinessHours.ts | 0 .../lib/omnichannel}/business-hour/Single.ts | 4 +- .../business-hour/closeBusinessHour.ts | 2 +- ...ilterBusinessHoursThatMustBeOpened.spec.ts | 0 .../filterBusinessHoursThatMustBeOpened.ts | 0 .../getAgentIdsForBusinessHour.ts | 0 .../lib/omnichannel}/business-hour/index.ts | 2 +- .../lib/omnichannel/closeLivechatRoom.ts | 4 +- .../closeOmnichannelConversations.ts | 4 +- .../lib/omnichannel}/closeRoom.ts | 8 +- .../lib/omnichannel}/conditionalLockAgent.ts | 4 +- .../omnichannel}/contacts/ContactMerger.ts | 2 +- .../omnichannel}/contacts/addContactEmail.ts | 0 .../omnichannel}/contacts/createContact.ts | 0 .../contacts/createContactFromVisitor.ts | 0 .../omnichannel}/contacts/disableContact.ts | 2 +- .../contacts/getAllowedCustomFields.ts | 0 .../contacts/getContactChannelsGrouped.ts | 0 .../contacts/getContactHistory.ts | 0 .../contacts/getContactIdByVisitor.ts | 0 .../contacts/getContactManagerIdByUsername.ts | 0 .../lib/omnichannel}/contacts/getContacts.ts | 0 .../isAgentAvailableToTakeContactInquiry.ts | 0 .../isVerifiedChannelInSource.spec.ts | 0 .../contacts/isVerifiedChannelInSource.ts | 0 .../contacts/mapVisitorToContact.spec.ts | 0 .../contacts/mapVisitorToContact.ts | 0 .../omnichannel}/contacts/mergeContacts.ts | 0 .../migrateVisitorIfMissingContact.ts | 0 .../migrateVisitorToContactId.spec.ts | 0 .../contacts/migrateVisitorToContactId.ts | 0 .../lib/omnichannel}/contacts/patchContact.ts | 0 .../contacts/registerContact.spec.ts | 1 - .../omnichannel}/contacts/registerContact.ts | 8 +- .../contacts/resolveContactConflicts.spec.ts | 0 .../contacts/resolveContactConflicts.ts | 2 +- .../contacts/updateContact.spec.ts | 0 .../omnichannel}/contacts/updateContact.ts | 2 +- .../contacts/validateContactManager.spec.ts | 0 .../contacts/validateContactManager.ts | 0 .../contacts/validateCustomFields.spec.ts | 0 .../contacts/validateCustomFields.ts | 4 +- .../contacts/verifyContactChannel.ts | 0 .../lib/omnichannel}/custom-fields.ts | 2 +- .../lib/omnichannel}/departmentsLib.ts | 9 +- .../lib/omnichannel}/getRoomMessages.ts | 0 .../lib => server/lib/omnichannel}/guests.ts | 14 +- .../lib => server/lib/omnichannel}/hooks.ts | 8 +- apps/meteor/server/lib/omnichannel/index.ts | 24 + .../lib/omnichannel}/isMessageFromBot.ts | 0 .../lib/omnichannel}/livechat.ts | 4 +- .../lib/omnichannel}/localTypes.ts | 0 .../lib => server/lib/omnichannel}/logger.ts | 0 .../lib/omnichannel}/messages.ts | 12 +- .../lib/omnichannel}/omni-users.ts | 8 +- .../lib/omnichannel}/outboundcommunication.ts | 0 .../omnichannel}/parseTranscriptRequest.ts | 2 +- .../lib/omnichannel}/resolveVisitor.ts | 0 .../roomAccessValidator.compatibility.ts | 6 +- .../roomAccessValidator.internalService.ts | 0 .../lib => server/lib/omnichannel}/rooms.ts | 12 +- .../lib/omnichannel}/routing/AutoSelection.ts | 4 +- .../lib/omnichannel}/routing/External.ts | 4 +- .../omnichannel}/routing/ManualSelection.ts | 0 .../lib/omnichannel}/sendMessageBySMS.ts | 8 +- .../lib/omnichannel}/sendTranscript.ts | 12 +- .../lib/omnichannel}/service-status.ts | 2 +- .../lib/omnichannel}/settings.ts | 2 +- .../lib/omnichannel}/startup.ts | 20 +- .../LivechatAgentActivityMonitor.ts | 2 +- .../lib/omnichannel}/stream/agentStatus.ts | 2 +- .../lib/omnichannel}/takeInquiry.ts | 2 +- .../lib/omnichannel}/tracking.ts | 2 +- .../lib/omnichannel}/transfer.ts | 0 .../lib => server/lib/omnichannel}/utils.ts | 6 +- .../lib/omnichannel}/webhooks.ts | 4 +- apps/meteor/server/lib/openRoom.ts | 2 +- apps/meteor/server/lib/pushConfig.ts | 4 +- apps/meteor/server/lib/readMessages.ts | 2 +- apps/meteor/server/lib/resetUserE2EKey.ts | 4 +- apps/meteor/server/lib/roles/addUserRoles.ts | 2 +- apps/meteor/server/lib/roles/getRoomRoles.ts | 2 +- .../server/lib/roles/removeUserFromRoles.ts | 2 +- .../server/lib/rooms/acceptRoomInvite.ts | 2 +- .../lib/rooms/addUserToDefaultChannels.ts | 6 +- apps/meteor/server/lib/rooms/addUserToRoom.ts | 4 +- apps/meteor/server/lib/rooms/archiveRoom.ts | 2 +- .../server/lib/rooms/banUserFromRoom.ts | 2 +- .../server/lib/rooms/cleanRoomHistory.ts | 2 +- .../server/lib/rooms/createDirectRoom.ts | 6 +- apps/meteor/server/lib/rooms/createRoom.ts | 6 +- apps/meteor/server/lib/rooms/deleteRoom.ts | 2 +- .../lib/rooms/executeUnbanUserFromRoom.ts | 2 +- .../lib/rooms/getRoomsWithSingleOwner.ts | 2 +- .../lib/rooms/invites}/findOrCreateInvite.ts | 8 +- .../lib/rooms/invites}/listInvites.ts | 2 +- .../lib/rooms/invites}/removeInvite.ts | 2 +- .../lib/rooms/invites}/sendInvitationEmail.ts | 8 +- .../lib/rooms/invites}/useInviteToken.ts | 4 +- .../lib/rooms/invites}/validateInviteToken.ts | 2 +- .../lib/rooms/relinquishRoomOwnerships.ts | 2 +- .../server/lib/rooms/removeUserFromRoom.ts | 4 +- .../lib/rooms/retention}/cronPruneMessages.ts | 6 +- .../lib/rooms/retention}/index.ts | 0 .../server/lib/rooms/roomCoordinator.ts | 2 +- .../server/lib/rooms/roomTypes/direct.ts | 2 +- .../server/lib/rooms/roomTypes/private.ts | 2 +- .../server/lib/rooms/roomTypes/public.ts | 2 +- .../meteor/server/lib/rooms/settings/index.ts | 2 + .../rooms/settings}/saveReactWhenReadOnly.ts | 0 .../rooms/settings}/saveRoomAnnouncement.ts | 0 .../rooms/settings}/saveRoomCustomFields.ts | 2 +- .../rooms/settings}/saveRoomDescription.ts | 0 .../lib/rooms/settings}/saveRoomEncrypted.ts | 2 +- .../lib/rooms/settings}/saveRoomName.ts | 10 +- .../lib/rooms/settings}/saveRoomReadOnly.ts | 0 .../rooms/settings}/saveRoomSystemMessages.ts | 2 +- .../lib/rooms/settings}/saveRoomTopic.ts | 2 +- .../lib/rooms/settings}/saveRoomType.ts | 8 +- apps/meteor/server/lib/rooms/unarchiveRoom.ts | 2 +- .../server/lib/rooms/updateGroupDMsName.ts | 2 +- .../lib/saml}/CHANGELOG.md | 0 .../lib/saml}/README.md | 0 apps/meteor/server/lib/saml/lib/SAML.ts | 2 +- apps/meteor/server/lib/saml/lib/settings.ts | 7 +- apps/meteor/server/lib/saml/startup.ts | 2 +- apps/meteor/server/lib/search/events/index.ts | 2 +- .../meteor/server/lib/search/model/Setting.ts | 2 +- .../lib/search/search.internalService.ts | 2 +- .../search/service/SearchProviderService.ts | 2 +- .../service/SearchResultValidationService.ts | 2 +- .../meteor/server/lib/sendMessagesToAdmins.ts | 2 +- apps/meteor/server/lib/shared/validateName.ts | 2 +- .../meteor/server/lib/shouldBreakInVersion.ts | 2 +- apps/meteor/server/lib/spotlight.js | 6 +- .../functions/updateStatsCounter.ts | 2 +- .../lib/statistics/getSettingsStatistics.ts | 2 +- .../lib/getContactVerificationStatistics.ts | 2 +- .../statistics/lib/getImporterStatistics.ts | 2 +- .../statistics/lib/getServicesStatistics.ts | 2 +- .../server/lib/statistics/lib/statistics.ts | 4 +- .../server/lib/statistics/startup/monitor.ts | 2 +- .../server => server/lib/ui-master}/index.ts | 4 +- .../server => server/lib/ui-master}/inject.ts | 2 +- .../lib/ui-master}/scripts.ts | 2 +- apps/meteor/server/lib/unbanUserFromRoom.ts | 2 +- apps/meteor/server/lib/users/blockUser.ts | 2 +- .../lib/users/checkUsernameAvailability.ts | 2 +- apps/meteor/server/lib/users/deleteUser.ts | 10 +- .../lib/users/getAvatarSuggestionForUser.ts | 2 +- .../server/lib/users/getFullUserData.ts | 2 +- .../server/lib/users/getUsernameSuggestion.ts | 2 +- .../server/lib/users/saveCustomFields.ts | 2 +- .../saveCustomFieldsWithoutValidation.ts | 4 +- .../server/lib/users/saveUser/saveNewUser.ts | 6 +- .../server/lib/users/saveUser/saveUser.ts | 6 +- .../lib/users/saveUser/sendUserEmail.ts | 2 +- .../lib/users/saveUser/validateUserData.ts | 2 +- .../lib/users/saveUser/validateUserEditing.ts | 2 +- .../server/lib/users/saveUserIdentity.ts | 8 +- apps/meteor/server/lib/users/setEmail.ts | 4 +- apps/meteor/server/lib/users/setRealName.ts | 2 +- .../server/lib/users/setUserActiveStatus.ts | 8 +- apps/meteor/server/lib/users/setUserAvatar.ts | 2 +- apps/meteor/server/lib/users/setUsername.ts | 4 +- apps/meteor/server/lib/users/unblockUser.ts | 2 +- .../server/lib/users/validateCustomFields.js | 2 +- .../server/lib/users/validateUsername.ts | 2 +- .../lib/utils}/functions/getBaseUserFields.ts | 0 .../utils}/functions/getDefaultUserFields.ts | 0 .../lib/utils}/functions/getMongoInfo.ts | 0 .../lib/utils}/functions/isDocker.ts | 0 .../lib/utils}/functions/isSMTPConfigured.ts | 2 +- .../functions/normalizeMessageFileUpload.ts | 2 +- .../lib/utils}/getAvatarURL.ts | 0 .../server => server/lib/utils}/getURL.ts | 4 +- .../lib/utils}/getUserAvatarURL.ts | 0 .../utils}/getUserNotificationPreference.ts | 2 +- .../lib/utils}/lib/JWTHelper.spec.ts | 0 .../lib/utils}/lib/JWTHelper.ts | 0 .../lib}/utils/lib/getAvatarColor.ts | 0 .../utils/lib/getDefaultSubscriptionPref.ts | 0 .../lib/utils}/lib/getTimezone.ts | 2 +- .../lib/utils}/lib/getUserPreference.ts | 2 +- .../lib/utils}/lib/getValidRoomName.ts | 4 +- .../utils}/lib/normalizeMessagesForUser.ts | 2 +- .../lib}/utils/lib/templateVarHandler.ts | 0 .../lib/utils}/placeholders.ts | 2 +- .../lib/utils}/restrictions.ts | 4 +- .../lib/utils}/slashCommand.ts | 2 +- .../server/lib/validateEmailDomain.js | 2 +- apps/meteor/server/lib/videoConfProviders.ts | 2 +- apps/meteor/server/main.ts | 7 +- .../auth/addPermissionToRole.ts | 2 +- .../meteor-methods/auth/addUserToRole.ts | 2 +- .../meteor-methods/auth/afterVerifyEmail.ts | 2 +- .../auth/checkRegistrationSecretURL.ts | 2 +- .../server/meteor-methods/auth/crowd.ts | 2 +- .../meteor-methods/auth}/deleteOAuthApp.ts | 4 +- .../server/meteor-methods/auth/disable.ts | 2 +- .../meteor-methods/auth/logoutCleanUp.ts | 2 +- .../meteor-methods/auth/removeOAuthService.ts | 2 +- .../auth/removeRoleFromPermission.ts | 2 +- .../meteor-methods/auth/removeUserFromRole.ts | 2 +- .../auth/sendForgotPasswordEmail.ts | 2 +- .../meteor-methods/auth}/updateOAuthApp.ts | 6 +- .../meteor-methods/auth/validateTempToken.ts | 2 +- .../import/downloadPublicImportFile.ts | 2 +- .../import/getImportFileData.ts | 2 +- .../import/getImportProgress.ts | 2 +- .../import/getLatestImportOperations.ts | 2 +- .../meteor-methods/import/startImport.ts | 2 +- .../meteor-methods/import/uploadImportFile.ts | 2 +- apps/meteor/server/meteor-methods/index.ts | 5 + .../integrations/clearIntegrationHistory.ts | 2 +- .../incoming/addIncomingIntegration.ts | 4 +- .../incoming/deleteIncomingIntegration.ts | 4 +- .../incoming/updateIncomingIntegration.ts | 4 +- .../outgoing/addOutgoingIntegration.ts | 4 +- .../outgoing/deleteOutgoingIntegration.ts | 4 +- .../outgoing/replayOutgoingIntegration.ts | 2 +- .../outgoing/updateOutgoingIntegration.ts | 4 +- .../meteor-methods/media/deleteCustomSound.ts | 2 +- .../meteor-methods/media/deleteEmojiCustom.ts | 2 +- .../meteor-methods/media/getS3FileUrl.ts | 4 +- .../media/insertOrUpdateEmoji.ts | 2 +- .../media/insertOrUpdateSound.ts | 2 +- .../meteor-methods/media/listCustomSounds.ts | 2 +- .../meteor-methods/media/uploadCustomSound.ts | 2 +- .../meteor-methods/media/uploadEmojiCustom.ts | 2 +- .../messages/createDirectMessage.ts | 4 +- .../messages/createDiscussion.ts | 4 +- .../messages/deleteFileMessage.ts | 2 +- .../messages/executeSlashCommandPreview.ts | 2 +- .../meteor-methods/messages/followMessage.ts | 8 +- .../messages/getChannelHistory.ts | 8 +- .../messages/getSlashCommandPreviews.ts | 2 +- .../messages/getThreadMessages.ts | 4 +- .../meteor-methods/messages/getThreadsList.ts | 6 +- .../messages/getUserMentionsByChannel.ts | 4 +- .../meteor-methods/messages/loadHistory.ts | 4 +- .../messages/loadNextMessages.ts | 2 +- .../messages/loadSurroundingMessages.ts | 2 +- .../meteor-methods/messages/messageSearch.ts | 4 +- .../meteor-methods/messages/readMessages.ts | 2 +- .../meteor-methods/messages/readThreads.ts | 4 +- .../messages/sendFileMessage.ts | 2 +- .../meteor-methods/messages/sendMessage.ts | 4 +- .../messages/unfollowMessage.ts | 8 +- .../meteor-methods/messages/updateMessage.ts | 2 +- .../omnichannel/sendMessageLivechat.ts | 8 +- .../platform/OEmbedCacheCleanup.ts | 2 +- .../meteor-methods/platform/banner_dismiss.ts | 4 +- .../server/meteor-methods/platform/cloud.ts | 2 +- .../meteor-methods/platform/fetchMyKeys.ts | 2 +- .../meteor-methods/platform/getStatistics.ts | 2 +- .../server/meteor-methods/platform/push.ts | 2 +- .../platform/requestDataDownload.ts | 4 +- .../platform/requestSubscriptionKeys.ts | 2 +- .../meteor-methods/platform/resetOwnE2EKey.ts | 2 +- .../meteor-methods/platform/saveSettings.ts | 2 +- .../meteor-methods/platform/setRoomKeyID.ts | 2 +- .../platform/setUserPublicAndPrivateKeys.ts | 4 +- .../platform/translateMessage.ts | 2 +- .../meteor-methods/platform/updateGroupKey.ts | 6 +- .../meteor-methods/rooms/addAllUserToRoom.ts | 8 +- .../meteor-methods/rooms/addRoomLeader.ts | 6 +- .../meteor-methods/rooms/addRoomModerator.ts | 6 +- .../meteor-methods/rooms/addRoomOwner.ts | 6 +- .../meteor-methods/rooms/addUserToRoom.ts | 2 +- .../meteor-methods/rooms/addUsersToRoom.ts | 2 +- .../meteor-methods/rooms/archiveRoom.ts | 2 +- .../meteor-methods/rooms/browseChannels.ts | 4 +- .../meteor-methods/rooms/channelsList.ts | 6 +- .../meteor-methods/rooms/cleanRoomHistory.ts | 2 +- .../meteor-methods/rooms/createChannel.ts | 2 +- .../meteor-methods/rooms/getRoomById.ts | 2 +- .../rooms/getRoomIdByNameOrId.ts | 4 +- .../meteor-methods/rooms/getRoomNameById.ts | 2 +- .../meteor-methods/rooms/getRoomRoles.ts | 4 +- .../meteor-methods/rooms/getTotalChannels.ts | 2 +- .../server/meteor-methods/rooms/hideRoom.ts | 4 +- .../server/meteor-methods/rooms/joinRoom.ts | 2 +- .../server/meteor-methods/rooms/leaveRoom.ts | 2 +- .../meteor-methods/rooms/muteUserInRoom.ts | 2 +- .../meteor-methods/rooms/removeRoomLeader.ts | 6 +- .../rooms/removeRoomModerator.ts | 6 +- .../meteor-methods/rooms/removeRoomOwner.ts | 6 +- .../rooms/removeUserFromRoom.ts | 8 +- .../meteor-methods/rooms/saveRoomSettings.ts | 26 +- .../meteor-methods/rooms/toggleFavorite.ts | 4 +- .../meteor-methods/rooms/unarchiveRoom.ts | 2 +- .../meteor-methods/rooms/unmuteUserInRoom.ts | 2 +- .../settings/getSetupWizardParameters.ts | 2 +- .../meteor-methods/settings/saveSetting.ts | 4 +- .../meteor-methods/settings/saveSettings.ts | 4 +- .../settings/sendSMTPTestEmail.ts | 2 +- .../server/meteor-methods/users/blockUser.ts | 2 +- .../users}/deleteCustomUserStatus.ts | 4 +- .../server/meteor-methods/users/deleteUser.ts | 2 +- .../users/deleteUserOwnAccount.ts | 4 +- .../users}/getUserStatusText.ts | 4 +- .../users/getUsernameSuggestion.ts | 2 +- .../meteor-methods/users/getUsersOfRoom.ts | 2 +- .../server/meteor-methods/users/ignoreUser.ts | 4 +- .../users}/insertOrUpdateUserStatus.ts | 6 +- .../users}/listCustomUserStatus.ts | 0 .../meteor-methods/users/registerUser.ts | 8 +- .../meteor-methods/users/resetAvatar.ts | 4 +- .../users/saveNotificationSettings.ts | 6 +- .../users/saveUserPreferences.ts | 6 +- .../meteor-methods/users/saveUserProfile.ts | 8 +- .../users/setAvatarFromService.ts | 2 +- .../server/meteor-methods/users/setEmail.ts | 6 +- .../meteor-methods/users/setRealName.ts | 6 +- .../meteor-methods/users}/setUserStatus.ts | 4 +- .../meteor-methods/users/unblockUser.ts | 2 +- .../meteor-methods/users/userPresence.ts | 2 +- .../meteor-methods/users/userSetUtcOffset.ts | 2 +- .../core-apps/cloudAnnouncements.module.ts | 2 +- .../modules/core-apps/nps/createModal.ts | 2 +- .../modules/listeners/listeners.module.ts | 2 +- apps/meteor/server/publications/room/index.ts | 4 +- .../server/publications/settings/index.ts | 2 +- apps/meteor/server/publications/spotlight.ts | 2 +- .../avatar/middlewares/browserVersion.spec.ts | 2 +- .../avatar/middlewares/browserVersion.ts | 2 +- apps/meteor/server/routes/avatar/room.spec.ts | 5 - apps/meteor/server/routes/avatar/user.spec.ts | 2 +- apps/meteor/server/routes/avatar/user.ts | 2 +- .../meteor/server/routes/avatar/utils.spec.ts | 5 +- apps/meteor/server/routes/avatar/utils.ts | 4 +- apps/meteor/server/routes/userDataDownload.ts | 2 +- .../server/services/calendar/service.ts | 4 +- .../server/services/federation/Settings.ts | 2 +- .../rocket-chat/adapters/Statistics.ts | 2 +- .../server/services/federation/utils.ts | 2 +- .../server/services/import/service.spec.ts | 2 +- apps/meteor/server/services/import/service.ts | 2 +- .../push/sendVoipPushNotification.ts | 6 +- .../server/services/media-call/service.ts | 2 +- .../messages/hooks/AfterSaveOEmbed.ts | 2 +- .../messages/hooks/BeforeSaveMentions.ts | 2 +- .../services/messages/lib/oembed/providers.ts | 2 +- .../server/services/messages/service.ts | 6 +- apps/meteor/server/services/meteor/service.ts | 12 +- .../services/nps/getAndCreateNpsSurvey.ts | 2 +- .../server/services/nps/notification.ts | 2 +- .../server/services/nps/sendNpsResults.ts | 2 +- .../services/omnichannel-analytics/service.ts | 2 +- .../providers/twilio.ts | 4 +- .../server/services/omnichannel/queue.ts | 10 +- .../server/services/omnichannel/service.ts | 6 +- apps/meteor/server/services/room/service.ts | 16 +- .../server/services/settings/service.ts | 4 +- apps/meteor/server/services/startup.ts | 2 +- apps/meteor/server/services/team/service.ts | 8 +- .../services/user/lib/getNewUserRoles.ts | 2 +- .../services/video-conference/service.ts | 8 +- .../settings}/CachedSettings.ts | 2 +- .../server => server/settings}/Middleware.ts | 0 .../{app/lib => server/settings}/README.md | 0 .../settings}/SettingsRegistry.ts | 2 +- apps/meteor/server/settings/accounts.ts | 2 +- apps/meteor/server/settings/analytics.ts | 2 +- .../settings}/applyMiddlewares.ts | 0 apps/meteor/server/settings/assets.ts | 2 +- apps/meteor/server/settings/bots.ts | 2 +- .../server => server/settings}/cached.ts | 0 apps/meteor/server/settings/cas.ts | 2 +- .../settings}/checkSettingValueBonds.ts | 0 apps/meteor/server/settings/crowd.ts | 2 +- apps/meteor/server/settings/custom-emoji.ts | 2 +- apps/meteor/server/settings/custom-sounds.ts | 2 +- apps/meteor/server/settings/definitions.ts | 81 ++ apps/meteor/server/settings/discussions.ts | 2 +- apps/meteor/server/settings/e2e.ts | 2 +- apps/meteor/server/settings/email.ts | 2 +- .../server/settings/federation-service.ts | 2 +- apps/meteor/server/settings/federation.ts | 2 +- apps/meteor/server/settings/file-upload.ts | 2 +- .../settings}/functions/convertValue.ts | 0 .../settings}/functions/getSettingDefaults.ts | 0 .../settings}/functions/overrideGenerator.ts | 0 .../settings}/functions/overrideSetting.ts | 0 .../settings}/functions/overwriteSetting.ts | 0 .../settings}/functions/settings.mocks.ts | 0 .../settings}/functions/validateSetting.ts | 0 apps/meteor/server/settings/general.ts | 2 +- apps/meteor/server/settings/index.ts | 101 +-- apps/meteor/server/settings/irc.ts | 2 +- apps/meteor/server/settings/layout.ts | 2 +- apps/meteor/server/settings/ldap.ts | 2 +- .../lib/auditedSettingUpdates.spec.ts | 2 +- .../settings/lib/auditedSettingUpdates.ts | 2 +- .../settings/lib}/saveSettingsBulk.ts | 14 +- apps/meteor/server/settings/logs.ts | 2 +- apps/meteor/server/settings/message.ts | 2 +- apps/meteor/server/settings/meta.ts | 2 +- apps/meteor/server/settings/misc.ts | 4 +- apps/meteor/server/settings/mobile.ts | 2 +- apps/meteor/server/settings/oauth.ts | 2 +- apps/meteor/server/settings/omnichannel.ts | 2 +- apps/meteor/server/settings/push.ts | 2 +- apps/meteor/server/settings/rate.ts | 2 +- .../server => server/settings}/raw.ts | 0 .../server/settings/retention-policy.ts | 2 +- apps/meteor/server/settings/setup-wizard.ts | 2 +- apps/meteor/server/settings/slackbridge.ts | 2 +- apps/meteor/server/settings/smarsh.ts | 2 +- .../server => server/settings}/startup.ts | 0 .../server => server/settings/theme}/index.ts | 0 .../settings/theme}/server.ts | 4 +- apps/meteor/server/settings/threads.ts | 2 +- apps/meteor/server/settings/troubleshoot.ts | 2 +- .../server/settings/userDataDownload.ts | 2 +- .../server/settings/video-conference.ts | 2 +- apps/meteor/server/settings/webdav.ts | 2 +- .../slashcommands/archiveroom/server.ts | 4 +- .../server/slashcommands/asciiarts/gimme.ts | 2 +- .../server/slashcommands/asciiarts/lenny.ts | 2 +- .../server/slashcommands/asciiarts/shrug.ts | 2 +- .../slashcommands/asciiarts/tableflip.ts | 2 +- .../server/slashcommands/asciiarts/unflip.ts | 2 +- apps/meteor/server/slashcommands/ban/ban.ts | 4 +- apps/meteor/server/slashcommands/ban/unban.ts | 4 +- .../server/slashcommands/create/server.ts | 4 +- .../server/slashcommands/help/server.ts | 4 +- apps/meteor/server/slashcommands/hide/hide.ts | 4 +- .../server/slashcommands/invite/server.ts | 4 +- .../server/slashcommands/inviteall/server.ts | 6 +- .../server/slashcommands/join/server.ts | 4 +- .../server/slashcommands/kick/server.ts | 4 +- .../server/slashcommands/leave/leave.ts | 4 +- apps/meteor/server/slashcommands/me/me.ts | 2 +- .../meteor/server/slashcommands/msg/server.ts | 4 +- apps/meteor/server/slashcommands/mute/mute.ts | 4 +- .../server/slashcommands/mute/unmute.ts | 4 +- .../server/slashcommands/status/status.ts | 6 +- .../server/slashcommands/topic/topic.ts | 2 +- .../slashcommands/unarchiveroom/server.ts | 4 +- apps/meteor/server/startup/initialData.ts | 4 +- apps/meteor/server/startup/migrations/v296.ts | 2 +- apps/meteor/server/startup/migrations/v300.ts | 2 +- apps/meteor/server/startup/migrations/xrun.ts | 2 +- .../server/startup/presenceTroubleshoot.ts | 2 +- .../lib => }/server/startup/rateLimiter.js | 6 +- .../{app/lib => }/server/startup/robots.js | 2 +- apps/meteor/server/startup/serverRunning.ts | 6 +- apps/meteor/tests/data/permissions.helper.ts | 4 +- .../livechat/server/outbound/outbound.spec.ts | 0 .../unit/server/api/checkPermissions.spec.ts | 2 +- .../api/checkPermissionsForInvocation.spec.ts | 2 +- .../hooks/omnichannel/beforeNewRoom.spec.ts | 2 +- .../omnichannel/markRoomResponded.spec.ts | 6 +- .../processRoomAbandonment.spec.ts | 4 +- .../hooks/omnichannel/sendToCRM.tests.ts | 8 +- .../unit/server/lib/banUserFromRoom.spec.ts | 4 +- .../exportRoomMessagesToFile.spec.ts | 2 +- .../lib/e2e/functions/resetRoomKey.spec.ts | 2 +- .../lib/import/messageConverter.spec.ts | 3 - .../server/lib/import/recordConverter.spec.ts | 3 - .../server/lib/import/roomConverter.spec.ts | 5 +- .../server/lib/import/userConverter.spec.ts | 5 +- .../lib/messaging/Message.tests.js} | 0 .../messaging}/getHiddenSystemMessage.spec.ts | 2 +- .../messaging/reactions/setReaction.spec.ts | 4 +- .../validateCustomMessageFields.tests.ts | 2 +- .../lib/notifications/email}/api.spec.ts | 2 +- .../message}/getEmailContent.spec.ts | 20 +- .../messageContainsHighlight.tests.ts | 2 +- .../lib/notifications/push/push.spec.ts | 2 +- .../server/lib/notifyListener.spec.ts | 4 +- .../lib/omnichannel}/assets.spec.ts | 2 +- .../business-hour/BusinessHourManager.spec.ts | 9 +- .../omnichannel/closeLivechatRoom.tests.ts | 2 +- .../omnichannel}/conditionalLockAgent.spec.ts | 6 +- .../lib/omnichannel}/custom-fields.spec.ts | 2 +- .../lib/omnichannel}/disableContact.spec.ts | 4 +- .../lib/omnichannel}/isMessageFromBot.spec.ts | 4 +- .../parseTranscriptRequest.spec.ts | 4 +- .../lib/omnichannel}/sendTranscript.spec.ts | 19 +- .../validateRequiredCustomFields.spec.ts | 2 +- .../lib/omnichannel}/webhooks.spec.ts | 6 +- .../server/lib/rooms/banUserFromRoom.spec.ts | 2 +- .../unit/server/lib/saml/server.tests.ts | 2 +- .../lib/users/saveUser/sendUserEmail.spec.ts | 2 +- .../unit/server/lib/users/setUsername.spec.ts | 4 +- .../server/lib/users/validateUsername.spec.ts | 2 +- .../platform/updateGroupKey.spec.ts | 7 +- .../server/services/calendar/service.tests.ts | 4 +- .../providers/twilio.spec.ts | 4 +- .../services/omnichannel/queue.tests.ts | 8 +- .../server/services/team/service.tests.ts | 8 +- .../compareSettingsMetadata.tests.ts | 4 +- .../functions/getSettingDefaults.tests.ts | 2 +- .../functions/overrideGenerator.tests.ts | 4 +- .../settings}/functions/settings.tests.ts | 8 +- .../functions/validateSettings.tests.ts | 2 +- .../unit/server/startup/initialData.tests.ts | 3 +- docs/backend-folder-structure.md | 123 +++ 1022 files changed, 1902 insertions(+), 3844 deletions(-) delete mode 100644 apps/meteor/MIGRATION_PLAN.md delete mode 100644 apps/meteor/app/authorization/server/index.ts delete mode 100644 apps/meteor/app/channel-settings/server/index.ts delete mode 100644 apps/meteor/app/custom-oauth/.gitignore delete mode 100644 apps/meteor/app/error-handler/server/index.ts delete mode 100644 apps/meteor/app/lib/server/index.ts delete mode 100644 apps/meteor/app/lib/server/lib/index.ts delete mode 100644 apps/meteor/app/lib/server/lib/msgStream.ts delete mode 100644 apps/meteor/app/lib/server/startup/index.ts delete mode 100644 apps/meteor/app/livechat/lib/stream/constants.ts delete mode 100644 apps/meteor/app/livechat/server/index.ts delete mode 100644 apps/meteor/app/logger/README.md delete mode 100644 apps/meteor/app/oauth2-server-config/.gitignore delete mode 100644 apps/meteor/app/oauth2-server-config/server/index.ts delete mode 100644 apps/meteor/app/retention-policy/README.md delete mode 100644 apps/meteor/app/settings/server/index.ts delete mode 100644 apps/meteor/app/ui-utils/server/index.ts delete mode 100644 apps/meteor/app/user-status/server/index.ts delete mode 100644 apps/meteor/ee/app/livechat-enterprise/server/index.ts rename apps/meteor/ee/{app/authorization/lib => server/lib/authorization}/guestPermissions.ts (100%) rename apps/meteor/ee/{app/livechat-enterprise/server/lib => server/lib/omnichannel}/AutoCloseOnHoldScheduler.ts (97%) rename apps/meteor/ee/{app/livechat-enterprise/server/lib => server/lib/omnichannel}/AutoTransferChatScheduler.ts (93%) rename apps/meteor/ee/{app/livechat-enterprise/server/lib => server/lib/omnichannel}/Department.ts (100%) rename apps/meteor/ee/{app/livechat-enterprise/server/lib => server/lib/omnichannel}/Helper.ts (97%) rename apps/meteor/ee/{app/livechat-enterprise/server/lib => server/lib/omnichannel}/LivechatEnterprise.ts (95%) rename apps/meteor/ee/{app/livechat-enterprise/server/lib => server/lib/omnichannel}/QueueInactivityMonitor.ts (95%) rename apps/meteor/ee/{app/livechat-enterprise/server/lib => server/lib/omnichannel}/SlaHelper.ts (94%) rename apps/meteor/ee/{app/livechat-enterprise/server/lib => server/lib/omnichannel}/VisitorInactivityMonitor.ts (93%) rename apps/meteor/ee/{app/livechat-enterprise/server => server/lib/omnichannel}/business-hour/Custom.ts (94%) rename apps/meteor/ee/{app/livechat-enterprise/server => server/lib/omnichannel}/business-hour/Helper.ts (86%) rename apps/meteor/ee/{app/livechat-enterprise/server => server/lib/omnichannel}/business-hour/Multiple.ts (95%) rename apps/meteor/ee/{app/livechat-enterprise/server => server/lib/omnichannel}/business-hour/index.ts (100%) rename apps/meteor/ee/{app/livechat-enterprise/server => server/lib/omnichannel}/business-hour/lib/business-hour.ts (97%) rename apps/meteor/ee/{app/livechat-enterprise/server/lib => server/lib/omnichannel}/debounceByParams.ts (100%) create mode 100644 apps/meteor/ee/server/lib/omnichannel/index.ts rename apps/meteor/ee/{app/livechat-enterprise/server/lib => server/lib/omnichannel}/logger.ts (100%) rename apps/meteor/ee/{app/livechat-enterprise/server => server/lib/omnichannel}/outboundcomms/rest.ts (98%) rename apps/meteor/ee/{app/livechat-enterprise/server => server/lib/omnichannel}/permissions.ts (100%) rename apps/meteor/ee/{app/livechat-enterprise/server => server/lib/omnichannel}/priorities.ts (100%) rename apps/meteor/ee/{app/livechat-enterprise/server/lib => server/lib/omnichannel}/requestPdfTranscript.ts (100%) rename apps/meteor/ee/{app/livechat-enterprise/server/lib => server/lib/omnichannel}/restrictQuery.ts (100%) rename apps/meteor/ee/{app/livechat-enterprise/server/lib => server/lib/omnichannel}/routing/LoadBalancing.ts (80%) rename apps/meteor/ee/{app/livechat-enterprise/server/lib => server/lib/omnichannel}/routing/LoadRotation.ts (81%) rename apps/meteor/ee/{app/livechat-enterprise/server => server/lib/omnichannel}/settings.ts (99%) rename apps/meteor/ee/{app/livechat-enterprise/server => server/lib/omnichannel}/startup.ts (78%) rename apps/meteor/ee/{app/livechat-enterprise/server/lib => server/lib/omnichannel}/unit.ts (75%) rename apps/meteor/ee/{app/livechat-enterprise/server/services => server/local-services}/omnichannel.internalService.ts (93%) rename apps/meteor/ee/{app/settings/server => server/settings}/index.ts (100%) rename apps/meteor/ee/{app/settings/server => server/settings}/settings.internalService.ts (100%) rename apps/meteor/ee/{app/settings/server => server/settings}/settings.ts (91%) rename apps/meteor/{tests/unit/app/license/server => ee/tests/unit/server/lib/license}/canEnableApp.spec.ts (97%) rename apps/meteor/ee/tests/unit/{apps/livechat-enterprise/lib => server/lib/omnichannel}/AutoCloseOnHold.tests.ts (97%) rename apps/meteor/ee/tests/unit/{apps/livechat-enterprise/lib => server/lib/omnichannel}/AutoTransferChatsScheduler.tests.ts (94%) rename apps/meteor/ee/tests/unit/{apps/livechat-enterprise/lib => server/lib/omnichannel}/Helper.tests.ts (94%) rename apps/meteor/ee/tests/unit/{apps/livechat-enterprise/server/lib => server/lib/omnichannel}/QueueInactivityMonitor.spec.ts (95%) rename apps/meteor/{tests/unit/app/livechat-enterprise/server => ee/tests/unit/server/lib/omnichannel}/business-hour/Custom.spec.ts (96%) rename apps/meteor/{tests/unit/server/livechat/lib => ee/tests/unit/server/lib/omnichannel}/requestPdfTranscript.spec.ts (88%) rename apps/meteor/ee/tests/unit/{apps/livechat-enterprise/lib => server/lib/omnichannel}/restrictQuery.tests.ts (99%) delete mode 100644 apps/meteor/scripts/migration/check-broken-imports.mjs delete mode 100644 apps/meteor/scripts/migration/check-mock-keys.mjs delete mode 100644 apps/meteor/scripts/migration/move-batch.mjs delete mode 100644 apps/meteor/scripts/migration/move-module.mjs delete mode 100644 apps/meteor/scripts/migration/phase1-commands.tsv delete mode 100644 apps/meteor/scripts/migration/phase2-bridges.tsv delete mode 100644 apps/meteor/scripts/migration/phase4-ee-authorization.tsv delete mode 100644 apps/meteor/scripts/migration/phase4-test-mirrors.tsv delete mode 100644 apps/meteor/scripts/migration/phase4a-users.tsv delete mode 100644 apps/meteor/scripts/migration/phase4b-rooms.tsv delete mode 100644 apps/meteor/scripts/migration/phase4c-messages.tsv delete mode 100644 apps/meteor/scripts/migration/phase4d-other.tsv delete mode 100644 apps/meteor/scripts/migration/phase5-ee-methods.tsv delete mode 100644 apps/meteor/scripts/migration/phase5a-flat-methods.tsv delete mode 100644 apps/meteor/scripts/migration/phase5b-lib-methods.tsv delete mode 100644 apps/meteor/scripts/migration/phase5c-feature-methods.tsv delete mode 100644 apps/meteor/scripts/migration/phase6a-auth-providers.tsv delete mode 100644 apps/meteor/scripts/migration/phase6a-followup-oauth.tsv delete mode 100644 apps/meteor/scripts/migration/phase6b-ee-hooks.tsv delete mode 100644 apps/meteor/scripts/migration/phase6b-hooks.tsv delete mode 100644 apps/meteor/scripts/migration/phase6c-notifications.tsv delete mode 100644 apps/meteor/scripts/migration/phase6d-messaging.tsv delete mode 100644 apps/meteor/scripts/migration/phase6e-media-import-libs.tsv delete mode 100644 apps/meteor/scripts/migration/verify-no-old-imports.mjs rename apps/meteor/{app => server}/api/README.md (100%) rename apps/meteor/{app/slackbridge => server/bridges/slack}/README.md (100%) rename apps/meteor/{app/lib/server/lib => server/hooks}/afterUserActions.ts (77%) rename apps/meteor/{app/lib/server/startup => server/hooks/messages}/mentionUserNotInChannel.ts (94%) rename apps/meteor/{app/lib => }/server/lib/RateLimiter.js (100%) rename apps/meteor/{app/apple/lib => server/lib/auth-providers/apple}/handleIdentityToken.spec.ts (100%) rename apps/meteor/{app/apple/lib => server/lib/auth-providers/apple}/handleIdentityToken.ts (100%) rename apps/meteor/{app => server/lib/auth-providers}/custom-oauth/README.md (100%) rename apps/meteor/{app/drupal/README.md => server/lib/auth-providers/drupal.README.md} (100%) rename apps/meteor/{app/lib/server/lib => server/lib/auth}/generatePassword.ts (100%) rename apps/meteor/{app/lib/server/lib => server/lib/auth}/loginErrorMessageOverride.ts (100%) rename apps/meteor/{app/oauth2-server-config/server/admin/functions => server/lib/auth/oauth2-server}/addOAuthApp.ts (92%) create mode 100644 apps/meteor/server/lib/auth/oauth2-server/index.ts rename apps/meteor/{app/oauth2-server-config/server/oauth => server/lib/auth/oauth2-server}/oauth2-server.ts (96%) rename apps/meteor/{app/oauth2-server-config/server/admin/functions => server/lib/auth/oauth2-server}/parseUriList.ts (100%) rename apps/meteor/{app/lib/server/lib => server/lib/auth}/passwordPolicy.ts (97%) rename apps/meteor/{app => server/lib}/authorization/README.md (100%) rename apps/meteor/{app/authorization/server => server/lib/authorization}/constant/permissions.ts (100%) create mode 100644 apps/meteor/server/lib/authorization/index.ts rename apps/meteor/{app/authorization/server/lib => server/lib/authorization}/isABACManagedRoom.ts (91%) rename apps/meteor/{app/authorization/server => server/lib/authorization}/streamer/permissions/index.ts (100%) rename apps/meteor/{app => server/lib}/autotranslate/README.md (100%) rename apps/meteor/{app/lib => }/server/lib/bugsnag.ts (88%) rename apps/meteor/{app/cors/server => server/lib/cors}/cors.ts (97%) rename apps/meteor/{app/cors/server => server/lib/cors}/index.ts (80%) rename apps/meteor/{app/lib => }/server/lib/debug.js (92%) rename apps/meteor/{app/lib => }/server/lib/defaultBlockedDomainsList.ts (100%) rename apps/meteor/{app/lib => }/server/lib/deprecationWarningLogger.ts (98%) rename apps/meteor/{app/error-handler/server/lib => server/lib/error-handler}/RocketChat.ErrorHandler.ts (95%) create mode 100644 apps/meteor/server/lib/error-handler/index.ts rename apps/meteor/{app => server/lib/media}/file-upload/lib/FileUploadBase.ts (81%) rename apps/meteor/{app/ui-utils/server => server/lib/messaging}/Message.ts (89%) rename apps/meteor/{app/lib/server/lib => server/lib/messaging}/getHiddenSystemMessages.ts (100%) create mode 100644 apps/meteor/server/lib/messaging/msgStream.ts rename apps/meteor/{app => server/lib/messaging}/threads/README.md (100%) rename apps/meteor/{app/lib/server/lib => server/lib/messaging}/validateCustomMessageFields.ts (100%) rename apps/meteor/{app/lib/server/lib => server/lib/notifications}/interceptDirectReplyEmails.js (96%) rename apps/meteor/{app/lib/server/functions/notifications => server/lib/notifications/message}/desktop.ts (93%) rename apps/meteor/{app/lib/server/functions/notifications => server/lib/notifications/message}/email.js (93%) rename apps/meteor/{app/lib/server/functions/notifications => server/lib/notifications/message}/index.ts (90%) rename apps/meteor/{app/lib/server/functions/notifications => server/lib/notifications/message}/messageContainsHighlight.ts (100%) rename apps/meteor/{app/lib/server/functions/notifications => server/lib/notifications/message}/mobile.js (91%) rename apps/meteor/{app/lib/server/lib => server/lib/notifications}/processDirectEmail.ts (90%) rename apps/meteor/{app/lib => }/server/lib/notifyListener.ts (99%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/AnalyticsTyped.ts (100%) rename apps/meteor/{app/livechat/lib => server/lib/omnichannel}/Assets.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/Helper.ts (98%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/QueueManager.ts (97%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/RoutingManager.ts (98%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/Visitors.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/analytics/agents.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/analytics/dashboards.ts (98%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/analytics/departments.ts (98%) rename apps/meteor/{app/livechat/server => server/lib/omnichannel}/business-hour/AbstractBusinessHour.ts (98%) rename apps/meteor/{app/livechat/server => server/lib/omnichannel}/business-hour/BusinessHourManager.ts (97%) rename apps/meteor/{app/livechat/server => server/lib/omnichannel}/business-hour/Default.ts (100%) rename apps/meteor/{app/livechat/server => server/lib/omnichannel}/business-hour/Helper.ts (96%) rename apps/meteor/{app/livechat/server => server/lib/omnichannel}/business-hour/LivechatBusinessHours.ts (100%) rename apps/meteor/{app/livechat/server => server/lib/omnichannel}/business-hour/Single.ts (95%) rename apps/meteor/{app/livechat/server => server/lib/omnichannel}/business-hour/closeBusinessHour.ts (95%) rename apps/meteor/{app/livechat/server => server/lib/omnichannel}/business-hour/filterBusinessHoursThatMustBeOpened.spec.ts (100%) rename apps/meteor/{app/livechat/server => server/lib/omnichannel}/business-hour/filterBusinessHoursThatMustBeOpened.ts (100%) rename apps/meteor/{app/livechat/server => server/lib/omnichannel}/business-hour/getAgentIdsForBusinessHour.ts (100%) rename apps/meteor/{app/livechat/server => server/lib/omnichannel}/business-hour/index.ts (93%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/closeRoom.ts (97%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/conditionalLockAgent.ts (86%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/ContactMerger.ts (99%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/addContactEmail.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/createContact.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/createContactFromVisitor.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/disableContact.ts (94%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/getAllowedCustomFields.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/getContactChannelsGrouped.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/getContactHistory.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/getContactIdByVisitor.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/getContactManagerIdByUsername.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/getContacts.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/isAgentAvailableToTakeContactInquiry.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/isVerifiedChannelInSource.spec.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/isVerifiedChannelInSource.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/mapVisitorToContact.spec.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/mapVisitorToContact.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/mergeContacts.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/migrateVisitorIfMissingContact.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/migrateVisitorToContactId.spec.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/migrateVisitorToContactId.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/patchContact.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/registerContact.spec.ts (98%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/registerContact.ts (94%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/resolveContactConflicts.spec.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/resolveContactConflicts.ts (96%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/updateContact.spec.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/updateContact.ts (98%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/validateContactManager.spec.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/validateContactManager.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/validateCustomFields.spec.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/validateCustomFields.ts (93%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/contacts/verifyContactChannel.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/custom-fields.ts (99%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/departmentsLib.ts (97%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/getRoomMessages.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/guests.ts (93%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/hooks.ts (94%) create mode 100644 apps/meteor/server/lib/omnichannel/index.ts rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/isMessageFromBot.ts (100%) rename apps/meteor/{app/livechat/server => server/lib/omnichannel}/livechat.ts (95%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/localTypes.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/logger.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/messages.ts (90%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/omni-users.ts (91%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/outboundcommunication.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/parseTranscriptRequest.ts (96%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/resolveVisitor.ts (100%) rename apps/meteor/{app/livechat/server => server/lib/omnichannel}/roomAccessValidator.compatibility.ts (93%) rename apps/meteor/{app/livechat/server => server/lib/omnichannel}/roomAccessValidator.internalService.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/rooms.ts (96%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/routing/AutoSelection.ts (92%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/routing/External.ts (95%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/routing/ManualSelection.ts (100%) rename apps/meteor/{app/livechat/server => server/lib/omnichannel}/sendMessageBySMS.ts (89%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/sendTranscript.ts (95%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/service-status.ts (98%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/settings.ts (97%) rename apps/meteor/{app/livechat/server => server/lib/omnichannel}/startup.ts (85%) rename apps/meteor/{app/livechat/server => server/lib/omnichannel}/statistics/LivechatAgentActivityMonitor.ts (98%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/stream/agentStatus.ts (96%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/takeInquiry.ts (97%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/tracking.ts (96%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/transfer.ts (100%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/utils.ts (90%) rename apps/meteor/{app/livechat/server/lib => server/lib/omnichannel}/webhooks.ts (95%) rename apps/meteor/{app/invites/server/functions => server/lib/rooms/invites}/findOrCreateInvite.ts (92%) rename apps/meteor/{app/invites/server/functions => server/lib/rooms/invites}/listInvites.ts (82%) rename apps/meteor/{app/invites/server/functions => server/lib/rooms/invites}/removeInvite.ts (89%) rename apps/meteor/{app/invites/server/functions => server/lib/rooms/invites}/sendInvitationEmail.ts (84%) rename apps/meteor/{app/invites/server/functions => server/lib/rooms/invites}/useInviteToken.ts (92%) rename apps/meteor/{app/invites/server/functions => server/lib/rooms/invites}/validateInviteToken.ts (96%) rename apps/meteor/{app/retention-policy/server => server/lib/rooms/retention}/cronPruneMessages.ts (95%) rename apps/meteor/{app/retention-policy/server => server/lib/rooms/retention}/index.ts (100%) create mode 100644 apps/meteor/server/lib/rooms/settings/index.ts rename apps/meteor/{app/channel-settings/server/functions => server/lib/rooms/settings}/saveReactWhenReadOnly.ts (100%) rename apps/meteor/{app/channel-settings/server/functions => server/lib/rooms/settings}/saveRoomAnnouncement.ts (100%) rename apps/meteor/{app/channel-settings/server/functions => server/lib/rooms/settings}/saveRoomCustomFields.ts (91%) rename apps/meteor/{app/channel-settings/server/functions => server/lib/rooms/settings}/saveRoomDescription.ts (100%) rename apps/meteor/{app/channel-settings/server/functions => server/lib/rooms/settings}/saveRoomEncrypted.ts (92%) rename apps/meteor/{app/channel-settings/server/functions => server/lib/rooms/settings}/saveRoomName.ts (88%) rename apps/meteor/{app/channel-settings/server/functions => server/lib/rooms/settings}/saveRoomReadOnly.ts (100%) rename apps/meteor/{app/channel-settings/server/functions => server/lib/rooms/settings}/saveRoomSystemMessages.ts (96%) rename apps/meteor/{app/channel-settings/server/functions => server/lib/rooms/settings}/saveRoomTopic.ts (93%) rename apps/meteor/{app/channel-settings/server/functions => server/lib/rooms/settings}/saveRoomType.ts (88%) rename apps/meteor/{app/meteor-accounts-saml => server/lib/saml}/CHANGELOG.md (100%) rename apps/meteor/{app/meteor-accounts-saml => server/lib/saml}/README.md (100%) rename apps/meteor/{app/ui-master/server => server/lib/ui-master}/index.ts (98%) rename apps/meteor/{app/ui-master/server => server/lib/ui-master}/inject.ts (98%) rename apps/meteor/{app/ui-master/server => server/lib/ui-master}/scripts.ts (95%) rename apps/meteor/{app/utils/server => server/lib/utils}/functions/getBaseUserFields.ts (100%) rename apps/meteor/{app/utils/server => server/lib/utils}/functions/getDefaultUserFields.ts (100%) rename apps/meteor/{app/utils/server => server/lib/utils}/functions/getMongoInfo.ts (100%) rename apps/meteor/{app/utils/server => server/lib/utils}/functions/isDocker.ts (100%) rename apps/meteor/{app/utils/server => server/lib/utils}/functions/isSMTPConfigured.ts (80%) rename apps/meteor/{app/utils/server => server/lib/utils}/functions/normalizeMessageFileUpload.ts (92%) rename apps/meteor/{app/utils/server => server/lib/utils}/getAvatarURL.ts (100%) rename apps/meteor/{app/utils/server => server/lib/utils}/getURL.ts (81%) rename apps/meteor/{app/utils/server => server/lib/utils}/getUserAvatarURL.ts (100%) rename apps/meteor/{app/utils/server => server/lib/utils}/getUserNotificationPreference.ts (95%) rename apps/meteor/{app/utils/server => server/lib/utils}/lib/JWTHelper.spec.ts (100%) rename apps/meteor/{app/utils/server => server/lib/utils}/lib/JWTHelper.ts (100%) rename apps/meteor/{app => server/lib}/utils/lib/getAvatarColor.ts (100%) rename apps/meteor/{app => server/lib}/utils/lib/getDefaultSubscriptionPref.ts (100%) rename apps/meteor/{app/utils/server => server/lib/utils}/lib/getTimezone.ts (94%) rename apps/meteor/{app/utils/server => server/lib/utils}/lib/getUserPreference.ts (94%) rename apps/meteor/{app/utils/server => server/lib/utils}/lib/getValidRoomName.ts (95%) rename apps/meteor/{app/utils/server => server/lib/utils}/lib/normalizeMessagesForUser.ts (97%) rename apps/meteor/{app => server/lib}/utils/lib/templateVarHandler.ts (100%) rename apps/meteor/{app/utils/server => server/lib/utils}/placeholders.ts (95%) rename apps/meteor/{app/utils/server => server/lib/utils}/restrictions.ts (72%) rename apps/meteor/{app/utils/server => server/lib/utils}/slashCommand.ts (97%) rename apps/meteor/{app/lib => }/server/lib/validateEmailDomain.js (97%) rename apps/meteor/{app/oauth2-server-config/server/admin/methods => server/meteor-methods/auth}/deleteOAuthApp.ts (88%) rename apps/meteor/{app/oauth2-server-config/server/admin/methods => server/meteor-methods/auth}/updateOAuthApp.ts (91%) rename apps/meteor/{app/user-status/server/methods => server/meteor-methods/users}/deleteCustomUserStatus.ts (87%) rename apps/meteor/{app/user-status/server/methods => server/meteor-methods/users}/getUserStatusText.ts (80%) rename apps/meteor/{app/user-status/server/methods => server/meteor-methods/users}/insertOrUpdateUserStatus.ts (93%) rename apps/meteor/{app/user-status/server/methods => server/meteor-methods/users}/listCustomUserStatus.ts (100%) rename apps/meteor/{app/user-status/server/methods => server/meteor-methods/users}/setUserStatus.ts (93%) rename apps/meteor/{app/settings/server => server/settings}/CachedSettings.ts (99%) rename apps/meteor/{app/settings/server => server/settings}/Middleware.ts (100%) rename apps/meteor/{app/lib => server/settings}/README.md (100%) rename apps/meteor/{app/settings/server => server/settings}/SettingsRegistry.ts (99%) rename apps/meteor/{app/settings/server => server/settings}/applyMiddlewares.ts (100%) rename apps/meteor/{app/settings/server => server/settings}/cached.ts (100%) rename apps/meteor/{app/lib/server/lib => server/settings}/checkSettingValueBonds.ts (100%) create mode 100644 apps/meteor/server/settings/definitions.ts rename apps/meteor/{app/settings/server => server/settings}/functions/convertValue.ts (100%) rename apps/meteor/{app/settings/server => server/settings}/functions/getSettingDefaults.ts (100%) rename apps/meteor/{app/settings/server => server/settings}/functions/overrideGenerator.ts (100%) rename apps/meteor/{app/settings/server => server/settings}/functions/overrideSetting.ts (100%) rename apps/meteor/{app/settings/server => server/settings}/functions/overwriteSetting.ts (100%) rename apps/meteor/{app/settings/server => server/settings}/functions/settings.mocks.ts (100%) rename apps/meteor/{app/settings/server => server/settings}/functions/validateSetting.ts (100%) rename apps/meteor/{app/lib/server/functions => server/settings/lib}/saveSettingsBulk.ts (88%) rename apps/meteor/{app/settings/server => server/settings}/raw.ts (100%) rename apps/meteor/{app/settings/server => server/settings}/startup.ts (100%) rename apps/meteor/{app/theme/server => server/settings/theme}/index.ts (100%) rename apps/meteor/{app/theme/server => server/settings/theme}/server.ts (91%) rename apps/meteor/{app/lib => }/server/startup/rateLimiter.js (97%) rename apps/meteor/{app/lib => }/server/startup/robots.js (83%) delete mode 100644 apps/meteor/tests/unit/app/livechat/server/outbound/outbound.spec.ts rename apps/meteor/tests/unit/{app/ui-utils/server.tests.js => server/lib/messaging/Message.tests.js} (100%) rename apps/meteor/tests/unit/{app/lib/server/lib => server/lib/messaging}/getHiddenSystemMessage.spec.ts (96%) rename apps/meteor/tests/unit/{app/lib/server/lib => server/lib/messaging}/validateCustomMessageFields.tests.ts (95%) rename apps/meteor/tests/unit/{app/mailer => server/lib/notifications/email}/api.spec.ts (95%) rename apps/meteor/tests/unit/{app/mailer => server/lib/notifications/message}/getEmailContent.spec.ts (78%) rename apps/meteor/tests/unit/{app/lib/server/functions/notifications => server/lib/notifications/message}/messageContainsHighlight.tests.ts (95%) rename apps/meteor/tests/unit/{app/lib => }/server/lib/notifyListener.spec.ts (97%) rename apps/meteor/tests/unit/{app/livechat/lib => server/lib/omnichannel}/assets.spec.ts (94%) rename apps/meteor/tests/unit/{app/livechat/server => server/lib/omnichannel}/business-hour/BusinessHourManager.spec.ts (97%) rename apps/meteor/tests/unit/{app/livechat/server/lib => server/lib/omnichannel}/conditionalLockAgent.spec.ts (93%) rename apps/meteor/tests/unit/{app/livechat/server/lib => server/lib/omnichannel}/custom-fields.spec.ts (98%) rename apps/meteor/tests/unit/{app/livechat/server/lib => server/lib/omnichannel}/disableContact.spec.ts (97%) rename apps/meteor/tests/unit/{app/livechat/server/lib => server/lib/omnichannel}/isMessageFromBot.spec.ts (87%) rename apps/meteor/tests/unit/{app/livechat/server/lib => server/lib/omnichannel}/parseTranscriptRequest.spec.ts (98%) rename apps/meteor/tests/unit/{app/livechat/server/lib => server/lib/omnichannel}/sendTranscript.spec.ts (92%) rename apps/meteor/tests/unit/{app/livechat/server/lib => server/lib/omnichannel}/validateRequiredCustomFields.spec.ts (96%) rename apps/meteor/tests/unit/{app/livechat/server/lib => server/lib/omnichannel}/webhooks.spec.ts (98%) rename apps/meteor/tests/unit/{app/settings/server => server/settings}/functions/compareSettingsMetadata.tests.ts (77%) rename apps/meteor/tests/unit/{app/settings/server => server/settings}/functions/getSettingDefaults.tests.ts (96%) rename apps/meteor/tests/unit/{app/settings/server => server/settings}/functions/overrideGenerator.tests.ts (88%) rename apps/meteor/tests/unit/{app/settings/server => server/settings}/functions/settings.tests.ts (98%) rename apps/meteor/tests/unit/{app/settings/server => server/settings}/functions/validateSettings.tests.ts (93%) create mode 100644 docs/backend-folder-structure.md diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 2326ac09356fe..dfdf2c04e0810 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -13,25 +13,30 @@ /apps/meteor/tests/e2e @RocketChat/frontend /apps/meteor/tests/end-to-end @RocketChat/backend /apps/meteor/tests/unit/app @RocketChat/backend -/apps/meteor/tests/unit/app/ui-utils @RocketChat/frontend /apps/meteor/tests/unit/client @RocketChat/frontend /apps/meteor/tests/unit/server @RocketChat/backend /apps/meteor/app/apps/ @RocketChat/apps /apps/meteor/app/livechat @RocketChat/omnichannel -/apps/meteor/app/sms @RocketChat/omnichannel -/apps/meteor/app/api @RocketChat/backend -/apps/meteor/app/federation @RocketChat/backend /apps/meteor/app/file-upload @RocketChat/backend /apps/meteor/app/integrations @RocketChat/backend /apps/meteor/server @RocketChat/backend +/apps/meteor/server/lib/omnichannel @RocketChat/omnichannel +/apps/meteor/server/hooks/omnichannel @RocketChat/omnichannel +/apps/meteor/server/api/v1/omnichannel @RocketChat/omnichannel +/apps/meteor/server/meteor-methods/omnichannel @RocketChat/omnichannel /packages/models @RocketChat/Architecture apps/meteor/server/startup/migrations @RocketChat/Architecture /apps/meteor/packages/rocketchat-livechat @RocketChat/omnichannel /apps/meteor/server/features/EmailInbox @RocketChat/omnichannel /apps/meteor/ee/server/apps/ @RocketChat/apps /apps/meteor/ee/tests/unit/server/apps/ @RocketChat/apps -/apps/meteor/ee/app/canned-responses @RocketChat/omnichannel -/apps/meteor/ee/app/livechat @RocketChat/omnichannel -/apps/meteor/ee/app/livechat-enterprise @RocketChat/omnichannel +/apps/meteor/ee/server/lib/canned-responses @RocketChat/omnichannel +/apps/meteor/ee/server/hooks/canned-responses @RocketChat/omnichannel +/apps/meteor/ee/server/api/v1/canned-responses.ts @RocketChat/omnichannel +/apps/meteor/ee/server/lib/omnichannel @RocketChat/omnichannel +/apps/meteor/ee/server/hooks/omnichannel @RocketChat/omnichannel +/apps/meteor/ee/server/api/v1/omnichannel @RocketChat/omnichannel +/apps/meteor/ee/server/meteor-methods/saveCannedResponse.ts @RocketChat/omnichannel +/apps/meteor/ee/server/meteor-methods/removeCannedResponse.ts @RocketChat/omnichannel /apps/meteor/client/omnichannel @RocketChat/omnichannel /apps/meteor/client/components/omnichannel @RocketChat/omnichannel diff --git a/apps/meteor/.mocharc.js b/apps/meteor/.mocharc.js index cf66605275df6..6837d59437853 100644 --- a/apps/meteor/.mocharc.js +++ b/apps/meteor/.mocharc.js @@ -10,8 +10,9 @@ module.exports = { ...base, // see https://github.com/mochajs/mocha/issues/3916 exit: true, // getUserInfo.spec.ts lives under server/api/lib but is a Jest test (run via jest.config.ts), - // so it must be excluded from the mocha `server/api/lib/**` glob below. - ignore: ['server/api/lib/getUserInfo.spec.ts'], + // so it must be excluded from the mocha `server/api/lib/**` glob below. Same for the + // business-hour spec under server/lib/omnichannel. + ignore: ['server/api/lib/getUserInfo.spec.ts', 'server/lib/omnichannel/business-hour/**/*.spec.ts'], spec: [ 'server/lib/callbacks.spec.ts', 'server/lib/cas/*.spec.ts', @@ -37,8 +38,8 @@ module.exports = { 'server/lib/media/**/*.spec.ts', 'server/lib/statistics/**/*.spec.ts', 'server/meteor-methods/**/*.spec.ts', - 'app/livechat/server/lib/**/*.spec.ts', + 'server/lib/omnichannel/**/*.spec.ts', 'server/lib/notifications/push/**/*.spec.ts', - 'app/utils/server/**/*.spec.ts', + 'server/lib/utils/**/*.spec.ts', ], }; diff --git a/apps/meteor/MIGRATION_PLAN.md b/apps/meteor/MIGRATION_PLAN.md deleted file mode 100644 index 3c460cf83e1c0..0000000000000 --- a/apps/meteor/MIGRATION_PLAN.md +++ /dev/null @@ -1,820 +0,0 @@ -# Backend Folder Structure Migration Plan - -## Goal - -Move server-side files from `apps/meteor/app/*/server/` into `apps/meteor/server/`, extending the existing responsibility-based folder structure. Files move; code stays the same. Import paths update, but no refactoring. - -## Design Principle - -The existing `server/` structure is organized by **responsibility first, domain second**: - -``` -server/// -``` - -This migration extends that pattern by: - -1. Adding domain subfolders to existing responsibility folders (e.g., `server/meteor-methods/rooms/`) -2. Creating new responsibility folders where needed (e.g., `server/api/`, `server/slashcommands/`) -3. Extending `server/lib/` with domain subfolders for functions and shared libraries -4. Preserving all existing `server/` folders untouched - -## License Boundary (EE) — Hard Constraint - -**Enterprise code is governed by a different license** (the Rocket.Chat Enterprise Edition license, e.g. `apps/meteor/ee/LICENSE`) from the rest of the repository. The directory boundary _is_ the license boundary: code is protected by the Enterprise license **only** because it physically lives under an `ee/` path. - -This produces one non-negotiable rule for the entire migration: - -> **EE files never leave EE.** A file whose path contains an `ee/` segment must have a destination whose path also contains the corresponding `ee/` segment. Moving EE code into a community location would silently relicense it and is forbidden in every phase. - -### Where EE code lives (and what this plan touches) - -| EE location | What it is | In scope? | -| -------------------------------- | ------------------------------------------------------------- | -------------------------------------------------------- | -| `apps/meteor/ee/` | EE code inside the meteor app (`apps/meteor/ee/LICENSE`) | **Yes** — restructured by the [EE Mirror](#ee-mirror-restructuring-within-ee), staying inside `apps/meteor/ee/` | -| `ee/apps/` (repo root) | Standalone EE microservice apps (ddp-streamer, presence-service, queue-worker, …) | **No** — separate Yarn workspaces, not part of the `apps/meteor` restructure | -| `ee/packages/` (repo root) | Standalone EE packages (abac, federation-matrix, license, …) | **No** — separate Yarn workspaces | -| `packages/*/src/ee/` (e.g. `core-typings`) | EE-licensed subtrees embedded in community packages | **No** — this plan does not touch `packages/` | - -This migration is strictly an **`apps/meteor/` internal restructure**. The only EE code it moves is `apps/meteor/ee/app/*/server/` → `apps/meteor/ee/server/`. Everything else under an `ee/` path is left untouched. - -Consequences: - -- **The community phases (1–7) only touch community sources** under `apps/meteor/app/**` and `apps/meteor/server/**`. None of their source paths may contain an `ee/` segment. -- **EE code in the meteor app is restructured by an exact mirror within `apps/meteor/ee/`** — see the [EE Mirror](#ee-mirror-restructuring-within-ee) section. `ee/app/*/server/` moves into `ee/server/`, which already has the same responsibility-based folders (`api/`, `hooks/`, `lib/`, `methods/`, `services/`, `settings/`, `startup/`, …). -- **Community ⇄ EE imports stay as imports.** EE code already imports from the community tree and vice versa; the migration only rewrites paths, never relocates a file across the boundary to "resolve" an import. - -## Target Structure - -``` -apps/meteor/server/ -│ -│ ── NEW (from app/*/server/) ────────────────────────────── -│ -├── api/ # REST API (from app/api/server/) -│ ├── v1/ # endpoint files: users.ts, rooms.ts, chat.ts... -│ │ ├── omnichannel/ # livechat endpoints (from app/livechat/server/api/v1/) -│ │ └── middlewares/ # authentication.ts, cors.ts, metrics.ts... -│ ├── lib/ # helpers + lib merged: getPaginationItems.ts, getUploadFormData.ts... -│ ├── validation/ # ajv.ts — JSON schema validation -│ ├── ApiClass.ts # API framework -│ ├── api.ts # API initialization -│ ├── router.ts # Hono router -│ ├── definition.ts # TypeScript types -│ └── webhooks.ts # /hooks/* webhook API (from app/integrations/server/api/) -│ -├── slashcommands/ # Slash commands (from app/slashcommands-*/server/) -│ ├── archiveroom.ts -│ ├── asciiarts/ -│ ├── ban.ts -│ ├── create.ts -│ ├── help.ts -│ ├── hide.ts -│ ├── invite.ts -│ ├── inviteall.ts -│ ├── join.ts -│ ├── kick.ts -│ ├── leave.ts -│ ├── me.ts -│ ├── msg.ts -│ ├── mute.ts -│ ├── status.ts -│ ├── topic.ts -│ ├── unarchiveroom.ts -│ └── index.ts -│ -├── bridges/ # External system adapters -│ ├── irc/ # (from app/irc/server/) -│ ├── slack/ # (from app/slackbridge/server/) -│ ├── smarsh/ # (from app/smarsh-connector/server/) -│ ├── webdav/ # (from app/webdav/server/) -│ └── nextcloud/ # (from app/nextcloud/server/) -│ # (app/apps/server/ is out of scope — handled separately) -│ -│ ── EXISTING (extended with domain subfolders) ──────────── -│ -├── meteor-methods/ # EXISTING (renamed from methods/) — Meteor methods (deprecated) -│ ├── rooms/ # from app/lib/server/methods/ + app/channel-settings/... + existing flat files -│ ├── users/ # from app/lib/server/methods/ + existing flat files -│ ├── messages/ # from app/lib/server/methods/ + existing flat files -│ ├── auth/ # from app/authorization/server/methods/ + app/2fa/... + existing flat files -│ ├── omnichannel/ # from app/livechat/server/methods/ -│ ├── settings/ # from app/lib/server/methods/ + existing flat files -│ ├── platform/ # from app/autotranslate/ + app/e2e/ + existing flat files -│ ├── import/ # from app/importer/server/methods/ -│ ├── integrations/ # from app/integrations/server/methods/ -│ ├── media/ # from app/custom-sounds/, app/emoji-custom/, app/file-upload/ methods (Phase 6e) -│ └── index.ts # updated to import from domain subfolders -│ -├── hooks/ # EXISTING — event handlers -│ ├── [existing flat files] # current files stay in place -│ ├── messages/ # NEW: afterSaveMessage, threads hooks, discussion hooks -│ ├── auth/ # NEW: from app/authentication/server/hooks/ -│ ├── rooms/ # NEW: beforeAddUserToRoom -│ └── omnichannel/ # NEW: from app/livechat/server/hooks/ -│ -├── lib/ # EXISTING — shared utilities + domain functions -│ ├── [existing contents] # current files stay in place -│ ├── users/ # NEW: domain functions (setRealName.ts, deleteUser.ts, saveUserIdentity.ts...) -│ ├── rooms/ # NEW: domain functions (createRoom.ts, addUserToRoom.ts, deleteRoom.ts...) -│ ├── messages/ # NEW: domain functions (sendMessage.ts, deleteMessage.ts, insertMessage.ts...) -│ ├── omnichannel/ # NEW: domain functions + livechat lib (closeLivechatRoom.ts...) -│ ├── authorization/ # NEW: hasPermission.ts, canAccessRoom.ts (from app/authorization/server/functions/) -│ ├── cloud/ # NEW: connectWorkspace.ts, syncWorkspace/ (from app/cloud/server/functions/) -│ ├── auth-providers/ # NEW: OAuth providers (apple, github, gitlab, etc.) -│ ├── notifications/ # NEW: push, email, queue (from app/push/, app/mailer/...) -│ ├── integrations/ # NEW: webhook lib, trigger handlers -│ ├── import/ # NEW: importer classes, definitions -│ ├── media/ # NEW: file-upload, emoji, custom-sounds, assets -│ ├── search/ # NEW: from app/search/server/ -│ ├── autotranslate/ # NEW: from app/autotranslate/server/ -│ ├── e2e/ # NEW: from app/e2e/server/ -│ ├── 2fa/ # NEW: from app/2fa/server/lib/ + classes/ -│ ├── saml/ # NEW: from app/meteor-accounts-saml/server/ -│ └── messaging/ # NEW: mentions, markdown, threads lib, reactions, pins, stars -│ -├── services/ # EXISTING — unchanged -├── settings/ # EXISTING — unchanged -├── cron/ # EXISTING — unchanged -├── configuration/ # EXISTING — unchanged -├── startup/ # EXISTING — unchanged -├── publications/ # EXISTING — unchanged -├── routes/ # EXISTING — unchanged -├── modules/ # EXISTING — unchanged -├── database/ # EXISTING — unchanged -├── email/ # EXISTING — unchanged -├── ufs/ # EXISTING — unchanged -├── oauth2-server/ # EXISTING — unchanged -├── features/ # EXISTING — unchanged -├── deasync/ # EXISTING — unchanged -├── models.ts # EXISTING — unchanged -├── main.ts # EXISTING — updated imports -├── tracing.ts # EXISTING — unchanged -└── importPackages.ts # EXISTING — updated imports -``` - ---- - -## Migration Phases - -The migration is split into 7 phases, ordered by risk (lowest first) and dependency (foundations first). Each phase is independently shippable — the app works after every phase. - -### Phase 0: Preparation - -**Goal**: Write disposable migration scripts. These are one-time-use tools — run them, verify the result, delete them. They don't need to live in the repository permanently. - -**No path aliases.** Both TypeScript `paths` and Node.js subpath `imports` add configuration surface across the build system (Meteor bundler, Jest, Mocha) for little benefit. Plain relative imports are universally understood by all tools with zero config. The migration scripts handle path updates directly. - -**No re-export stubs.** We control the entire codebase, so every import can be updated in the same commit as the file move. No transition period needed. - -**Scripts** (disposable, deleted after use): - -1. **`move-module.mjs --from --to `** — Moves a module directory and fixes all imports. - - - `mkdir -p` the target directory - - `git mv` every file from old to new location - - For each moved file, recompute relative imports from the new position - - For external files importing into the moved directory, recompute their specifiers - - Supports `--dry-run` to preview changes without writing - -2. **`move-batch.mjs `** — Moves a batch of modules from a TSV manifest. - - - Reads the manifest line by line (`old-pathnew-path`) - - Calls `move-module.mjs` for each entry - - After all moves, runs `yarn lint --quiet` once to verify no imports broke - - Reports: files moved, imports updated, any errors - -3. **`verify-no-old-imports.mjs ...`** — Checks that no imports still reference given substrings (e.g., `app/slashcommand`). Run after each phase to catch stragglers. - -**License-boundary guard (mandatory).** `move-module.mjs` must refuse any move where the source path contains an `ee/` segment but the destination does not (and vice versa), failing loud before any `git mv`. `move-batch.mjs` validates every manifest row against this rule up front, so a community-phase manifest can never contain an `ee/` source and an EE-mirror manifest can never point outside `ee/`. This is the automated enforcement of the [License Boundary](#license-boundary-ee--hard-constraint) rule — it is not optional and not a warning. - -Each phase produces a manifest file (the tables below), feeds it to `move-batch.mjs`, verifies with `yarn lint --quiet`, and commits the result. The scripts themselves are deleted once all phases are complete. - -**Primary validation command**: `yarn lint --quiet` is the authoritative check for broken imports after a move. The `--quiet` flag suppresses warnings so unresolved-import errors stand out. Run it from the repo root after every batch. `tsc --noEmit` may additionally be used to catch type regressions, but lint is the first line of defense for import integrity. - -**Lint has a blind spot — run `yarn typecheck` per phase too.** ESLint ignores some directories that DO import server code (notably `apps/meteor/imports/`), so a moved module can leave broken specifiers there that lint never reports — Phase 4 left three such imports in `imports/personal-access-tokens/` that only `tsc` caught. The migration scripts' search dirs must include every code directory (`app`, `server`, `ee`, `lib`, `tests`, `imports`, `client`, `definition`, `packages`), and each phase's verification must include a full `yarn typecheck` (from `apps/meteor/`), not just lint. - -**Deliverable**: Scripts written and tested on a small dry-run (e.g., move one slash command file, verify, revert). - ---- - -### Phase 1: Slash Commands (18 folders → 1 directory) - -**Goal**: Quick win. 18 tiny folders with 1-3 files each consolidate into `server/slashcommands/`. - -**Risk**: Very low. Slash commands are leaf nodes — nothing imports from them. - -**Scope**: ~40 files - -| Source | Destination | -| -------------------------------------------------- | --------------------------------------- | -| `app/slashcommand-asciiarts/server/` | `server/slashcommands/asciiarts/` | -| `app/slashcommands-archiveroom/server/server.ts` | `server/slashcommands/archiveroom.ts` | -| `app/slashcommands-ban/server/server.ts` | `server/slashcommands/ban.ts` | -| `app/slashcommands-create/server/server.ts` | `server/slashcommands/create.ts` | -| `app/slashcommands-help/server/server.ts` | `server/slashcommands/help.ts` | -| `app/slashcommands-hide/server/server.ts` | `server/slashcommands/hide.ts` | -| `app/slashcommands-invite/server/server.ts` | `server/slashcommands/invite.ts` | -| `app/slashcommands-inviteall/server/server.ts` | `server/slashcommands/inviteall.ts` | -| `app/slashcommands-join/server/server.ts` | `server/slashcommands/join.ts` | -| `app/slashcommands-kick/server/server.ts` | `server/slashcommands/kick.ts` | -| `app/slashcommands-leave/server/server.ts` | `server/slashcommands/leave.ts` | -| `app/slashcommands-me/server/server.ts` | `server/slashcommands/me.ts` | -| `app/slashcommands-msg/server/server.ts` | `server/slashcommands/msg.ts` | -| `app/slashcommands-mute/server/server.ts` | `server/slashcommands/mute.ts` | -| `app/slashcommands-status/server/server.ts` | `server/slashcommands/status.ts` | -| `app/slashcommands-topic/server/server.ts` | `server/slashcommands/topic.ts` | -| `app/slashcommands-unarchiveroom/server/server.ts` | `server/slashcommands/unarchiveroom.ts` | - -**Import updates**: Each slash command file typically has 0-2 external importers. Update `server/importPackages.ts` to import from the new location. - -**Verification**: `yarn lint --quiet`, manual test of 2-3 slash commands (e.g., `/invite`, `/kick`, `/topic`). - ---- - -### Phase 2: External Bridges (5 folders → `server/bridges/`) - -**Goal**: Move isolated bridge code that has no inbound importers. - -**Risk**: Low. Bridges are leaf nodes — they import from the core but nothing imports from them. - -**Scope**: ~48 files - -| Source | Destination | -| ------------------------------ | --------------------------- | -| `app/irc/server/` | `server/bridges/irc/` | -| `app/slackbridge/server/` | `server/bridges/slack/` | -| `app/smarsh-connector/server/` | `server/bridges/smarsh/` | -| `app/webdav/server/` | `server/bridges/webdav/` | -| `app/nextcloud/server/` | `server/bridges/nextcloud/` | - -**Note**: `app/apps/server/` (Apps-Engine bridges and converters) is explicitly out of scope for this migration. It will be handled manually in a separate initiative — do not move, rename, or touch it during any phase of this plan. - -**Verification**: `yarn lint --quiet`, test an incoming webhook. - ---- - -### Phase 3: REST API Infrastructure (1 folder → `server/api/`) - -**Goal**: Move the API framework and all REST endpoints into `server/api/`. - -**Risk**: Medium. The API folder is large (92 files) and is imported by `server/main.ts`. However, it's a cohesive unit — it moves as a block. - -**Scope**: ~92 files + ~43 livechat API files - -| Source | Destination | -| --------------------------------------- | ------------------------------ | -| `app/api/server/v1/*.ts` | `server/api/v1/` | -| `app/api/server/helpers/` | `server/api/lib/` | -| `app/api/server/lib/` | `server/api/lib/` | -| `app/api/server/middlewares/` | `server/api/v1/middlewares/` | -| `app/api/server/ApiClass.ts` | `server/api/ApiClass.ts` | -| `app/api/server/api.ts` | `server/api/api.ts` | -| `app/api/server/router.ts` | `server/api/router.ts` | -| `app/api/server/definition.ts` | `server/api/definition.ts` | -| `app/api/server/ajv.ts` | `server/api/validation/ajv.ts` | -| `app/api/server/default/` | `server/api/default/` | -| `app/livechat/server/api/v1/*.ts` | `server/api/v1/omnichannel/` | -| `app/livechat/imports/server/rest/*.ts` | `server/api/v1/omnichannel/` | - -**Key import update**: `server/main.ts` currently imports `../app/api/server/api` — update to `./api/api`. - -**Sub-steps**: - -1. Move the API framework files first (ApiClass.ts, router.ts, api.ts, definition.ts) -2. Move ajv.ts into `server/api/validation/` -3. Merge helpers/ and lib/ into a single `server/api/lib/` -4. Move v1/ endpoint files and middlewares/ into `server/api/v1/` -5. Move livechat API files into v1/omnichannel/ -6. Update `server/main.ts` and all cross-references -7. Re-wire test-runner globs for every moved spec and fix stale proxyquire/`jest.mock` keys — see [Test Mocks and Runner Globs](#test-mocks-and-runner-globs-proxyquire--jestmock--lint--tsc-do-not-catch-these). `app/api/server/` specs move to `server/api/` (both mocha lib specs and Jest specs), so both `.mocharc.js` and `jest.config.ts` `testMatch` need updating, and specs proxyquiring moved modules (e.g. `FileUpload.spec.ts` → `MultipartUploadHandler`, `api.helpers` consumers) need their mock keys rewritten. - -**Verification**: `yarn lint --quiet`, **then actually run** the REST API test suite via both runners (`yarn jest` and `yarn mocha --config ./.mocharc.js`) — lint/tsc do not catch broken mock keys or specs that silently stopped being discovered — and test a few endpoints manually. - ---- - -### Phase 4: Domain Functions (into `server/lib/`) - -**Goal**: Move domain functions from `app/lib/server/functions/` and `app/*/server/functions/` into `server/lib/` with domain subfolders. This is the largest and most impactful phase. - -**Risk**: Medium-high. These functions are heavily imported across the codebase (~62 features import from `app/lib/server`). The migration script updates all import paths in the same commit. - -**Scope**: ~80 files - -**Strategy**: Move files and update all imports in a single commit per sub-phase. No re-export stubs — every importer is updated immediately. - -#### Phase 4a: User Functions (~19 files) - -| Source | Destination | -| --------------------------------------------------------------- | ------------------------------------------------------------- | -| `app/lib/server/functions/setRealName.ts` | `server/lib/users/setRealName.ts` | -| `app/lib/server/functions/setUsername.ts` | `server/lib/users/setUsername.ts` | -| `app/lib/server/functions/setEmail.ts` | `server/lib/users/setEmail.ts` | -| `app/lib/server/functions/saveUserIdentity.ts` | `server/lib/users/saveUserIdentity.ts` | -| `app/lib/server/functions/setUserAvatar.ts` | `server/lib/users/setUserAvatar.ts` | -| `app/lib/server/functions/setUserActiveStatus.ts` | `server/lib/users/setUserActiveStatus.ts` | -| `app/lib/server/functions/setStatusText.ts` | `server/lib/users/setStatusText.ts` | -| `app/lib/server/functions/getStatusText.ts` | `server/lib/users/getStatusText.ts` | -| `app/lib/server/functions/deleteUser.ts` | `server/lib/users/deleteUser.ts` | -| `app/lib/server/functions/getFullUserData.ts` | `server/lib/users/getFullUserData.ts` | -| `app/lib/server/functions/getUsernameSuggestion.ts` | `server/lib/users/getUsernameSuggestion.ts` | -| `app/lib/server/functions/getUserCreatedByApp.ts` | `server/lib/users/getUserCreatedByApp.ts` | -| `app/lib/server/functions/getUserSingleOwnedRooms.ts` | `server/lib/users/getUserSingleOwnedRooms.ts` | -| `app/lib/server/functions/getAvatarSuggestionForUser.ts` | `server/lib/users/getAvatarSuggestionForUser.ts` | -| `app/lib/server/functions/checkEmailAvailability.ts` | `server/lib/users/checkEmailAvailability.ts` | -| `app/lib/server/functions/checkUsernameAvailability.ts` | `server/lib/users/checkUsernameAvailability.ts` | -| `app/lib/server/functions/validateUsername.ts` | `server/lib/users/validateUsername.ts` | -| `app/lib/server/functions/saveCustomFields.ts` | `server/lib/users/saveCustomFields.ts` | -| `app/lib/server/functions/saveCustomFieldsWithoutValidation.ts` | `server/lib/users/saveCustomFieldsWithoutValidation.ts` | - -#### Phase 4b: Room Functions (~16 files) - -| Source | Destination | -| --------------------------------------------------------------- | ------------------------------------------------------------- | -| `app/lib/server/functions/createRoom.ts` | `server/lib/rooms/createRoom.ts` | -| `app/lib/server/functions/createDirectRoom.ts` | `server/lib/rooms/createDirectRoom.ts` | -| `app/lib/server/functions/deleteRoom.ts` | `server/lib/rooms/deleteRoom.ts` | -| `app/lib/server/functions/archiveRoom.ts` | `server/lib/rooms/archiveRoom.ts` | -| `app/lib/server/functions/unarchiveRoom.ts` | `server/lib/rooms/unarchiveRoom.ts` | -| `app/lib/server/functions/addUserToRoom.ts` | `server/lib/rooms/addUserToRoom.ts` | -| `app/lib/server/functions/addUserToDefaultChannels.ts` | `server/lib/rooms/addUserToDefaultChannels.ts` | -| `app/lib/server/functions/removeUserFromRoom.ts` | `server/lib/rooms/removeUserFromRoom.ts` | -| `app/lib/server/functions/acceptRoomInvite.ts` | `server/lib/rooms/acceptRoomInvite.ts` | -| `app/lib/server/functions/cleanRoomHistory.ts` | `server/lib/rooms/cleanRoomHistory.ts` | -| `app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.ts` | `server/lib/rooms/getRoomByNameOrIdWithOptionToJoin.ts` | -| `app/lib/server/functions/getRoomsWithSingleOwner.ts` | `server/lib/rooms/getRoomsWithSingleOwner.ts` | -| `app/lib/server/functions/joinDefaultChannels.ts` | `server/lib/rooms/joinDefaultChannels.ts` | -| `app/lib/server/functions/relinquishRoomOwnerships.ts` | `server/lib/rooms/relinquishRoomOwnerships.ts` | -| `app/lib/server/functions/setRoomAvatar.ts` | `server/lib/rooms/setRoomAvatar.ts` | -| `app/lib/server/functions/updateGroupDMsName.ts` | `server/lib/rooms/updateGroupDMsName.ts` | -| `app/lib/server/functions/banUserFromRoom.ts` | `server/lib/rooms/banUserFromRoom.ts` | -| `app/lib/server/functions/executeUnbanUserFromRoom.ts` | `server/lib/rooms/executeUnbanUserFromRoom.ts` | - -#### Phase 4c: Message Functions (~10 files) - -| Source | Destination | -| ----------------------------------------------------------- | ------------------------------------------------------------ | -| `app/lib/server/functions/sendMessage.ts` | `server/lib/messages/sendMessage.ts` | -| `app/lib/server/functions/insertMessage.ts` | `server/lib/messages/insertMessage.ts` | -| `app/lib/server/functions/deleteMessage.ts` | `server/lib/messages/deleteMessage.ts` | -| `app/lib/server/functions/updateMessage.ts` | `server/lib/messages/updateMessage.ts` | -| `app/lib/server/functions/loadMessageHistory.ts` | `server/lib/messages/loadMessageHistory.ts` | -| `app/lib/server/functions/processWebhookMessage.ts` | `server/lib/messages/processWebhookMessage.ts` | -| `app/lib/server/functions/parseUrlsInMessage.ts` | `server/lib/messages/parseUrlsInMessage.ts` | -| `app/lib/server/functions/attachMessage.ts` | `server/lib/messages/attachMessage.ts` | -| `app/lib/server/functions/isTheLastMessage.ts` | `server/lib/messages/isTheLastMessage.ts` | -| `app/lib/server/functions/extractUrlsFromMessageAST.ts` | `server/lib/messages/extractUrlsFromMessageAST.ts` | -| `app/lib/server/functions/extractMentionsFromMessageAST.ts` | `server/lib/messages/extractMentionsFromMessageAST.ts` | - -#### Phase 4d: Other Domain Functions - -| Source | Destination | -| ----------------------------------------------------------------- | --------------------------------------------------------------- | -| `app/lib/server/functions/closeLivechatRoom.ts` | `server/lib/omnichannel/closeLivechatRoom.ts` | -| `app/lib/server/functions/closeOmnichannelConversations.ts` | `server/lib/omnichannel/closeOmnichannelConversations.ts` | -| `app/lib/server/functions/syncRolePrioritiesForRoomIfRequired.ts` | `server/lib/rooms/syncRolePrioritiesForRoomIfRequired.ts` | -| `app/lib/server/functions/validateName.ts` | `server/lib/shared/validateName.ts` | -| `app/lib/server/functions/validateNameChars.ts` | `server/lib/shared/validateNameChars.ts` | -| `app/lib/server/functions/getModifiedHttpHeaders.ts` | `server/lib/shared/getModifiedHttpHeaders.ts` | -| `app/lib/server/functions/disableCustomScripts.ts` | `server/lib/shared/disableCustomScripts.ts` | -| `app/authorization/server/functions/*.ts` | `server/lib/authorization/` | -| `app/cloud/server/functions/*.ts` | `server/lib/cloud/` | -| `app/livechat/server/lib/*.ts` (functions) | `server/lib/omnichannel/` | - -**Verification per sub-phase**: `yarn lint --quiet`, run unit tests for the moved functions, run integration tests. - ---- - -### Phase 5: Meteor Methods (from app/\*/server/methods/ → `server/meteor-methods//`) - -**Goal**: Consolidate all Meteor methods from feature folders into `server/meteor-methods/` with domain subfolders. - -**Risk**: Medium. Methods are entry points — nothing imports them, they just need to be loaded at startup. The main risk is missing a method registration. - -**Scope**: ~148 files - -**Naming**: This phase introduces the `meteor-methods/` folder name (renamed from the existing `methods/`) to make it explicit that these are Meteor-specific RPC handlers — not generic class methods, REST handlers, or service methods. The rename clarifies intent and reinforces that this directory is deprecated and slated for removal as features migrate off Meteor. - -**Phase 5 first step — rename the existing folder**: Before moving any new files in, rename `apps/meteor/server/methods/` → `apps/meteor/server/meteor-methods/` with a single `git mv`, and update every importer accordingly. Run `yarn lint --quiet` to confirm no broken imports before proceeding to the moves below. - -**Note**: After the rename above, the existing flat files (now under `server/meteor-methods/`) are also moved into the appropriate domain subfolder as part of this phase. - -**Deferred methods**: features that move wholesale in Phases 6/7 (file-upload, mentions, user-status, emoji-custom, custom-sounds, push-notifications, statistics, version-check, meteor-accounts-saml, oauth2-server-config) keep their `methods/` dirs until their own phase. Those dirs are routed to `server/meteor-methods//` by explicit rows in the Phase 6/7 tables — they must not ride along into `server/lib/`. Until then, `verify-no-old-imports.mjs "server/methods"` reports ~11 hits pointing at these dirs; that is expected. - -| Source | Destination | -| ------------------------------------------------- | ----------------------------------------------- | -| `app/lib/server/methods/setRealName.ts` | `server/meteor-methods/users/setRealName.ts` | -| `app/lib/server/methods/setEmail.ts` | `server/meteor-methods/users/setEmail.ts` | -| `app/lib/server/methods/blockUser.ts` | `server/meteor-methods/users/blockUser.ts` | -| `app/lib/server/methods/unblockUser.ts` | `server/meteor-methods/users/unblockUser.ts` | -| `app/lib/server/methods/deleteUserOwnAccount.ts` | `server/meteor-methods/users/deleteUserOwnAccount.ts` | -| `app/lib/server/methods/getUsernameSuggestion.ts` | `server/meteor-methods/users/getUsernameSuggestion.ts` | -| `app/lib/server/methods/createChannel.ts` | `server/meteor-methods/rooms/createChannel.ts` | -| `app/lib/server/methods/createPrivateGroup.ts` | `server/meteor-methods/rooms/createPrivateGroup.ts` | -| `app/lib/server/methods/addUserToRoom.ts` | `server/meteor-methods/rooms/addUserToRoom.ts` | -| `app/lib/server/methods/addUsersToRoom.ts` | `server/meteor-methods/rooms/addUsersToRoom.ts` | -| `app/lib/server/methods/archiveRoom.ts` | `server/meteor-methods/rooms/archiveRoom.ts` | -| `app/lib/server/methods/unarchiveRoom.ts` | `server/meteor-methods/rooms/unarchiveRoom.ts` | -| `app/lib/server/methods/leaveRoom.ts` | `server/meteor-methods/rooms/leaveRoom.ts` | -| `app/lib/server/methods/joinRoom.ts` | `server/meteor-methods/rooms/joinRoom.ts` | -| `app/lib/server/methods/joinDefaultChannels.ts` | `server/meteor-methods/rooms/joinDefaultChannels.ts` | -| `app/lib/server/methods/cleanRoomHistory.ts` | `server/meteor-methods/rooms/cleanRoomHistory.ts` | -| `app/lib/server/methods/getRoomJoinCode.ts` | `server/meteor-methods/rooms/getRoomJoinCode.ts` | -| `app/lib/server/methods/sendMessage.ts` | `server/meteor-methods/messages/sendMessage.ts` | -| `app/lib/server/methods/updateMessage.ts` | `server/meteor-methods/messages/updateMessage.ts` | -| `app/lib/server/methods/getChannelHistory.ts` | `server/meteor-methods/messages/getChannelHistory.ts` | -| `app/lib/server/methods/getMessages.ts` | `server/meteor-methods/messages/getMessages.ts` | -| `app/lib/server/methods/getSingleMessage.ts` | `server/meteor-methods/messages/getSingleMessage.ts` | -| `app/lib/server/methods/addOAuthService.ts` | `server/meteor-methods/auth/addOAuthService.ts` | -| `app/lib/server/methods/refreshOAuthService.ts` | `server/meteor-methods/auth/refreshOAuthService.ts` | -| `app/lib/server/methods/removeOAuthService.ts` | `server/meteor-methods/auth/removeOAuthService.ts` | -| `app/lib/server/methods/createToken.ts` | `server/meteor-methods/auth/createToken.ts` | -| `app/lib/server/methods/saveSetting.ts` | `server/meteor-methods/settings/saveSetting.ts` | -| `app/lib/server/methods/saveSettings.ts` | `server/meteor-methods/settings/saveSettings.ts` | -| `app/authorization/server/methods/*.ts` | `server/meteor-methods/auth/` | -| `app/2fa/server/methods/*.ts` | `server/meteor-methods/auth/` | -| `app/channel-settings/server/methods/*.ts` | `server/meteor-methods/rooms/` | -| `app/threads/server/methods/*.ts` | `server/meteor-methods/messages/` | -| `app/discussion/server/methods/*.ts` | `server/meteor-methods/messages/` | -| `app/livechat/server/methods/*.ts` | `server/meteor-methods/omnichannel/` | -| `app/integrations/server/methods/*.ts` | `server/meteor-methods/integrations/` | -| `app/importer/server/methods/*.ts` | `server/meteor-methods/import/` | -| `app/autotranslate/server/methods/*.ts` | `server/meteor-methods/platform/` | -| `app/e2e/server/methods/*.ts` | `server/meteor-methods/platform/` | - -**Existing `server/meteor-methods/` flat files** — also moved into domain subfolders: - -| Source | Destination | -| --------------------------------------------- | -------------------------------------------------- | -| `server/meteor-methods/deleteUser.ts` | `server/meteor-methods/users/deleteUser.ts` | -| `server/meteor-methods/setUserActiveStatus.ts` | `server/meteor-methods/users/setUserActiveStatus.ts` | -| `server/meteor-methods/registerUser.ts` | `server/meteor-methods/users/registerUser.ts` | -| `server/meteor-methods/resetAvatar.ts` | `server/meteor-methods/users/resetAvatar.ts` | -| `server/meteor-methods/setAvatarFromService.ts` | `server/meteor-methods/users/setAvatarFromService.ts` | -| `server/meteor-methods/saveUserPreferences.ts` | `server/meteor-methods/users/saveUserPreferences.ts` | -| `server/meteor-methods/saveUserProfile.ts` | `server/meteor-methods/users/saveUserProfile.ts` | -| `server/meteor-methods/getUsersOfRoom.ts` | `server/meteor-methods/users/getUsersOfRoom.ts` | -| `server/meteor-methods/userPresence.ts` | `server/meteor-methods/users/userPresence.ts` | -| `server/meteor-methods/userSetUtcOffset.ts` | `server/meteor-methods/users/userSetUtcOffset.ts` | -| `server/meteor-methods/ignoreUser.ts` | `server/meteor-methods/users/ignoreUser.ts` | -| `server/meteor-methods/addAllUserToRoom.ts` | `server/meteor-methods/rooms/addAllUserToRoom.ts` | -| `server/meteor-methods/addRoomLeader.ts` | `server/meteor-methods/rooms/addRoomLeader.ts` | -| `server/meteor-methods/addRoomModerator.ts` | `server/meteor-methods/rooms/addRoomModerator.ts` | -| `server/meteor-methods/addRoomOwner.ts` | `server/meteor-methods/rooms/addRoomOwner.ts` | -| `server/meteor-methods/removeRoomLeader.ts` | `server/meteor-methods/rooms/removeRoomLeader.ts` | -| `server/meteor-methods/removeRoomModerator.ts` | `server/meteor-methods/rooms/removeRoomModerator.ts` | -| `server/meteor-methods/removeRoomOwner.ts` | `server/meteor-methods/rooms/removeRoomOwner.ts` | -| `server/meteor-methods/removeUserFromRoom.ts` | `server/meteor-methods/rooms/removeUserFromRoom.ts` | -| `server/meteor-methods/getRoomById.ts` | `server/meteor-methods/rooms/getRoomById.ts` | -| `server/meteor-methods/getRoomIdByNameOrId.ts` | `server/meteor-methods/rooms/getRoomIdByNameOrId.ts` | -| `server/meteor-methods/getRoomNameById.ts` | `server/meteor-methods/rooms/getRoomNameById.ts` | -| `server/meteor-methods/browseChannels.ts` | `server/meteor-methods/rooms/browseChannels.ts` | -| `server/meteor-methods/channelsList.ts` | `server/meteor-methods/rooms/channelsList.ts` | -| `server/meteor-methods/getTotalChannels.ts` | `server/meteor-methods/rooms/getTotalChannels.ts` | -| `server/meteor-methods/hideRoom.ts` | `server/meteor-methods/rooms/hideRoom.ts` | -| `server/meteor-methods/openRoom.ts` | `server/meteor-methods/rooms/openRoom.ts` | -| `server/meteor-methods/toggleFavorite.ts` | `server/meteor-methods/rooms/toggleFavorite.ts` | -| `server/meteor-methods/createDirectMessage.ts` | `server/meteor-methods/messages/createDirectMessage.ts` | -| `server/meteor-methods/deleteFileMessage.ts` | `server/meteor-methods/messages/deleteFileMessage.ts` | -| `server/meteor-methods/messageSearch.ts` | `server/meteor-methods/messages/messageSearch.ts` | -| `server/meteor-methods/loadHistory.ts` | `server/meteor-methods/messages/loadHistory.ts` | -| `server/meteor-methods/loadMissedMessages.ts` | `server/meteor-methods/messages/loadMissedMessages.ts` | -| `server/meteor-methods/loadNextMessages.ts` | `server/meteor-methods/messages/loadNextMessages.ts` | -| `server/meteor-methods/loadSurroundingMessages.ts` | `server/meteor-methods/messages/loadSurroundingMessages.ts` | -| `server/meteor-methods/readMessages.ts` | `server/meteor-methods/messages/readMessages.ts` | -| `server/meteor-methods/readThreads.ts` | `server/meteor-methods/messages/readThreads.ts` | -| `server/meteor-methods/muteUserInRoom.ts` | `server/meteor-methods/rooms/muteUserInRoom.ts` | -| `server/meteor-methods/unmuteUserInRoom.ts` | `server/meteor-methods/rooms/unmuteUserInRoom.ts` | -| `server/meteor-methods/afterVerifyEmail.ts` | `server/meteor-methods/auth/afterVerifyEmail.ts` | -| `server/meteor-methods/sendConfirmationEmail.ts` | `server/meteor-methods/auth/sendConfirmationEmail.ts` | -| `server/meteor-methods/sendForgotPasswordEmail.ts` | `server/meteor-methods/auth/sendForgotPasswordEmail.ts` | -| `server/meteor-methods/logoutCleanUp.ts` | `server/meteor-methods/auth/logoutCleanUp.ts` | -| `server/meteor-methods/getSetupWizardParameters.ts` | `server/meteor-methods/settings/getSetupWizardParameters.ts` | -| `server/meteor-methods/loadLocale.ts` | `server/meteor-methods/platform/loadLocale.ts` | -| `server/meteor-methods/OEmbedCacheCleanup.ts` | `server/meteor-methods/platform/OEmbedCacheCleanup.ts` | -| `server/meteor-methods/requestDataDownload.ts` | `server/meteor-methods/platform/requestDataDownload.ts` | - -**Import updates**: Update `server/importPackages.ts` and any `server/meteor-methods/index.ts` that aggregates method registrations. - -**Verification**: `yarn lint --quiet`, test several Meteor methods via DDP client. - -**Registration audit (mandatory here and in Phases 6/7).** A method file that loses its side-effect import silently stops registering — lint, tsc and the unit suites all stay green, and e2e only exercises ~24 methods by name (`methodCall` helper), so most drops are invisible to CI. Many methods also have **no in-repo caller** (they serve mobile/DDP clients), so no repo test can ever catch them. After every batch that touches method files, verify that **every** non-empty file under `server/meteor-methods/` (and `ee/server/meteor-methods/`) is imported by the aggregator index or by a named-import consumer: - -```sh -for f in $(find server/meteor-methods ee/server/meteor-methods -name "*.ts" ! -name "*.spec.ts" | grep -v "^server/meteor-methods/index.ts$"); do - sub="${f%.ts}"; sub="${sub#*meteor-methods/}" - grep -rql --include="*.ts" "meteor-methods/${sub}'" server app ee client imports lib | grep -qv "^${f}$" \ - || grep -q "'\./${sub}'" server/meteor-methods/index.ts \ - || echo "UNREGISTERED: $f" -done -``` - -Match against the full `meteor-methods/` suffix — a loose `/` pattern false-passes on same-named `server/lib/` functions (this exact aliasing hid a dropped `unblockUser` registration in Phase 5b until audited). The audit must come back empty: the two historical 0-byte stragglers it initially flagged (`saveBusinessHour.ts`, EE `removeBusinessHour.ts`, emptied but not deleted by #37772/#37819) were removed in Phase 5. - ---- - -### Phase 6: Lib, Hooks, and Feature-Specific Code - -**Goal**: Move remaining feature-specific code: hooks, lib files, auth providers, notification code, and other domain-specific libraries. - -**Risk**: Medium. These files have more cross-references than the previous phases. - -**Scope**: ~300 files - -**Methods stay out of `lib/`.** Several features in this phase still carry a `methods/` subdir that Phase 5 deliberately did not touch (their features move here). Those files go to `server/meteor-methods//` — never along with the feature into `server/lib/` — so the "all Meteor methods live in `meteor-methods/`" invariant from Phase 5 holds. Every such dir is listed explicitly in the tables below, and the parent row is qualified with "(non-methods)". This phase introduces one new domain folder, `server/meteor-methods/media/`, for media admin methods (custom sounds, custom emoji, file-upload helpers). - -#### Phase 6a: Auth Providers (~30 files) - -| Source | Destination | -| ---------------------------------------- | ------------------------------------------------ | -| `app/apple/server/` | `server/lib/auth-providers/apple.ts` | -| `app/crowd/server/` | `server/lib/auth-providers/crowd/` | -| `app/custom-oauth/server/` | `server/lib/auth-providers/custom-oauth.ts` | -| `app/dolphin/server/` | `server/lib/auth-providers/dolphin.ts` | -| `app/drupal/server/` | `server/lib/auth-providers/drupal.ts` | -| `app/github/server/` | `server/lib/auth-providers/github.ts` | -| `app/github-enterprise/server/` | `server/lib/auth-providers/github-enterprise.ts` | -| `app/gitlab/server/` | `server/lib/auth-providers/gitlab.ts` | -| `app/google-oauth/server/` | `server/lib/auth-providers/google.ts` | -| `app/iframe-login/server/` | `server/lib/auth-providers/iframe.ts` | -| `app/wordpress/server/` | `server/lib/auth-providers/wordpress.ts` | -| `app/lib/server/oauth/*.js` | `server/lib/auth-providers/oauth/` | -| `app/meteor-accounts-saml/server/` (non-methods) | `server/lib/saml/` | -| `app/meteor-accounts-saml/server/methods/*.ts` | `server/meteor-methods/auth/` | -| `app/2fa/server/` (non-methods) | `server/lib/2fa/` | -| `app/authentication/server/` (non-hooks) | `server/lib/auth/` | -| `app/token-login/server/` | `server/lib/auth/token-login.ts` | - -#### Phase 6b: Hooks (~25 files) - -| Source | Destination | -| -------------------------------------------------- | ----------------------------------------------------- | -| `app/authentication/server/hooks/*.ts` | `server/hooks/auth/` | -| `app/discussion/server/hooks/*.ts` | `server/hooks/messages/` | -| `app/threads/server/hooks/*.ts` | `server/hooks/messages/` | -| `app/livechat/server/hooks/*.ts` | `server/hooks/omnichannel/` | -| `app/lib/server/lib/afterSaveMessage.ts` | `server/hooks/messages/afterSaveMessage.ts` | -| `app/lib/server/lib/notifyUsersOnMessage.ts` | `server/hooks/messages/notifyUsersOnMessage.ts` | -| `app/lib/server/lib/sendNotificationsOnMessage.ts` | `server/hooks/messages/sendNotificationsOnMessage.ts` | -| `app/lib/server/lib/beforeAddUserToRoom.ts` | `server/hooks/rooms/beforeAddUserToRoom.ts` | - -#### Phase 6c: Notification Libraries (~20 files) - -| Source | Destination | -| -------------------------------- | ----------------------------------------- | -| `app/push/server/` | `server/lib/notifications/push/` | -| `app/push-notifications/server/` (non-methods) | `server/lib/notifications/push-config/` | -| `app/push-notifications/server/methods/saveNotificationSettings.ts` | `server/meteor-methods/users/` | -| `app/mailer/server/` | `server/lib/notifications/email/` | -| `app/mail-messages/server/` | `server/lib/notifications/mail-messages/` | -| `app/notification-queue/server/` | `server/lib/notifications/queue/` | -| `app/notifications/server/` | `server/lib/notifications/core/` | - -#### Phase 6d: Messaging Libraries (~25 files) - -| Source | Destination | -| ------------------------------------------------- | ----------------------------------- | -| `app/threads/server/` (non-methods, non-hooks) | `server/lib/messaging/threads/` | -| `app/discussion/server/` (non-methods, non-hooks) | `server/lib/messaging/discussions/` | -| `app/reactions/server/` | `server/lib/messaging/reactions/` | -| `app/message-pin/server/` | `server/lib/messaging/pins/` | -| `app/message-star/server/` | `server/lib/messaging/stars/` | -| `app/message-mark-as-unread/server/` | `server/lib/messaging/unread/` | -| `app/mentions/server/` (non-methods) | `server/lib/messaging/mentions/` | -| `app/mentions/server/methods/getUserMentionsByChannel.ts` | `server/meteor-methods/messages/` | -| `app/markdown/server/` | `server/lib/messaging/markdown/` | -| `app/emoji/server/` | `server/lib/messaging/emoji/` | - -#### Phase 6e: Media, Import, Search, and Remaining Libraries - -| Source | Destination | -| ------------------------------------------- | ----------------------------------------- | -| `app/file-upload/server/` (non-methods) | `server/lib/media/file-upload/` | -| `app/file-upload/server/methods/sendFileMessage.ts` (+ co-located `.spec.ts`) | `server/meteor-methods/messages/` | -| `app/file-upload/server/methods/getS3FileUrl.ts` | `server/meteor-methods/media/` | -| `app/file-upload/server/methods/isImagePreviewSupported.ts` | `server/meteor-methods/media/` | -| `app/file/server/` | `server/lib/media/file/` | -| `app/emoji-custom/server/` (non-methods) | `server/lib/media/emoji-custom/` | -| `app/emoji-custom/server/methods/*.ts` | `server/meteor-methods/media/` | -| `app/emoji-emojione/server/` | `server/lib/media/emoji-emojione/` | -| `app/custom-sounds/server/` (non-methods) | `server/lib/media/custom-sounds/` | -| `app/custom-sounds/server/methods/*.ts` | `server/meteor-methods/media/` | -| `app/assets/server/` | `server/lib/media/assets/` | -| `app/importer/server/` (non-methods) | `server/lib/import/` | -| `app/importer-csv/server/` | `server/lib/import/csv/` | -| `app/importer-slack/server/` | `server/lib/import/slack/` | -| `app/importer-slack-users/server/` | `server/lib/import/slack-users/` | -| `app/importer-omnichannel-contacts/server/` | `server/lib/import/omnichannel-contacts/` | -| `app/importer-pending-avatars/server/` | `server/lib/import/pending-avatars/` | -| `app/importer-pending-files/server/` | `server/lib/import/pending-files/` | -| `app/search/server/` | `server/lib/search/` | -| `app/autotranslate/server/` (non-methods) | `server/lib/autotranslate/` | -| `app/e2e/server/` (non-methods) | `server/lib/e2e/` | -| `app/integrations/server/` (non-methods, non-api) | `server/lib/integrations/` | -| `app/integrations/server/api/api.ts` | `server/api/webhooks.ts` | -| `app/statistics/server/` (non-methods) | `server/lib/statistics/` | -| `app/statistics/server/methods/getStatistics.ts` | `server/meteor-methods/platform/` | -| `app/metrics/server/` | `server/lib/metrics/` | -| `app/cloud/server/` (non-functions) | `server/lib/cloud/` | -| `app/version-check/server/` (non-methods) | `server/lib/cloud/version-check/` | -| `app/version-check/server/methods/banner_dismiss.ts` | `server/meteor-methods/platform/` | -| `app/license/server/` | `server/lib/cloud/license/` | - -> `app/integrations/server/api/api.ts` is REST-API responsibility (it builds the `/hooks/*` webhook API on `server/api`'s `APIClass`), so it joins `server/api/` rather than `server/lib/integrations/` — same reasoning that sent the livechat REST endpoints to `server/api/v1/omnichannel/` in Phase 3. -> -> `sendFileMessage.spec.ts` is co-located with its source (not a `tests/unit` mirror) and is a **mocha** spec discovered today by the `app/file-upload/server/**/*.spec.ts` glob. When it moves, add a `server/meteor-methods/**/*.spec.ts` glob to `.mocharc.js`, and re-point the `app/file-upload` glob when the rest of the feature moves — see [Test Mocks and Runner Globs](#test-mocks-and-runner-globs-proxyquire--jestmock--lint--tsc-do-not-catch-these). - -**Verification**: `yarn lint --quiet` after each sub-phase, full test suite at end of Phase 6. - ---- - -### Phase 7: Omnichannel and Remaining Cleanup - -**Goal**: Move the largest single feature (livechat, 132 files) and clean up remaining files. - -**Risk**: Medium-high. Livechat is the largest feature and has many internal dependencies. Move it as a cohesive unit. - -**Scope**: ~150 files - -| Source | Destination | -| ------------------------------------ | ----------------------------------------------------------- | -| `app/livechat/server/lib/` | `server/lib/omnichannel/` | -| `app/livechat/server/methods/` | Already moved in Phase 5 | -| `app/livechat/server/hooks/` | Already moved in Phase 6b | -| `app/livechat/server/api/` | Already moved in Phase 3 | -| `app/livechat/server/` (remaining) | `server/lib/omnichannel/` | - -> **EE livechat is NOT moved here.** `ee/app/livechat-enterprise/server/` is Enterprise-licensed and stays under `ee/`. It is restructured into `ee/server/lib/omnichannel/` (and sibling `ee/server/` folders) as part of the [EE Mirror](#ee-mirror-restructuring-within-ee), never into the community `server/lib/omnichannel/`. See the [License Boundary](#license-boundary-ee--hard-constraint) rule. - -**Remaining cleanup**: - -- `app/channel-settings/server/` (non-methods) → `server/lib/rooms/settings/` -- `app/invites/server/` → `server/lib/rooms/invites/` -- `app/retention-policy/server/` → `server/lib/rooms/retention/` -- `app/user-status/server/` (non-methods) → `server/lib/users/status/` -- `app/user-status/server/methods/*.ts` (setUserStatus, getUserStatusText, custom-status CRUD) → `server/meteor-methods/users/` -- `app/bot-helpers/server/` → `server/lib/bot-helpers/` (moved in Phase 1) -- `app/cors/server/` → `server/lib/cors/` -- `app/error-handler/server/` → `server/lib/error-handler/` -- `app/oauth2-server-config/server/` (non-methods) → `server/lib/auth/oauth2-server/` -- `app/oauth2-server-config/server/admin/methods/*.ts` (deleteOAuthApp, updateOAuthApp) → `server/meteor-methods/auth/` -- `app/settings/server/` → `server/settings/` (merge with existing) -- `app/theme/server/` → `server/settings/theme/` -- `app/utils/server/` → `server/lib/utils/` -- `app/ui-master/server/` → `server/lib/ui-master/` -- Delete `app/lib/server/index.ts` (should be empty by now) -- Update `server/importPackages.ts` to remove all `app/` imports -- Verify no remaining imports from `app/*/server/` -- Delete the migration scripts (`move-module.mjs`, `move-batch.mjs`, `verify-no-old-imports.mjs`) - -**Final verification**: `yarn lint --quiet` across the repo, full `tsc --noEmit` for type regressions, full test suite, manual smoke test of core features (login, send message, create room, livechat, file upload). - ---- - -## EE Mirror — Restructuring within `ee/` - -The Enterprise tree gets the **same responsibility-based restructure** as the community tree, applied **entirely inside `apps/meteor/ee/`**. Files move from `ee/app/*/server/` into `ee/server/`, which already contains the matching responsibility folders (`api/`, `hooks/`, `lib/`, `methods/`, `services/`, `settings/`, `startup/`, …). Nothing in this section may target a path outside `ee/` — see the [License Boundary](#license-boundary-ee--hard-constraint) rule, enforced by the `move-module.mjs` guard. - -**Sequencing**: run each EE sub-step in (or immediately after) the community phase it parallels, so cross-tree imports are rewritten together. The EE mirror reuses the same scripts and the same `yarn lint --quiet` verification. - -**Folder rename**: mirror the community `methods/` → `meteor-methods/` rename here too — `ee/server/methods/` → `ee/server/meteor-methods/` — before moving EE methods into domain subfolders. - -| Source (EE) | Destination (EE) | Parallels | -| ------------------------------------------------- | ----------------------------------------- | ----------- | -| `ee/app/api-enterprise/server/` (endpoints) | `ee/server/api/v1/` | Phase 3 | -| `ee/app/api-enterprise/server/middlewares/` | `ee/server/api/v1/middlewares/` | Phase 3 | -| `ee/app/api-enterprise/server/lib/` | `ee/server/api/lib/` | Phase 3 | -| `ee/app/livechat-enterprise/server/api/` | `ee/server/api/v1/omnichannel/` | Phase 3 | -| `ee/app/authorization/server/` (functions) | `ee/server/lib/authorization/` | Phase 4 | -| `ee/app/livechat-enterprise/server/methods/` | `ee/server/meteor-methods/omnichannel/` | Phase 5 | -| `ee/app/canned-responses/server/methods/` | `ee/server/meteor-methods/` | Phase 5 | -| `ee/app/license/server/methods.ts` | `ee/server/meteor-methods/` | Phase 5 | -| `ee/app/authorization/server/` (methods) | `ee/server/meteor-methods/auth/` | Phase 5 | -| `ee/app/livechat-enterprise/server/hooks/` | `ee/server/hooks/omnichannel/` | Phase 6b | -| `ee/app/canned-responses/server/hooks/` | `ee/server/hooks/` | Phase 6b | -| `ee/app/message-read-receipt/server/hooks/` | `ee/server/hooks/messages/` | Phase 6b | -| `ee/app/authorization/server/callback.ts` | `ee/server/hooks/auth/` | Phase 6b | -| `ee/app/canned-responses/server/` (lib) | `ee/server/lib/canned-responses/` | Phase 6 | -| `ee/app/license/server/` (non-methods) | `ee/server/lib/license/` | Phase 6 | -| `ee/app/message-read-receipt/server/` (non-hooks) | `ee/server/lib/message-read-receipt/` | Phase 6 | -| `ee/app/livechat-enterprise/server/lib/` | `ee/server/lib/omnichannel/` | Phase 7 | -| `ee/app/livechat-enterprise/server/business-hour/`| `ee/server/lib/omnichannel/business-hour/`| Phase 7 | -| `ee/app/livechat-enterprise/server/outboundcomms/`| `ee/server/lib/omnichannel/outboundcomms/`| Phase 7 | -| `ee/app/livechat-enterprise/server/priorities.ts` | `ee/server/lib/omnichannel/` | Phase 7 | -| `ee/app/livechat-enterprise/server/services/` | `ee/server/services/` | Phase 7 | -| `ee/app/livechat-enterprise/server/` (settings, startup, permissions) | `ee/server/lib/omnichannel/` | Phase 7 | -| `ee/app/settings/server/` | `ee/server/settings/` | Phase 7 | - -**Note**: feature `index.ts` files (e.g. `ee/app/*/server/index.ts`) are import aggregators — fold their contents into the corresponding `ee/server/` entry points (`ee/server/index.ts`, `importPackages`) and delete them once empty, exactly as the community plan handles `app/lib/server/index.ts`. - -**Verification**: `yarn lint --quiet` after each EE sub-step; confirm no community file resolves to an `ee/` _file_ that moved (imports may still cross the boundary, but every EE source must resolve to an `ee/` destination). - ---- - -## Cross-Cutting Concerns - -### How to Handle `app/lib/server/lib/` (Utility Files) - -These files don't fit neatly into `lib//` because they're hooks, utilities, or notification orchestration: - -| File | Destination | Reason | -| -------------------------------- | --------------------------- | -------------------------- | -| `afterSaveMessage.ts` | `server/hooks/messages/` | It's a hook | -| `notifyUsersOnMessage.ts` | `server/hooks/messages/` | It's a hook | -| `sendNotificationsOnMessage.ts` | `server/hooks/messages/` | It's a hook | -| `beforeAddUserToRoom.ts` | `server/hooks/rooms/` | It's a hook | -| `notifyListener.ts` | `server/lib/` (stays) | Already effectively in lib | -| `msgStream.ts` | `server/lib/messaging/` | Messaging utility | -| `validateCustomMessageFields.ts` | `server/lib/messaging/` | Messaging utility | -| `bugsnag.ts` | `server/lib/` | Infrastructure | -| `deprecationWarningLogger.ts` | `server/lib/` | Infrastructure | -| `passwordPolicy.ts` | `server/lib/auth/` | Auth utility | -| `generatePassword.ts` | `server/lib/auth/` | Auth utility | -| `loginErrorMessageOverride.ts` | `server/lib/auth/` | Auth utility | -| `processDirectEmail.ts` | `server/lib/notifications/` | Email processing | -| `getHiddenSystemMessages.ts` | `server/lib/messaging/` | Messaging utility | -| `defaultBlockedDomainsList.ts` | `server/lib/` | Configuration data | -| `checkSettingValueBonds.ts` | `server/settings/` | Settings utility | - -### How to Handle `app/lib/server/startup/` - -| File | Destination | -| ---------------------------- | -------------------------------------------------- | -| `index.ts` | Updated to import from new paths | -| `rateLimiter.js` | `server/startup/rateLimiter.js` | -| `robots.js` | `server/startup/robots.js` | -| `mentionUserNotInChannel.ts` | `server/hooks/messages/mentionUserNotInChannel.ts` | - -### How to Handle `app/lib/server/index.ts` - -This file is the main import aggregator for the app/lib module. As files move out, update this file to remove the corresponding imports. Once all files are moved, delete `app/lib/server/index.ts` entirely. - -### Mirrored Test Trees (`tests/unit/**`) — move the specs with their sources - -Not every spec is co-located with its source: `tests/unit/` (and `ee/tests/unit/`) is a **mirror of the source tree** (`tests/unit/app/lib/server/functions/setUsername.spec.ts` tests `app/lib/server/functions/setUsername.ts`). Moving a source file without moving its mirrored spec leaves the spec **orphaned in a stale mirror** — it keeps running (the `tests/unit/**` globs still match it), so nothing fails, but the tree layout silently rots and the next person can't find the test for a module. - -**Procedure for every module move:** - -1. Move the mirrored spec so it mirrors the **new** source location: source `app/lib/server/functions/X.ts` → `server/lib/users/X.ts` means spec `tests/unit/app/lib/server/functions/X.spec.ts` → `tests/unit/server/lib/users/X.spec.ts`. -2. Recompute the spec's relative `import`s **and its proxyquire target path** (`proxyquire(...)` / `.load(...)` — string literals the move script does not rewrite) for the new depth. Mock **keys** are unaffected by moving the spec (they match the loaded module's own specifiers, not the spec's location). -3. Check runner globs both ways: the new location must be matched by an existing glob (`tests/unit/server/**/*.{spec,tests}.ts` already covers the server mirror), and the old glob must not be left matching nothing. - -**Orphan detector** (run after each phase): for every `*.spec.ts`/`*.tests.ts` under `tests/unit/app/**`, resolve its relative imports and proxyquire targets; any spec resolving into `server/**` (or `ee/server/**`) belongs in the corresponding mirror under `tests/unit/server/**` (or `ee/tests/unit/**`). Phases 3 and 4 left 15 such orphans (fixed in the Phase 4 follow-up); phases 1–2 had no unit-test mirrors. - -### Test Mocks and Runner Globs (proxyquire / jest.mock) — lint & tsc do NOT catch these - -Moving a module silently breaks two things that `yarn lint --quiet` and `tsc --noEmit` **cannot** see, because both are driven by **string literals**, not statically-resolved imports: - -1. **Mock keys go stale.** `proxyquire('./target', { '': stub })` and `jest.mock('', …)` match `` **literally** against the specifier the loaded module passes to `require`/`import`. When a module moves, _its own_ relative import specifiers change — so a mock key that used to match no longer does. proxyquire silently ignores the unmatched key and loads the **real** dependency instead of the stub. That either: - - **crashes the whole runner** — if the real dependency transitively pulls in `meteor/*` or other bundler-only modules (a single load-time throw aborts every spec in a mocha run, so the failure looks unrelated to the moved file); or - - **silently changes behavior** — the real function runs instead of the stub, producing confusing assertion failures (e.g. `expected undefined to be true`). - - Note two aliasing subtleties: a stale key may still _resolve to an existing file_ (so "does the path exist?" is not a sufficient check — it must **match the moved module's actual import specifier**), and the same key string is often reused as a plain property key in a `stubs`/`mocks` object, so it must be updated consistently in both places. - -2. **Runner discovery globs go stale.** `jest.config.ts` `testMatch` and `.mocharc.js` `spec` list **old directory paths**. A moved spec silently stops being discovered — worse than a red test, this is **green CI that runs nothing**. Keep jest specs and mocha specs in **separate** globs: a jest spec (`jest.mock`/`jest.fn`) accidentally matched by a mocha glob throws `jest is not defined`, and vice versa. When a moved spec lands in a directory that mixes runners (e.g. a Jest `getUserInfo.spec.ts` moving into a `lib/` folder full of mocha specs), name it explicitly and add a mocha `ignore` entry so the broad glob doesn't claim it. - -**Procedure after every module move (do this in the same PR):** - -- **Relocate mirrored specs.** Move the module's specs under `tests/unit/**` to mirror the new source location — see [Mirrored Test Trees](#mirrored-test-trees-testsunit--move-the-specs-with-their-sources). -- **Re-wire discovery globs.** For each moved `*.spec.ts`, update `jest.config.ts` `testMatch` (jest specs) or `.mocharc.js` `spec` (mocha specs) to its new location; remove the now-empty old glob (it prints a `Cannot find any files matching pattern` warning). -- **Find dependent specs.** Grep for specs that mock the moved module **or any module the moved module transitively imports**: `grep -rlE "proxyquire|jest\.mock" --include='*.spec.ts'`, then check each mock/`jest.mock` key against the moved module's new import specifiers. A quick detector: for every relative mock key, resolve it against the loaded module's directory and flag the ones that no longer resolve. -- **Rewrite stale keys** to exactly match the moved module's new relative import specifiers (update the reused property-key strings too). -- **Actually run the moved and dependent specs** — `yarn jest ` and `yarn mocha --config ./.mocharc.js `. Lint and tsc will pass on a spec whose mocks are entirely broken; only running it proves the stubs still intercept. - ---- - -## Risks and Mitigations - -| Risk | Mitigation | -| ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | -| **Broken imports** — moving 800+ files changes import paths everywhere | Migration script updates all imports in the same commit as the file move; `yarn lint --quiet` verifies after each batch (authoritative check for unresolved imports) | -| **Missing method registration** — Meteor methods must be imported to register | Each phase verifies that all methods still register by running `yarn lint --quiet` and method-specific tests | -| **Merge conflicts** — other developers working on moved files | Communicate migration schedule; do large moves in low-activity windows; each phase is a separate PR | -| **`app/lib/server/` is a dependency hub** — 62 features import from it | Migration script handles all import updates atomically per batch; `verify-no-old-imports.mjs` catches stragglers | -| **Omnichannel is huge** — 132 files in livechat | Move incrementally: API in Phase 3, methods in Phase 5, hooks in Phase 6, lib in Phase 7 | -| **Test breakage** — tests may import from old paths | Update test imports in the same PR as the file move; tests co-located with source files move together | -| **Silent test-mock breakage** — `proxyquire`/`jest.mock` string keys and runner discovery globs (`testMatch`, `.mocharc.js` `spec`) reference old paths; **lint and tsc pass anyway** | After every move, re-wire runner globs and rewrite stale mock keys to match the moved module's new specifiers, then **run** the moved and dependent specs (not just lint) — see [Test Mocks and Runner Globs](#test-mocks-and-runner-globs-proxyquire--jestmock--lint--tsc-do-not-catch-these) | -| **Accidental relicensing** — moving an `ee/` file into community `server/` silently strips its Enterprise license | Hard rule: EE files never leave `ee/` ([License Boundary](#license-boundary-ee--hard-constraint)); `move-module.mjs` guard refuses any boundary-crossing move before `git mv`; community manifests carry no `ee/` sources | - ---- - -## What This Plan Does NOT Do - -- **No code refactoring.** Files move as-is. Business logic stays the same. -- **No service consolidation.** Services stay in `server/services/` untouched. -- **No Meteor method removal.** Methods move to `server/meteor-methods//` but continue to work. -- **No new abstractions.** No port interfaces, no dependency injection, no new TypeScript patterns. -- **No reorganization of existing `server/` files.** Everything already in `server/` stays in place. Domain subfolders are additive. - ---- - -## After the Migration - -Once all files are in `server/`, the following improvements become possible (but are separate work): - -1. **Move business logic from `lib/` domain folders into `services/`** — the service layer becomes the single source of truth -2. **Delete Meteor methods** — the `server/meteor-methods/` directory can be emptied feature by feature -3. **Delete publications** — `server/publications/` can be emptied as DDP is removed -4. **Add `index.ts` exports** to each `lib//` for a clean public API -5. **Add ESLint layer rules** — e.g., `methods/` cannot import from `api/`, `lib/` domain folders cannot import from `methods/` -6. **Reorganize `server/lib/`** into a cleaner structure if needed (it will have grown with domain functions, auth-providers, messaging, notifications, etc.) diff --git a/apps/meteor/app/apps/server/bridges/commands.ts b/apps/meteor/app/apps/server/bridges/commands.ts index 36eaaed5f047d..b53d7ebfd1195 100644 --- a/apps/meteor/app/apps/server/bridges/commands.ts +++ b/apps/meteor/app/apps/server/bridges/commands.ts @@ -6,7 +6,7 @@ import type { IMessage, RequiredField, SlashCommand, SlashCommandCallbackParams import { Utilities } from '../../../../ee/lib/misc/Utilities'; import { parseParameters } from '../../../../lib/utils/parseParameters'; -import { slashCommands } from '../../../utils/server/slashCommand'; +import { slashCommands } from '../../../../server/lib/utils/slashCommand'; export class AppCommandsBridge extends CommandBridge { disabledCommands: Map; diff --git a/apps/meteor/app/apps/server/bridges/contact.ts b/apps/meteor/app/apps/server/bridges/contact.ts index fa00a839c6a4e..b8705e83b9a37 100644 --- a/apps/meteor/app/apps/server/bridges/contact.ts +++ b/apps/meteor/app/apps/server/bridges/contact.ts @@ -2,8 +2,8 @@ import type { IAppServerOrchestrator } from '@rocket.chat/apps'; import { ContactBridge } from '@rocket.chat/apps/dist/server/bridges/ContactBridge'; import type { ILivechatContact } from '@rocket.chat/apps-engine/definition/livechat'; -import { addContactEmail } from '../../../livechat/server/lib/contacts/addContactEmail'; -import { verifyContactChannel } from '../../../livechat/server/lib/contacts/verifyContactChannel'; +import { addContactEmail } from '../../../../server/lib/omnichannel/contacts/addContactEmail'; +import { verifyContactChannel } from '../../../../server/lib/omnichannel/contacts/verifyContactChannel'; export class AppContactBridge extends ContactBridge { constructor(private readonly orch: IAppServerOrchestrator) { diff --git a/apps/meteor/app/apps/server/bridges/email.ts b/apps/meteor/app/apps/server/bridges/email.ts index d45b94ae419cd..8a5d7a97d55f9 100644 --- a/apps/meteor/app/apps/server/bridges/email.ts +++ b/apps/meteor/app/apps/server/bridges/email.ts @@ -3,7 +3,7 @@ import { EmailBridge } from '@rocket.chat/apps/dist/server/bridges/EmailBridge'; import type { IEmail } from '@rocket.chat/apps-engine/definition/email'; import * as Mailer from '../../../../server/lib/notifications/email/api'; -import { settings } from '../../../settings/server'; +import { settings } from '../../../../server/settings'; export class AppEmailBridge extends EmailBridge { constructor(private readonly orch: IAppServerOrchestrator) { diff --git a/apps/meteor/app/apps/server/bridges/http.ts b/apps/meteor/app/apps/server/bridges/http.ts index f3bb6c502a426..4ecbcbbcb3ca3 100644 --- a/apps/meteor/app/apps/server/bridges/http.ts +++ b/apps/meteor/app/apps/server/bridges/http.ts @@ -5,7 +5,7 @@ import type { IHttpResponse } from '@rocket.chat/apps-engine/definition/accessor import { serverFetch as fetch, type ExtendedFetchOptions } from '@rocket.chat/server-fetch'; import { censorUrl } from '@rocket.chat/tools'; -import { settings } from '../../../settings/server'; +import { settings } from '../../../../server/settings'; const isGetOrHead = (method: string): boolean => ['GET', 'HEAD'].includes(method.toUpperCase()); diff --git a/apps/meteor/app/apps/server/bridges/livechat.ts b/apps/meteor/app/apps/server/bridges/livechat.ts index 81a6d8551f82e..2a397e502b9ad 100644 --- a/apps/meteor/app/apps/server/bridges/livechat.ts +++ b/apps/meteor/app/apps/server/bridges/livechat.ts @@ -18,16 +18,16 @@ import { registerGuest } from '@rocket.chat/omni-core'; import { deasyncPromise } from '../../../../server/deasync/deasync'; import { callbacks } from '../../../../server/lib/callbacks'; -import { closeRoom } from '../../../livechat/server/lib/closeRoom'; -import { setCustomFields } from '../../../livechat/server/lib/custom-fields'; -import { getRoomMessages } from '../../../livechat/server/lib/getRoomMessages'; -import type { ILivechatMessage } from '../../../livechat/server/lib/localTypes'; -import { updateMessage, sendMessage } from '../../../livechat/server/lib/messages'; -import { resolveVisitor } from '../../../livechat/server/lib/resolveVisitor'; -import { createRoom } from '../../../livechat/server/lib/rooms'; -import { online } from '../../../livechat/server/lib/service-status'; -import { transfer } from '../../../livechat/server/lib/transfer'; -import { settings } from '../../../settings/server'; +import { closeRoom } from '../../../../server/lib/omnichannel/closeRoom'; +import { setCustomFields } from '../../../../server/lib/omnichannel/custom-fields'; +import { getRoomMessages } from '../../../../server/lib/omnichannel/getRoomMessages'; +import type { ILivechatMessage } from '../../../../server/lib/omnichannel/localTypes'; +import { updateMessage, sendMessage } from '../../../../server/lib/omnichannel/messages'; +import { resolveVisitor } from '../../../../server/lib/omnichannel/resolveVisitor'; +import { createRoom } from '../../../../server/lib/omnichannel/rooms'; +import { online } from '../../../../server/lib/omnichannel/service-status'; +import { transfer } from '../../../../server/lib/omnichannel/transfer'; +import { settings } from '../../../../server/settings'; declare module '@rocket.chat/apps-engine/definition/accessors/ILivechatCreator' { interface IExtraRoomParams { diff --git a/apps/meteor/app/apps/server/bridges/outboundCommunication.ts b/apps/meteor/app/apps/server/bridges/outboundCommunication.ts index 3ba7218a601c0..ba0f88dae0894 100644 --- a/apps/meteor/app/apps/server/bridges/outboundCommunication.ts +++ b/apps/meteor/app/apps/server/bridges/outboundCommunication.ts @@ -6,7 +6,7 @@ import type { IOutboundPhoneMessageProvider, } from '@rocket.chat/apps-engine/definition/outboundCommunication'; -import { getOutboundService } from '../../../livechat/server/lib/outboundcommunication'; +import { getOutboundService } from '../../../../server/lib/omnichannel/outboundcommunication'; export class OutboundCommunicationBridge extends OutboundMessageBridge { constructor(private readonly orch: IAppServerOrchestrator) { diff --git a/apps/meteor/app/apps/server/bridges/settings.ts b/apps/meteor/app/apps/server/bridges/settings.ts index 145f81fc129ae..1900a8093bce0 100644 --- a/apps/meteor/app/apps/server/bridges/settings.ts +++ b/apps/meteor/app/apps/server/bridges/settings.ts @@ -4,8 +4,8 @@ import type { IReadSettingPermission } from '@rocket.chat/apps-engine/definition import type { ISetting } from '@rocket.chat/apps-engine/definition/settings'; import { Settings } from '@rocket.chat/models'; +import { notifyOnSettingChanged, notifyOnSettingChangedById } from '../../../../server/lib/notifyListener'; import { updateAuditedByApp } from '../../../../server/settings/lib/auditedSettingUpdates'; -import { notifyOnSettingChanged, notifyOnSettingChangedById } from '../../../lib/server/lib/notifyListener'; export class AppSettingBridge extends ServerSettingBridge { constructor(private readonly orch: IAppServerOrchestrator) { diff --git a/apps/meteor/app/apps/server/bridges/users.ts b/apps/meteor/app/apps/server/bridges/users.ts index 5f1688c7d4c98..4c345c9a443f2 100644 --- a/apps/meteor/app/apps/server/bridges/users.ts +++ b/apps/meteor/app/apps/server/bridges/users.ts @@ -6,13 +6,13 @@ import type { PresenceSource, UserStatus } from '@rocket.chat/core-typings'; import { Subscriptions, Users } from '@rocket.chat/models'; import { Random } from '@rocket.chat/random'; +import { notifyOnUserChange, notifyOnUserChangeById } from '../../../../server/lib/notifyListener'; import { checkUsernameAvailability } from '../../../../server/lib/users/checkUsernameAvailability'; import { deleteUser } from '../../../../server/lib/users/deleteUser'; import { getUserCreatedByApp } from '../../../../server/lib/users/getUserCreatedByApp'; import { setStatusText } from '../../../../server/lib/users/setStatusText'; import { setUserActiveStatus } from '../../../../server/lib/users/setUserActiveStatus'; import { setUserAvatar } from '../../../../server/lib/users/setUserAvatar'; -import { notifyOnUserChange, notifyOnUserChangeById } from '../../../lib/server/lib/notifyListener'; export class AppUserBridge extends UserBridge { constructor(private readonly orch: IAppServerOrchestrator) { diff --git a/apps/meteor/app/authorization/server/index.ts b/apps/meteor/app/authorization/server/index.ts deleted file mode 100644 index 223106379fa0d..0000000000000 --- a/apps/meteor/app/authorization/server/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { roomAccessAttributes, canAccessRoomAsync } from '../../../server/lib/authorization/canAccessRoom'; -import { getRoles } from '../../../server/lib/authorization/getRoles'; -import { getUsersInRole } from '../../../server/lib/authorization/getUsersInRole'; -import { subscriptionHasRole } from '../../../server/lib/authorization/hasRole'; -import './streamer/permissions'; - -export { getRoles, getUsersInRole, subscriptionHasRole, canAccessRoomAsync, roomAccessAttributes }; diff --git a/apps/meteor/app/channel-settings/server/index.ts b/apps/meteor/app/channel-settings/server/index.ts deleted file mode 100644 index 2e33e1eafea99..0000000000000 --- a/apps/meteor/app/channel-settings/server/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { saveRoomTopic } from './functions/saveRoomTopic'; -export { saveRoomName } from './functions/saveRoomName'; diff --git a/apps/meteor/app/custom-oauth/.gitignore b/apps/meteor/app/custom-oauth/.gitignore deleted file mode 100644 index 677a6fc26373d..0000000000000 --- a/apps/meteor/app/custom-oauth/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.build* diff --git a/apps/meteor/app/error-handler/server/index.ts b/apps/meteor/app/error-handler/server/index.ts deleted file mode 100644 index a321a704bc2cb..0000000000000 --- a/apps/meteor/app/error-handler/server/index.ts +++ /dev/null @@ -1 +0,0 @@ -import './lib/RocketChat.ErrorHandler'; diff --git a/apps/meteor/app/lib/server/index.ts b/apps/meteor/app/lib/server/index.ts deleted file mode 100644 index 087e329910cfc..0000000000000 --- a/apps/meteor/app/lib/server/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -import '../lib/MessageTypes'; -import './lib/bugsnag'; -import './lib/debug'; -import './lib/loginErrorMessageOverride'; -import '../../../server/lib/auth-providers/oauth/oauth'; -import '../../../server/lib/auth-providers/oauth/facebook'; -import '../../../server/lib/auth-providers/oauth/google'; -import '../../../server/lib/auth-providers/oauth/proxy'; -import '../../../server/lib/auth-providers/oauth/twitter'; -import './startup/mentionUserNotInChannel'; - -export * from './lib'; diff --git a/apps/meteor/app/lib/server/lib/index.ts b/apps/meteor/app/lib/server/lib/index.ts deleted file mode 100644 index 94e0daf97fdc1..0000000000000 --- a/apps/meteor/app/lib/server/lib/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* - What is this file? Great question! To make Rocket.Chat more "modular" - and to make the "rocketchat:lib" package more of a core package - with the libraries, this index file contains the exported members - for the *server* pieces of code which does include the shared - library files. -*/ -import './afterUserActions'; -import '../../../../server/hooks/messages/notifyUsersOnMessage'; - -export { sendNotification } from '../../../../server/hooks/messages/sendNotificationsOnMessage'; -export { passwordPolicy } from './passwordPolicy'; -export { validateEmailDomain } from './validateEmailDomain'; -export { RateLimiterClass as RateLimiter } from './RateLimiter'; -export { msgStream } from './msgStream'; diff --git a/apps/meteor/app/lib/server/lib/msgStream.ts b/apps/meteor/app/lib/server/lib/msgStream.ts deleted file mode 100644 index 3db2b02dad3f7..0000000000000 --- a/apps/meteor/app/lib/server/lib/msgStream.ts +++ /dev/null @@ -1,3 +0,0 @@ -import notifications from '../../../../server/lib/notifications/core/lib/Notifications'; - -export const msgStream = notifications.streamRoomMessage; diff --git a/apps/meteor/app/lib/server/startup/index.ts b/apps/meteor/app/lib/server/startup/index.ts deleted file mode 100644 index 94084edafb398..0000000000000 --- a/apps/meteor/app/lib/server/startup/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -import './rateLimiter'; -import './robots'; diff --git a/apps/meteor/app/livechat/lib/stream/constants.ts b/apps/meteor/app/livechat/lib/stream/constants.ts deleted file mode 100644 index 17c85f566f445..0000000000000 --- a/apps/meteor/app/livechat/lib/stream/constants.ts +++ /dev/null @@ -1 +0,0 @@ -export const LIVECHAT_INQUIRY_QUEUE_STREAM_OBSERVER = 'livechat-inquiry-queue-observer'; diff --git a/apps/meteor/app/livechat/server/index.ts b/apps/meteor/app/livechat/server/index.ts deleted file mode 100644 index d956247de2bd0..0000000000000 --- a/apps/meteor/app/livechat/server/index.ts +++ /dev/null @@ -1,24 +0,0 @@ -import './livechat'; -import './startup'; -import '../../../server/hooks/omnichannel/leadCapture'; -import '../../../server/hooks/omnichannel/markRoomResponded'; -import '../../../server/hooks/omnichannel/offlineMessage'; -import '../../../server/hooks/omnichannel/offlineMessageToChannel'; -import '../../../server/hooks/omnichannel/saveAnalyticsData'; -import '../../../server/hooks/omnichannel/sendToCRM'; -import '../../../server/hooks/omnichannel/processRoomAbandonment'; -import '../../../server/hooks/omnichannel/saveLastVisitorMessageTs'; -import '../../../server/hooks/omnichannel/markRoomNotResponded'; -import '../../../server/hooks/omnichannel/sendEmailTranscriptOnClose'; -import '../../../server/hooks/omnichannel/saveLastMessageToInquiry'; -import '../../../server/hooks/omnichannel/afterUserActions'; -import '../../../server/hooks/omnichannel/afterAgentRemoved'; -import '../../../server/hooks/omnichannel/afterSaveOmnichannelMessage'; -import './lib/QueueManager'; -import './lib/RoutingManager'; -import './lib/routing/External'; -import './lib/routing/ManualSelection'; -import './lib/routing/AutoSelection'; -import './lib/stream/agentStatus'; -import './sendMessageBySMS'; -import '../../../server/api/v1/omnichannel'; diff --git a/apps/meteor/app/logger/README.md b/apps/meteor/app/logger/README.md deleted file mode 100644 index b812f649c7cb7..0000000000000 --- a/apps/meteor/app/logger/README.md +++ /dev/null @@ -1,79 +0,0 @@ -# Logger - -Constructor -```javascript -new Logger(name, options); -``` - -options -* **sections**: An object of sections -* **methods**: An object of new methods - -Example -```javascript -const logger = new Logger('LDAP', { - sections: { - connection: 'Connection', - bind: 'Bind', - search: 'Search', - auth: 'Auth' - } -}); -``` - -Usage -```javascript -logger.info('connecting'); -// LDAP ➔ info connecting - -logger.connection.info('connecting'); -// LDAP ➔ Connection.info connecting -``` - -Sections have all avaliable methods methods, the default methods are: -```javascript -debug: - name: 'debug' - color: 'blue' - level: 2 -log: - name: 'info' - color: 'blue' - level: 1 -info: - name: 'info' - color: 'blue' - level: 1 -success: - name: 'info' - color: 'green' - level: 1 -warn: - name: 'warn' - color: 'magenta' - level: 1 -error: - name: 'error' - color: 'red' - level: 0 -``` - -The method **error** will always log the file and line of method execution - - -# LoggerManager (singleton) - -You can enable, disable, or set the log level for all logs here. -You can show the origin package and file/line from all logs here. - -```javascript -LoggerManager.enabled = false; -LoggerManager.showPackage = false; -LoggerManager.showFileAndLine = false; -LoggerManager.logLevel = 0; -``` - -The **LoggerManager** starts disabled, you should enable in some point, if you want to print all logs queued while disabled use: -```javascript -LoggerManager.enable(true); -``` diff --git a/apps/meteor/app/oauth2-server-config/.gitignore b/apps/meteor/app/oauth2-server-config/.gitignore deleted file mode 100644 index 677a6fc26373d..0000000000000 --- a/apps/meteor/app/oauth2-server-config/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.build* diff --git a/apps/meteor/app/oauth2-server-config/server/index.ts b/apps/meteor/app/oauth2-server-config/server/index.ts deleted file mode 100644 index 3914cac5eaadc..0000000000000 --- a/apps/meteor/app/oauth2-server-config/server/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -import './oauth/oauth2-server'; -import './admin/functions/addOAuthApp'; -import './admin/methods/updateOAuthApp'; -import './admin/methods/deleteOAuthApp'; diff --git a/apps/meteor/app/retention-policy/README.md b/apps/meteor/app/retention-policy/README.md deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/apps/meteor/app/settings/server/index.ts b/apps/meteor/app/settings/server/index.ts deleted file mode 100644 index 30a8c9fd6ba27..0000000000000 --- a/apps/meteor/app/settings/server/index.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* eslint-disable react-hooks/rules-of-hooks */ -import { Settings } from '@rocket.chat/models'; - -import { use } from './Middleware'; -import { SettingsRegistry } from './SettingsRegistry'; -import { settings } from './cached'; -import { initializeSettings } from './startup'; -import './applyMiddlewares'; - -export { SettingsEvents } from './SettingsRegistry'; - -export { settings }; - -export const settingsRegistry = new SettingsRegistry({ store: settings, model: Settings }); - -settingsRegistry.add = use(settingsRegistry.add, async (context, next) => { - return next(...context) as any; -}); - -settingsRegistry.addGroup = use(settingsRegistry.addGroup, async (context, next) => { - return next(...context) as any; -}); - -await initializeSettings({ model: Settings, settings }); diff --git a/apps/meteor/app/ui-utils/server/index.ts b/apps/meteor/app/ui-utils/server/index.ts deleted file mode 100644 index f2d89d22fcc40..0000000000000 --- a/apps/meteor/app/ui-utils/server/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { Message } from './Message'; diff --git a/apps/meteor/app/user-status/server/index.ts b/apps/meteor/app/user-status/server/index.ts deleted file mode 100644 index b1622098fa0a0..0000000000000 --- a/apps/meteor/app/user-status/server/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import './methods/deleteCustomUserStatus'; -import './methods/insertOrUpdateUserStatus'; -import './methods/listCustomUserStatus'; -import './methods/setUserStatus'; -import './methods/getUserStatusText'; diff --git a/apps/meteor/ee/app/livechat-enterprise/server/index.ts b/apps/meteor/ee/app/livechat-enterprise/server/index.ts deleted file mode 100644 index 3ab49a09fc428..0000000000000 --- a/apps/meteor/ee/app/livechat-enterprise/server/index.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { License } from '@rocket.chat/license'; -import { patchOmniCore } from '@rocket.chat/omni-core-ee'; -import { Meteor } from 'meteor/meteor'; - -import '../../../server/hooks/omnichannel/afterTakeInquiry'; -import '../../../server/hooks/omnichannel/beforeNewInquiry'; -import '../../../server/hooks/omnichannel/beforeNewRoom'; -import '../../../server/hooks/omnichannel/beforeRoutingChat'; -import '../../../server/hooks/omnichannel/checkAgentBeforeTakeInquiry'; -import '../../../server/hooks/omnichannel/handleNextAgentPreferredEvents'; -import '../../../server/hooks/omnichannel/onCheckRoomParamsApi'; -import '../../../server/hooks/omnichannel/onLoadConfigApi'; -import '../../../server/hooks/omnichannel/onSaveVisitorInfo'; -import '../../../server/hooks/omnichannel/scheduleAutoTransfer'; -import '../../../server/hooks/omnichannel/resumeOnHold'; -import '../../../server/hooks/omnichannel/afterOnHold'; -import '../../../server/hooks/omnichannel/onTransferFailure'; -import './lib/routing/LoadBalancing'; -import './lib/routing/LoadRotation'; -import './lib/AutoCloseOnHoldScheduler'; -import './business-hour'; -import '../../../server/api/v1/omnichannel'; -import { createDefaultPriorities } from './priorities'; - -patchOmniCore(); - -await License.onLicense('livechat-enterprise', async () => { - require('../../../server/hooks/omnichannel'); - await import('./startup'); - const { createPermissions } = await import('./permissions'); - const { createSettings } = await import('./settings'); - await import('./lib/unit'); - - Meteor.startup(() => { - void createSettings(); - void createPermissions(); - void createDefaultPriorities(); - }); -}); diff --git a/apps/meteor/ee/server/api/abac/index.ts b/apps/meteor/ee/server/api/abac/index.ts index 096920be10728..94c0b41cadbb0 100644 --- a/apps/meteor/ee/server/api/abac/index.ts +++ b/apps/meteor/ee/server/api/abac/index.ts @@ -26,10 +26,10 @@ import { GETAbacPdpHealthResponseSchema, GETAbacPdpHealthErrorResponseSchema, } from './schemas'; -import { settings } from '../../../../app/settings/server'; import { API } from '../../../../server/api'; import type { ExtractRoutesFromAPI } from '../../../../server/api/ApiClass'; import { getPaginationItems } from '../../../../server/api/lib/getPaginationItems'; +import { settings } from '../../../../server/settings'; const getActorFromUser = (user?: IUser | null): AbacActor | undefined => user?._id diff --git a/apps/meteor/ee/server/api/api.ts b/apps/meteor/ee/server/api/api.ts index 73d43a4e31a5f..b6761402400c1 100644 --- a/apps/meteor/ee/server/api/api.ts +++ b/apps/meteor/ee/server/api/api.ts @@ -1,9 +1,9 @@ /* eslint-disable react-hooks/rules-of-hooks */ import { License } from '@rocket.chat/license'; -import { use } from '../../../app/settings/server/Middleware'; import { API } from '../../../server/api/api'; import type { NonEnterpriseTwoFactorOptions, Options } from '../../../server/api/definition'; +import { use } from '../../../server/settings/Middleware'; // Overwrites two factor method to enforce 2FA check for enterprise APIs when // no license was provided to prevent abuse on enterprise APIs. diff --git a/apps/meteor/ee/server/api/ldap.ts b/apps/meteor/ee/server/api/ldap.ts index e0cd8eff809f3..1472c87ae4773 100644 --- a/apps/meteor/ee/server/api/ldap.ts +++ b/apps/meteor/ee/server/api/ldap.ts @@ -1,9 +1,9 @@ import { LDAPEnterprise } from '@rocket.chat/core-services'; import { ajv, validateBadRequestErrorResponse, validateUnauthorizedErrorResponse } from '@rocket.chat/rest-typings'; -import { settings } from '../../../app/settings/server'; import { API } from '../../../server/api/api'; import { hasPermissionAsync } from '../../../server/lib/authorization/hasPermission'; +import { settings } from '../../../server/settings'; const ldapSyncNowResponseSchema = ajv.compile<{ message: string }>({ type: 'object', diff --git a/apps/meteor/ee/server/api/licenses.ts b/apps/meteor/ee/server/api/licenses.ts index 4c3ca249f4db6..37eb0a6aead91 100644 --- a/apps/meteor/ee/server/api/licenses.ts +++ b/apps/meteor/ee/server/api/licenses.ts @@ -3,10 +3,10 @@ import { Settings, Users } from '@rocket.chat/models'; import { isLicensesInfoProps, isLicensesValidateProps } from '@rocket.chat/rest-typings'; import { check } from 'meteor/check'; -import { notifyOnSettingChangedById } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; import { API } from '../../../server/api/api'; import { hasPermissionAsync } from '../../../server/lib/authorization/hasPermission'; +import { notifyOnSettingChangedById } from '../../../server/lib/notifyListener'; +import { settings } from '../../../server/settings'; import { updateAuditedByUser } from '../../../server/settings/lib/auditedSettingUpdates'; API.v1.addRoute( diff --git a/apps/meteor/ee/server/api/roles.ts b/apps/meteor/ee/server/api/roles.ts index fdba9832bebda..ca2327fd1fa01 100644 --- a/apps/meteor/ee/server/api/roles.ts +++ b/apps/meteor/ee/server/api/roles.ts @@ -4,9 +4,9 @@ import { Roles } from '@rocket.chat/models'; import { ajv } from '@rocket.chat/rest-typings'; import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../app/settings/server/index'; import { API } from '../../../server/api/api'; import { hasPermissionAsync } from '../../../server/lib/authorization/hasPermission'; +import { settings } from '../../../server/settings'; import { insertRoleAsync } from '../lib/roles/insertRole'; import { updateRole } from '../lib/roles/updateRole'; diff --git a/apps/meteor/ee/server/api/v1/omnichannel/agents.ts b/apps/meteor/ee/server/api/v1/omnichannel/agents.ts index 4d8315a725908..733f84d052a3f 100644 --- a/apps/meteor/ee/server/api/v1/omnichannel/agents.ts +++ b/apps/meteor/ee/server/api/v1/omnichannel/agents.ts @@ -4,13 +4,13 @@ import { isLivechatAnalyticsAgentsAvailableForServiceHistoryProps, } from '@rocket.chat/rest-typings'; +import { API } from '../../../../../server/api'; +import { getPaginationItems } from '../../../../../server/api/lib/getPaginationItems'; import { findAllAverageServiceTimeAsync, findAllServiceTimeAsync, findAvailableServiceTimeHistoryAsync, -} from '../../../../../app/livechat/server/lib/analytics/agents'; -import { API } from '../../../../../server/api'; -import { getPaginationItems } from '../../../../../server/api/lib/getPaginationItems'; +} from '../../../../../server/lib/omnichannel/analytics/agents'; API.v1.addRoute( 'livechat/analytics/agents/average-service-time', diff --git a/apps/meteor/ee/server/api/v1/omnichannel/business-hours.ts b/apps/meteor/ee/server/api/v1/omnichannel/business-hours.ts index 5bcc43a55663a..252622f4dc8c3 100644 --- a/apps/meteor/ee/server/api/v1/omnichannel/business-hours.ts +++ b/apps/meteor/ee/server/api/v1/omnichannel/business-hours.ts @@ -3,7 +3,7 @@ import type { PaginatedRequest } from '@rocket.chat/rest-typings'; import { API } from '../../../../../server/api'; import { getPaginationItems } from '../../../../../server/api/lib/getPaginationItems'; -import { findBusinessHours } from '../../../../app/livechat-enterprise/server/business-hour/lib/business-hour'; +import { findBusinessHours } from '../../../lib/omnichannel/business-hour/lib/business-hour'; declare module '@rocket.chat/rest-typings' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/ee/server/api/v1/omnichannel/contacts.ts b/apps/meteor/ee/server/api/v1/omnichannel/contacts.ts index 85e8facd8b9b1..60e37a5f7d7c7 100644 --- a/apps/meteor/ee/server/api/v1/omnichannel/contacts.ts +++ b/apps/meteor/ee/server/api/v1/omnichannel/contacts.ts @@ -3,7 +3,7 @@ import { ContactVisitorAssociationSchema, ajv } from '@rocket.chat/rest-typings' import { changeContactBlockStatus, closeBlockedRoom, ensureSingleContactLicense } from './lib/contacts'; import { API } from '../../../../../server/api'; -import { logger } from '../../../../app/livechat-enterprise/server/lib/logger'; +import { logger } from '../../../lib/omnichannel/logger'; type blockContactProps = { visitor: ILivechatContactVisitorAssociation; diff --git a/apps/meteor/ee/server/api/v1/omnichannel/departments.ts b/apps/meteor/ee/server/api/v1/omnichannel/departments.ts index 7c432bee6926d..2e20a1aa85509 100644 --- a/apps/meteor/ee/server/api/v1/omnichannel/departments.ts +++ b/apps/meteor/ee/server/api/v1/omnichannel/departments.ts @@ -9,6 +9,8 @@ import { isLivechatAnalyticsDepartmentsPercentageAbandonedChatsProps, } from '@rocket.chat/rest-typings'; +import { API } from '../../../../../server/api'; +import { getPaginationItems } from '../../../../../server/api/lib/getPaginationItems'; import { findAllRoomsAsync, findAllAverageServiceTimeAsync, @@ -18,9 +20,7 @@ import { findAllNumberOfAbandonedRoomsAsync, findPercentageOfAbandonedRoomsAsync, findAllAverageOfChatDurationTimeAsync, -} from '../../../../../app/livechat/server/lib/analytics/departments'; -import { API } from '../../../../../server/api'; -import { getPaginationItems } from '../../../../../server/api/lib/getPaginationItems'; +} from '../../../../../server/lib/omnichannel/analytics/departments'; API.v1.addRoute( 'livechat/analytics/departments/amount-of-chats', diff --git a/apps/meteor/ee/server/api/v1/omnichannel/lib/contacts.ts b/apps/meteor/ee/server/api/v1/omnichannel/lib/contacts.ts index 14a2c9be8e5b2..540b01c924fc7 100644 --- a/apps/meteor/ee/server/api/v1/omnichannel/lib/contacts.ts +++ b/apps/meteor/ee/server/api/v1/omnichannel/lib/contacts.ts @@ -2,8 +2,8 @@ import type { IUser, ILivechatContactVisitorAssociation } from '@rocket.chat/cor import { License } from '@rocket.chat/license'; import { LivechatContacts, LivechatRooms, LivechatVisitors } from '@rocket.chat/models'; -import { closeRoom } from '../../../../../../app/livechat/server/lib/closeRoom'; import { i18n } from '../../../../../../server/lib/i18n'; +import { closeRoom } from '../../../../../../server/lib/omnichannel/closeRoom'; export async function changeContactBlockStatus({ block, visitor }: { visitor: ILivechatContactVisitorAssociation; block: boolean }) { const result = await LivechatContacts.setChannelBlockStatus(visitor, block); diff --git a/apps/meteor/ee/server/api/v1/omnichannel/lib/departments.ts b/apps/meteor/ee/server/api/v1/omnichannel/lib/departments.ts index 7c6665822a15d..1a13aecc0376f 100644 --- a/apps/meteor/ee/server/api/v1/omnichannel/lib/departments.ts +++ b/apps/meteor/ee/server/api/v1/omnichannel/lib/departments.ts @@ -1,6 +1,6 @@ import { LivechatDepartment, LivechatDepartmentAgents, LivechatUnit } from '@rocket.chat/models'; -import { helperLogger } from '../../../../../app/livechat-enterprise/server/lib/logger'; +import { helperLogger } from '../../../../lib/omnichannel/logger'; export const getDepartmentsWhichUserCanAccess = async (userId: string, includeDisabled = false): Promise => { const departments = await LivechatDepartmentAgents.find( diff --git a/apps/meteor/ee/server/api/v1/omnichannel/lib/outbound.ts b/apps/meteor/ee/server/api/v1/omnichannel/lib/outbound.ts index f73602f34b43a..a5090375f4dfb 100644 --- a/apps/meteor/ee/server/api/v1/omnichannel/lib/outbound.ts +++ b/apps/meteor/ee/server/api/v1/omnichannel/lib/outbound.ts @@ -8,8 +8,8 @@ import type { } from '@rocket.chat/core-typings'; import { ValidOutboundProviderList } from '@rocket.chat/core-typings'; -import { getOutboundService } from '../../../../../../app/livechat/server/lib/outboundcommunication'; import { OutboundMessageProvider } from '../../../../../../server/lib/OutboundMessageProvider'; +import { getOutboundService } from '../../../../../../server/lib/omnichannel/outboundcommunication'; export class OutboundMessageProviderService implements IOutboundMessageProviderService { private readonly provider: OutboundMessageProvider; diff --git a/apps/meteor/ee/server/api/v1/omnichannel/lib/priorities.ts b/apps/meteor/ee/server/api/v1/omnichannel/lib/priorities.ts index 417601b5cb3b5..eafdd1be94fa7 100644 --- a/apps/meteor/ee/server/api/v1/omnichannel/lib/priorities.ts +++ b/apps/meteor/ee/server/api/v1/omnichannel/lib/priorities.ts @@ -5,8 +5,8 @@ import type { PaginatedResult } from '@rocket.chat/rest-typings'; import { escapeRegExp } from '@rocket.chat/string-helpers'; import type { FindOptions } from 'mongodb'; -import { notifyOnLivechatInquiryChangedByRoom, notifyOnRoomChanged } from '../../../../../../app/lib/server/lib/notifyListener'; -import { logger } from '../../../../../app/livechat-enterprise/server/lib/logger'; +import { notifyOnLivechatInquiryChangedByRoom, notifyOnRoomChanged } from '../../../../../../server/lib/notifyListener'; +import { logger } from '../../../../lib/omnichannel/logger'; type FindPriorityParams = { text?: string; diff --git a/apps/meteor/ee/server/api/v1/omnichannel/lib/sla.ts b/apps/meteor/ee/server/api/v1/omnichannel/lib/sla.ts index 587eb89b5ab71..794193a2c852e 100644 --- a/apps/meteor/ee/server/api/v1/omnichannel/lib/sla.ts +++ b/apps/meteor/ee/server/api/v1/omnichannel/lib/sla.ts @@ -10,7 +10,7 @@ import { removeSlaFromRoom, updateInquiryQueueSla, updateRoomSlaWeights, -} from '../../../../../app/livechat-enterprise/server/lib/SlaHelper'; +} from '../../../../lib/omnichannel/SlaHelper'; type FindSLAParams = { text?: string; diff --git a/apps/meteor/ee/server/api/v1/omnichannel/lib/tags.ts b/apps/meteor/ee/server/api/v1/omnichannel/lib/tags.ts index 51fc048851340..f58ff73b71149 100644 --- a/apps/meteor/ee/server/api/v1/omnichannel/lib/tags.ts +++ b/apps/meteor/ee/server/api/v1/omnichannel/lib/tags.ts @@ -5,7 +5,7 @@ import type { Filter, FindOptions } from 'mongodb'; import { getDepartmentsWhichUserCanAccess } from './departments'; import { hasPermissionAsync } from '../../../../../../server/lib/authorization/hasPermission'; -import { helperLogger } from '../../../../../app/livechat-enterprise/server/lib/logger'; +import { helperLogger } from '../../../../lib/omnichannel/logger'; type FindTagsParams = { userId: string; diff --git a/apps/meteor/ee/server/api/v1/omnichannel/monitors.ts b/apps/meteor/ee/server/api/v1/omnichannel/monitors.ts index 23074ca49480d..96eafdf9d201f 100644 --- a/apps/meteor/ee/server/api/v1/omnichannel/monitors.ts +++ b/apps/meteor/ee/server/api/v1/omnichannel/monitors.ts @@ -14,7 +14,7 @@ import { findMonitors, findMonitorByUsername } from './lib/monitors'; import { API } from '../../../../../server/api'; import type { ExtractRoutesFromAPI } from '../../../../../server/api/ApiClass'; import { getPaginationItems } from '../../../../../server/api/lib/getPaginationItems'; -import { LivechatEnterprise } from '../../../../app/livechat-enterprise/server/lib/LivechatEnterprise'; +import { LivechatEnterprise } from '../../../lib/omnichannel/LivechatEnterprise'; API.v1.addRoute( 'livechat/monitors', diff --git a/apps/meteor/ee/server/api/v1/omnichannel/outbound.ts b/apps/meteor/ee/server/api/v1/omnichannel/outbound.ts index c01f6699a999e..91948c5f174ce 100644 --- a/apps/meteor/ee/server/api/v1/omnichannel/outbound.ts +++ b/apps/meteor/ee/server/api/v1/omnichannel/outbound.ts @@ -15,7 +15,7 @@ import { GETOutboundProviderMetadataSchema, POSTOutboundMessageParams, POSTOutboundMessageSuccessSchema, -} from '../../../../app/livechat-enterprise/server/outboundcomms/rest'; +} from '../../../lib/omnichannel/outboundcomms/rest'; const outboundCommsEndpoints = API.v1 .get( diff --git a/apps/meteor/ee/server/api/v1/omnichannel/priorities.ts b/apps/meteor/ee/server/api/v1/omnichannel/priorities.ts index e3cb95fdd0459..05deb5f5598d8 100644 --- a/apps/meteor/ee/server/api/v1/omnichannel/priorities.ts +++ b/apps/meteor/ee/server/api/v1/omnichannel/priorities.ts @@ -2,9 +2,9 @@ import { LivechatPriority } from '@rocket.chat/models'; import { isGETLivechatPrioritiesParams, isPUTLivechatPriority } from '@rocket.chat/rest-typings'; import { findPriority, updatePriority } from './lib/priorities'; -import { notifyOnLivechatPriorityChanged } from '../../../../../app/lib/server/lib/notifyListener'; import { API } from '../../../../../server/api'; import { getPaginationItems } from '../../../../../server/api/lib/getPaginationItems'; +import { notifyOnLivechatPriorityChanged } from '../../../../../server/lib/notifyListener'; API.v1.addRoute( 'livechat/priorities', diff --git a/apps/meteor/ee/server/api/v1/omnichannel/reports.ts b/apps/meteor/ee/server/api/v1/omnichannel/reports.ts index cef842fbce272..8b2abfebc1844 100644 --- a/apps/meteor/ee/server/api/v1/omnichannel/reports.ts +++ b/apps/meteor/ee/server/api/v1/omnichannel/reports.ts @@ -10,7 +10,7 @@ import { findAllConversationsByAgentsCached, } from './lib/dashboards'; import { API } from '../../../../../server/api'; -import { restrictQuery } from '../../../../app/livechat-enterprise/server/lib/restrictQuery'; +import { restrictQuery } from '../../../lib/omnichannel/restrictQuery'; const checkDates = (start: Moment, end: Moment) => { if (!start.isValid()) { diff --git a/apps/meteor/ee/server/api/v1/omnichannel/sla.ts b/apps/meteor/ee/server/api/v1/omnichannel/sla.ts index 3b4bdc27624d4..904a9e2e89f98 100644 --- a/apps/meteor/ee/server/api/v1/omnichannel/sla.ts +++ b/apps/meteor/ee/server/api/v1/omnichannel/sla.ts @@ -4,7 +4,7 @@ import { isLivechatPrioritiesProps, isCreateOrUpdateLivechatSlaProps } from '@ro import { findSLA } from './lib/sla'; import { API } from '../../../../../server/api'; import { getPaginationItems } from '../../../../../server/api/lib/getPaginationItems'; -import { LivechatEnterprise } from '../../../../app/livechat-enterprise/server/lib/LivechatEnterprise'; +import { LivechatEnterprise } from '../../../lib/omnichannel/LivechatEnterprise'; API.v1.addRoute( 'livechat/sla', diff --git a/apps/meteor/ee/server/api/v1/omnichannel/tags.ts b/apps/meteor/ee/server/api/v1/omnichannel/tags.ts index 35d4f6683cce8..a3ac42429e479 100644 --- a/apps/meteor/ee/server/api/v1/omnichannel/tags.ts +++ b/apps/meteor/ee/server/api/v1/omnichannel/tags.ts @@ -12,7 +12,7 @@ import { findTags, findTagById } from './lib/tags'; import { API } from '../../../../../server/api'; import type { ExtractRoutesFromAPI } from '../../../../../server/api/ApiClass'; import { getPaginationItems } from '../../../../../server/api/lib/getPaginationItems'; -import { LivechatEnterprise } from '../../../../app/livechat-enterprise/server/lib/LivechatEnterprise'; +import { LivechatEnterprise } from '../../../lib/omnichannel/LivechatEnterprise'; API.v1.addRoute( 'livechat/tags', diff --git a/apps/meteor/ee/server/api/v1/omnichannel/transcript.ts b/apps/meteor/ee/server/api/v1/omnichannel/transcript.ts index 0379b4a296985..00acf2a1d415a 100644 --- a/apps/meteor/ee/server/api/v1/omnichannel/transcript.ts +++ b/apps/meteor/ee/server/api/v1/omnichannel/transcript.ts @@ -3,7 +3,7 @@ import { LivechatRooms } from '@rocket.chat/models'; import { API } from '../../../../../server/api'; import { canAccessRoomAsync } from '../../../../../server/lib/authorization/canAccessRoom'; -import { requestPdfTranscript } from '../../../../app/livechat-enterprise/server/lib/requestPdfTranscript'; +import { requestPdfTranscript } from '../../../lib/omnichannel/requestPdfTranscript'; API.v1.addRoute( 'omnichannel/:rid/request-transcript', diff --git a/apps/meteor/ee/server/api/v1/omnichannel/triggers.ts b/apps/meteor/ee/server/api/v1/omnichannel/triggers.ts index 3fdeb083feda0..7f21f143e2892 100644 --- a/apps/meteor/ee/server/api/v1/omnichannel/triggers.ts +++ b/apps/meteor/ee/server/api/v1/omnichannel/triggers.ts @@ -4,8 +4,8 @@ import { isLivechatTriggerWebhookCallParams } from '@rocket.chat/rest-typings'; import { isLivechatTriggerWebhookTestParams } from '@rocket.chat/rest-typings/src/v1/omnichannel'; import { callTriggerExternalService } from './lib/triggers'; -import { settings } from '../../../../../app/settings/server'; import { API } from '../../../../../server/api'; +import { settings } from '../../../../../server/settings'; API.v1.addRoute( 'livechat/triggers/external-service/test', diff --git a/apps/meteor/ee/server/api/v1/omnichannel/units.ts b/apps/meteor/ee/server/api/v1/omnichannel/units.ts index d192aeb95b16e..04d312904f5fb 100644 --- a/apps/meteor/ee/server/api/v1/omnichannel/units.ts +++ b/apps/meteor/ee/server/api/v1/omnichannel/units.ts @@ -5,8 +5,8 @@ import { findUnits, findUnitById, findUnitMonitors, findUnitsOfUser } from './li import { API } from '../../../../../server/api'; import { getPaginationItems } from '../../../../../server/api/lib/getPaginationItems'; import { hasPermissionAsync } from '../../../../../server/lib/authorization/hasPermission'; -import { findAllDepartmentsAvailable, findAllDepartmentsByUnit } from '../../../../app/livechat-enterprise/server/lib/Department'; -import { LivechatEnterprise } from '../../../../app/livechat-enterprise/server/lib/LivechatEnterprise'; +import { findAllDepartmentsAvailable, findAllDepartmentsByUnit } from '../../../lib/omnichannel/Department'; +import { LivechatEnterprise } from '../../../lib/omnichannel/LivechatEnterprise'; declare module '@rocket.chat/rest-typings' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/ee/server/apps/appRequestsCron.ts b/apps/meteor/ee/server/apps/appRequestsCron.ts index 50c509a6468fd..6536d45fd0fe8 100644 --- a/apps/meteor/ee/server/apps/appRequestsCron.ts +++ b/apps/meteor/ee/server/apps/appRequestsCron.ts @@ -3,8 +3,8 @@ import type { ExtendedFetchOptions } from '@rocket.chat/server-fetch'; import { appRequestNotififyForUsers } from './marketplace/appRequestNotifyUsers'; import { Apps } from './orchestrator'; -import { settings } from '../../../app/settings/server'; import { getWorkspaceAccessToken } from '../../../server/lib/cloud'; +import { settings } from '../../../server/settings'; const appsNotifyAppRequests = async function _appsNotifyAppRequests() { try { diff --git a/apps/meteor/ee/server/apps/communication/rest.ts b/apps/meteor/ee/server/apps/communication/rest.ts index a69e3e0b2ddd1..e9f289ed952da 100644 --- a/apps/meteor/ee/server/apps/communication/rest.ts +++ b/apps/meteor/ee/server/apps/communication/rest.ts @@ -16,7 +16,6 @@ import { registerAppLogsDistinctInstanceHandler } from './endpoints/appLogsDisti import { registerAppLogsExportHandler } from './endpoints/appLogsExportHandler'; import { registerAppLogsHandler } from './endpoints/appLogsHandler'; import { registerAppsCountHandler } from './endpoints/appsCountHandler'; -import { settings } from '../../../../app/settings/server'; import { Info } from '../../../../app/utils/rocketchat.info'; import { API } from '../../../../server/api'; import type { APIClass } from '../../../../server/api/ApiClass'; @@ -29,6 +28,7 @@ import { i18n } from '../../../../server/lib/i18n'; import { metrics } from '../../../../server/lib/metrics'; import { sendMessagesToAdmins } from '../../../../server/lib/sendMessagesToAdmins'; import { AppsEngineNoNodesFoundError } from '../../../../server/services/apps-engine/service'; +import { settings } from '../../../../server/settings'; import { fetchAppsStatusFromCluster } from '../../../lib/misc/fetchAppsStatusFromCluster'; import { formatAppInstanceForRest } from '../../../lib/misc/formatAppInstanceForRest'; import { canEnableApp } from '../../lib/license/canEnableApp'; diff --git a/apps/meteor/ee/server/apps/communication/uikit.ts b/apps/meteor/ee/server/apps/communication/uikit.ts index e854603d6632d..6cb4068604850 100644 --- a/apps/meteor/ee/server/apps/communication/uikit.ts +++ b/apps/meteor/ee/server/apps/communication/uikit.ts @@ -9,8 +9,8 @@ import rateLimit from 'express-rate-limit'; import { Meteor } from 'meteor/meteor'; import { WebApp } from 'meteor/webapp'; -import { settings } from '../../../../app/settings/server'; import { authenticationMiddleware } from '../../../../server/api/v1/middlewares/authentication'; +import { settings } from '../../../../server/settings'; import { Apps } from '../orchestrator'; const apiServer = express(); diff --git a/apps/meteor/ee/server/apps/marketplace/appInstall.ts b/apps/meteor/ee/server/apps/marketplace/appInstall.ts index ef5f666632bf8..e2ae3316a9a12 100644 --- a/apps/meteor/ee/server/apps/marketplace/appInstall.ts +++ b/apps/meteor/ee/server/apps/marketplace/appInstall.ts @@ -1,8 +1,8 @@ import type { IAppInfo } from '@rocket.chat/apps-engine/definition/metadata'; -import { settings } from '../../../../app/settings/server'; import { Info } from '../../../../app/utils/rocketchat.info'; import { getWorkspaceAccessToken } from '../../../../server/lib/cloud'; +import { settings } from '../../../../server/settings'; import { Apps } from '../orchestrator'; type MarketplaceNotificationType = 'install' | 'update' | 'uninstall'; diff --git a/apps/meteor/ee/server/apps/marketplace/fetchMarketplaceApps.ts b/apps/meteor/ee/server/apps/marketplace/fetchMarketplaceApps.ts index 9556316c27d75..6b2f4d39404b7 100644 --- a/apps/meteor/ee/server/apps/marketplace/fetchMarketplaceApps.ts +++ b/apps/meteor/ee/server/apps/marketplace/fetchMarketplaceApps.ts @@ -3,8 +3,8 @@ import * as z from 'zod'; import { getMarketplaceHeaders } from './getMarketplaceHeaders'; import { MarketplaceAppsError, MarketplaceConnectionError, MarketplaceUnsupportedVersionError } from './marketplaceErrors'; -import { settings } from '../../../../app/settings/server'; import { getWorkspaceAccessToken } from '../../../../server/lib/cloud'; +import { settings } from '../../../../server/settings'; import { Apps } from '../orchestrator'; type FetchMarketplaceAppsParams = { diff --git a/apps/meteor/ee/server/apps/marketplace/fetchMarketplaceCategories.ts b/apps/meteor/ee/server/apps/marketplace/fetchMarketplaceCategories.ts index cc2d4cbbd283d..295b9ec50975e 100644 --- a/apps/meteor/ee/server/apps/marketplace/fetchMarketplaceCategories.ts +++ b/apps/meteor/ee/server/apps/marketplace/fetchMarketplaceCategories.ts @@ -3,8 +3,8 @@ import * as z from 'zod'; import { getMarketplaceHeaders } from './getMarketplaceHeaders'; import { MarketplaceAppsError, MarketplaceConnectionError, MarketplaceUnsupportedVersionError } from './marketplaceErrors'; -import { settings } from '../../../../app/settings/server'; import { getWorkspaceAccessToken } from '../../../../server/lib/cloud'; +import { settings } from '../../../../server/settings'; import { Apps } from '../orchestrator'; const fetchMarketplaceCategoriesSchema = z.array( diff --git a/apps/meteor/ee/server/apps/orchestrator.js b/apps/meteor/ee/server/apps/orchestrator.js index 2be26538d246b..0c18d58ee7037 100644 --- a/apps/meteor/ee/server/apps/orchestrator.js +++ b/apps/meteor/ee/server/apps/orchestrator.js @@ -28,7 +28,7 @@ import { AppContactsConverter, } from '../../../app/apps/server/converters'; import { AppThreadsConverter } from '../../../app/apps/server/converters/threads'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../../server/settings'; import { canEnableApp } from '../lib/license/canEnableApp'; const DISABLED_PRIVATE_APP_INSTALLATION = ['yes', 'true'].includes(String(process.env.DISABLE_PRIVATE_APP_INSTALLATION).toLowerCase()); diff --git a/apps/meteor/ee/server/apps/startup.ts b/apps/meteor/ee/server/apps/startup.ts index 2b24859ff122f..35deb856563d9 100644 --- a/apps/meteor/ee/server/apps/startup.ts +++ b/apps/meteor/ee/server/apps/startup.ts @@ -1,7 +1,7 @@ import { License } from '@rocket.chat/license'; import { Apps } from './orchestrator'; -import { settings, settingsRegistry } from '../../../app/settings/server'; +import { settings, settingsRegistry } from '../../../server/settings'; import { disableAppsWithAddonsCallback } from '../lib/apps/disableAppsWithAddonsCallback'; export const startupApp = async function startupApp() { diff --git a/apps/meteor/ee/server/configuration/abac.ts b/apps/meteor/ee/server/configuration/abac.ts index 1e85423f9c65f..097ce941743a6 100644 --- a/apps/meteor/ee/server/configuration/abac.ts +++ b/apps/meteor/ee/server/configuration/abac.ts @@ -5,7 +5,7 @@ import { Users } from '@rocket.chat/models'; import { isValidCron } from 'cron-validator'; import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../../server/settings'; const VIRTRU_PDP_SYNC_JOB = 'ABAC_Virtru_PDP_Sync'; diff --git a/apps/meteor/ee/server/configuration/ldap.ts b/apps/meteor/ee/server/configuration/ldap.ts index 00da5e6f9d94a..928cbc43c3b96 100644 --- a/apps/meteor/ee/server/configuration/ldap.ts +++ b/apps/meteor/ee/server/configuration/ldap.ts @@ -6,10 +6,10 @@ import { Settings } from '@rocket.chat/models'; import { isValidCron } from 'cron-validator'; import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../app/settings/server'; import { callbacks } from '../../../server/lib/callbacks'; import type { LDAPConnection } from '../../../server/lib/ldap/Connection'; import { logger } from '../../../server/lib/ldap/Logger'; +import { settings } from '../../../server/settings'; import { LDAPEEManager } from '../lib/ldap/Manager'; import { addSettings, ldapIntervalValuesToCronMap } from '../settings/ldap'; diff --git a/apps/meteor/ee/server/configuration/oauth.ts b/apps/meteor/ee/server/configuration/oauth.ts index 7a0ff5946eae9..86c932d52fda6 100644 --- a/apps/meteor/ee/server/configuration/oauth.ts +++ b/apps/meteor/ee/server/configuration/oauth.ts @@ -4,8 +4,8 @@ import { Logger } from '@rocket.chat/logger'; import { Roles } from '@rocket.chat/models'; import { capitalize } from '@rocket.chat/string-helpers'; -import { settings } from '../../../app/settings/server'; import { callbacks } from '../../../server/lib/callbacks'; +import { settings } from '../../../server/settings'; import { OAuthEEManager } from '../lib/oauth/Manager'; import { syncUserRoles } from '../lib/syncUserRoles'; diff --git a/apps/meteor/ee/server/configuration/saml.ts b/apps/meteor/ee/server/configuration/saml.ts index c6ab761fe5967..f9e380fd34cca 100644 --- a/apps/meteor/ee/server/configuration/saml.ts +++ b/apps/meteor/ee/server/configuration/saml.ts @@ -1,10 +1,10 @@ import { License } from '@rocket.chat/license'; import { Roles, Users } from '@rocket.chat/models'; -import { settings } from '../../../app/settings/server'; import { ensureArray } from '../../../lib/utils/arrayUtils'; import type { ISAMLUser } from '../../../server/lib/saml/definition/ISAMLUser'; import { SAMLUtils } from '../../../server/lib/saml/lib/Utils'; +import { settings } from '../../../server/settings'; import { addSettings } from '../settings/saml'; await License.onLicense('saml-enterprise', () => { diff --git a/apps/meteor/ee/server/cron/readReceiptsArchive.spec.ts b/apps/meteor/ee/server/cron/readReceiptsArchive.spec.ts index b42bf7a0d90e6..2a5546451827d 100644 --- a/apps/meteor/ee/server/cron/readReceiptsArchive.spec.ts +++ b/apps/meteor/ee/server/cron/readReceiptsArchive.spec.ts @@ -1,7 +1,7 @@ import { ReadReceipts, ReadReceiptsArchive, Messages } from '@rocket.chat/models'; import { archiveOldReadReceipts } from './readReceiptsArchive'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../../server/settings'; jest.mock('@rocket.chat/models', () => ({ ReadReceipts: { @@ -23,7 +23,7 @@ jest.mock('@rocket.chat/logger', () => ({ })), })); -jest.mock('../../../app/settings/server', () => ({ +jest.mock('../../../server/settings', () => ({ settings: { get: jest.fn(), watch: jest.fn(), diff --git a/apps/meteor/ee/server/cron/readReceiptsArchive.ts b/apps/meteor/ee/server/cron/readReceiptsArchive.ts index 90a55bfc42363..716b223ed2e90 100644 --- a/apps/meteor/ee/server/cron/readReceiptsArchive.ts +++ b/apps/meteor/ee/server/cron/readReceiptsArchive.ts @@ -2,8 +2,8 @@ import { cronJobs } from '@rocket.chat/cron'; import { Logger } from '@rocket.chat/logger'; import { ReadReceipts, ReadReceiptsArchive, Messages } from '@rocket.chat/models'; -import { settings } from '../../../app/settings/server'; import { sleep } from '../../../lib/utils/sleep'; +import { settings } from '../../../server/settings'; const logger = new Logger('ReadReceiptsArchive'); diff --git a/apps/meteor/ee/server/hooks/abac/beforeAddUserToRoom.ts b/apps/meteor/ee/server/hooks/abac/beforeAddUserToRoom.ts index 017023bcfa561..b4d2e346d5d5b 100644 --- a/apps/meteor/ee/server/hooks/abac/beforeAddUserToRoom.ts +++ b/apps/meteor/ee/server/hooks/abac/beforeAddUserToRoom.ts @@ -1,8 +1,8 @@ import { Abac } from '@rocket.chat/core-services'; import { License } from '@rocket.chat/license'; -import { settings } from '../../../../app/settings/server'; import { beforeAddUserToRoom } from '../../../../server/hooks/rooms/beforeAddUserToRoom'; +import { settings } from '../../../../server/settings'; beforeAddUserToRoom.patch(async (prev, users, room, actor) => { await prev(users, room, actor); diff --git a/apps/meteor/ee/server/hooks/abac/scopeAdminRoomsForAbac.ts b/apps/meteor/ee/server/hooks/abac/scopeAdminRoomsForAbac.ts index c59a209b2e331..4cc645432df0a 100644 --- a/apps/meteor/ee/server/hooks/abac/scopeAdminRoomsForAbac.ts +++ b/apps/meteor/ee/server/hooks/abac/scopeAdminRoomsForAbac.ts @@ -3,8 +3,8 @@ import type { IRoom, IRoomAbacRedaction } from '@rocket.chat/core-typings'; import { License } from '@rocket.chat/license'; import { Users } from '@rocket.chat/models'; -import { isABACManagedRoom } from '../../../../app/authorization/server/lib/isABACManagedRoom'; import { scopeAdminRoomsForAbac } from '../../../../server/api/lib/scopeAdminRoomsForAbac'; +import { isABACManagedRoom } from '../../../../server/lib/authorization/isABACManagedRoom'; const redact = >(rooms: T[]): Array => rooms.map((room) => (isABACManagedRoom(room) ? { ...room, abacAttributes: [], abacAttributesRedacted: true } : room)); diff --git a/apps/meteor/ee/server/hooks/canned-responses/cannedResponses.ts b/apps/meteor/ee/server/hooks/canned-responses/cannedResponses.ts index 95601020923c2..6dcdb56bee138 100644 --- a/apps/meteor/ee/server/hooks/canned-responses/cannedResponses.ts +++ b/apps/meteor/ee/server/hooks/canned-responses/cannedResponses.ts @@ -1,6 +1,6 @@ import { License } from '@rocket.chat/license'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../../server/settings'; import { BeforeSaveCannedResponse } from '../messages/BeforeSaveCannedResponse'; void License.onToggledFeature('canned-responses', { diff --git a/apps/meteor/ee/server/hooks/federation/index.ts b/apps/meteor/ee/server/hooks/federation/index.ts index e0c2683041262..259aeded43a2b 100644 --- a/apps/meteor/ee/server/hooks/federation/index.ts +++ b/apps/meteor/ee/server/hooks/federation/index.ts @@ -4,7 +4,6 @@ import type { IRoomNativeFederated, IMessage, IRoom, IUser } from '@rocket.chat/ import { validateFederatedUsername } from '@rocket.chat/federation-matrix'; import { Rooms, Subscriptions, Users } from '@rocket.chat/models'; -import { notifyOnRoomChangedById, notifyOnSubscriptionChanged } from '../../../../app/lib/server/lib/notifyListener'; import { callbacks } from '../../../../server/lib/callbacks'; import { afterBanFromRoomCallback } from '../../../../server/lib/callbacks/afterBanFromRoomCallback'; import { afterLeaveRoomCallback } from '../../../../server/lib/callbacks/afterLeaveRoomCallback'; @@ -13,6 +12,7 @@ import { afterUnbanFromRoomCallback } from '../../../../server/lib/callbacks/aft import { beforeAddUsersToRoom, beforeAddUserToRoom } from '../../../../server/lib/callbacks/beforeAddUserToRoom'; import { beforeChangeRoomRole } from '../../../../server/lib/callbacks/beforeChangeRoomRole'; import { prepareCreateRoomCallback } from '../../../../server/lib/callbacks/beforeCreateRoomCallback'; +import { notifyOnRoomChangedById, notifyOnSubscriptionChanged } from '../../../../server/lib/notifyListener'; import { FederationActions } from '../../../../server/services/room/hooks/BeforeFederationActions'; // callbacks.add('federation-event-example', async () => FederationMatrix.handleExample(), callbacks.priority.MEDIUM, 'federation-event-example-handler'); diff --git a/apps/meteor/ee/server/hooks/messages/afterReadMessages.ts b/apps/meteor/ee/server/hooks/messages/afterReadMessages.ts index b97a0ad5ad221..3272093e2839c 100644 --- a/apps/meteor/ee/server/hooks/messages/afterReadMessages.ts +++ b/apps/meteor/ee/server/hooks/messages/afterReadMessages.ts @@ -1,8 +1,8 @@ import { MessageReads } from '@rocket.chat/core-services'; import { type IUser, type IRoom, type IMessage } from '@rocket.chat/core-typings'; -import { settings } from '../../../../app/settings/server'; import { callbacks } from '../../../../server/lib/callbacks'; +import { settings } from '../../../../server/settings'; import { ReadReceipt } from '../../lib/message-read-receipt/ReadReceipt'; callbacks.add( diff --git a/apps/meteor/ee/server/hooks/omnichannel/addDepartmentAncestors.ts b/apps/meteor/ee/server/hooks/omnichannel/addDepartmentAncestors.ts index b0d93b2b3d2dd..e3d76614c45be 100644 --- a/apps/meteor/ee/server/hooks/omnichannel/addDepartmentAncestors.ts +++ b/apps/meteor/ee/server/hooks/omnichannel/addDepartmentAncestors.ts @@ -1,7 +1,7 @@ import type { ILivechatDepartment } from '@rocket.chat/core-typings'; import { LivechatRooms, LivechatDepartment } from '@rocket.chat/models'; -import { onNewRoom } from '../../../../app/livechat/server/lib/hooks'; +import { onNewRoom } from '../../../../server/lib/omnichannel/hooks'; onNewRoom.patch(async (originalFn, room) => { await originalFn(room); diff --git a/apps/meteor/ee/server/hooks/omnichannel/afterForwardChatToDepartment.ts b/apps/meteor/ee/server/hooks/omnichannel/afterForwardChatToDepartment.ts index a4b6413d3e772..c121189fe6594 100644 --- a/apps/meteor/ee/server/hooks/omnichannel/afterForwardChatToDepartment.ts +++ b/apps/meteor/ee/server/hooks/omnichannel/afterForwardChatToDepartment.ts @@ -2,7 +2,7 @@ import type { ILivechatDepartment, IOmnichannelRoom } from '@rocket.chat/core-ty import { LivechatRooms, LivechatDepartment } from '@rocket.chat/models'; import { callbacks } from '../../../../server/lib/callbacks'; -import { cbLogger } from '../../../app/livechat-enterprise/server/lib/logger'; +import { cbLogger } from '../../lib/omnichannel/logger'; callbacks.add( 'livechat.afterForwardChatToDepartment', diff --git a/apps/meteor/ee/server/hooks/omnichannel/afterInquiryQueued.ts b/apps/meteor/ee/server/hooks/omnichannel/afterInquiryQueued.ts index bf660edab61fd..bc1c23ef7f3e7 100644 --- a/apps/meteor/ee/server/hooks/omnichannel/afterInquiryQueued.ts +++ b/apps/meteor/ee/server/hooks/omnichannel/afterInquiryQueued.ts @@ -1,9 +1,9 @@ import type { ILivechatInquiryRecord } from '@rocket.chat/core-typings'; import moment from 'moment'; -import { afterInquiryQueued } from '../../../../app/livechat/server/lib/hooks'; -import { settings } from '../../../../app/settings/server'; -import { OmnichannelQueueInactivityMonitor } from '../../../app/livechat-enterprise/server/lib/QueueInactivityMonitor'; +import { afterInquiryQueued } from '../../../../server/lib/omnichannel/hooks'; +import { settings } from '../../../../server/settings'; +import { OmnichannelQueueInactivityMonitor } from '../../lib/omnichannel/QueueInactivityMonitor'; export const afterInquiryQueuedFunc = async (inquiry: ILivechatInquiryRecord) => { const timer = settings.get('Livechat_max_queue_wait_time'); diff --git a/apps/meteor/ee/server/hooks/omnichannel/afterOnHold.ts b/apps/meteor/ee/server/hooks/omnichannel/afterOnHold.ts index c808e3527355b..5992cf83a4e85 100644 --- a/apps/meteor/ee/server/hooks/omnichannel/afterOnHold.ts +++ b/apps/meteor/ee/server/hooks/omnichannel/afterOnHold.ts @@ -1,10 +1,10 @@ import type { IOmnichannelRoom } from '@rocket.chat/core-typings'; -import { settings } from '../../../../app/settings/server'; import { callbacks } from '../../../../server/lib/callbacks'; import { i18n } from '../../../../server/lib/i18n'; -import { AutoCloseOnHoldScheduler } from '../../../app/livechat-enterprise/server/lib/AutoCloseOnHoldScheduler'; -import { cbLogger } from '../../../app/livechat-enterprise/server/lib/logger'; +import { settings } from '../../../../server/settings'; +import { AutoCloseOnHoldScheduler } from '../../lib/omnichannel/AutoCloseOnHoldScheduler'; +import { cbLogger } from '../../lib/omnichannel/logger'; let autoCloseOnHoldChatTimeout = 0; diff --git a/apps/meteor/ee/server/hooks/omnichannel/afterOnHoldChatResumed.ts b/apps/meteor/ee/server/hooks/omnichannel/afterOnHoldChatResumed.ts index 1688ff91781ba..aaaa9e58db166 100644 --- a/apps/meteor/ee/server/hooks/omnichannel/afterOnHoldChatResumed.ts +++ b/apps/meteor/ee/server/hooks/omnichannel/afterOnHoldChatResumed.ts @@ -1,8 +1,8 @@ import type { IOmnichannelRoom } from '@rocket.chat/core-typings'; import { callbacks } from '../../../../server/lib/callbacks'; -import { AutoCloseOnHoldScheduler } from '../../../app/livechat-enterprise/server/lib/AutoCloseOnHoldScheduler'; -import { cbLogger } from '../../../app/livechat-enterprise/server/lib/logger'; +import { AutoCloseOnHoldScheduler } from '../../lib/omnichannel/AutoCloseOnHoldScheduler'; +import { cbLogger } from '../../lib/omnichannel/logger'; type IRoom = Pick; diff --git a/apps/meteor/ee/server/hooks/omnichannel/afterRemoveDepartment.ts b/apps/meteor/ee/server/hooks/omnichannel/afterRemoveDepartment.ts index d4841825653f5..63d300357f740 100644 --- a/apps/meteor/ee/server/hooks/omnichannel/afterRemoveDepartment.ts +++ b/apps/meteor/ee/server/hooks/omnichannel/afterRemoveDepartment.ts @@ -2,7 +2,7 @@ import type { AtLeast, ILivechatAgent, ILivechatDepartment } from '@rocket.chat/ import { LivechatDepartment, LivechatUnit } from '@rocket.chat/models'; import { callbacks } from '../../../../server/lib/callbacks'; -import { cbLogger } from '../../../app/livechat-enterprise/server/lib/logger'; +import { cbLogger } from '../../lib/omnichannel/logger'; const afterRemoveDepartment = async (options: { department: AtLeast; diff --git a/apps/meteor/ee/server/hooks/omnichannel/afterReturnRoomAsInquiry.ts b/apps/meteor/ee/server/hooks/omnichannel/afterReturnRoomAsInquiry.ts index 1514365de0039..fcde418496221 100644 --- a/apps/meteor/ee/server/hooks/omnichannel/afterReturnRoomAsInquiry.ts +++ b/apps/meteor/ee/server/hooks/omnichannel/afterReturnRoomAsInquiry.ts @@ -1,8 +1,8 @@ import type { IOmnichannelRoom } from '@rocket.chat/core-typings'; import { LivechatRooms } from '@rocket.chat/models'; -import { settings } from '../../../../app/settings/server'; import { callbacks } from '../../../../server/lib/callbacks'; +import { settings } from '../../../../server/settings'; settings.watch('Livechat_abandoned_rooms_action', (value) => { if (!value || value === 'none') { diff --git a/apps/meteor/ee/server/hooks/omnichannel/afterTakeInquiry.ts b/apps/meteor/ee/server/hooks/omnichannel/afterTakeInquiry.ts index 14a8bb2175380..b3391826f7729 100644 --- a/apps/meteor/ee/server/hooks/omnichannel/afterTakeInquiry.ts +++ b/apps/meteor/ee/server/hooks/omnichannel/afterTakeInquiry.ts @@ -1,13 +1,13 @@ import type { InquiryWithAgentInfo, IOmnichannelRoom } from '@rocket.chat/core-typings'; import { LivechatVisitors } from '@rocket.chat/models'; -import { RoutingManager } from '../../../../app/livechat/server/lib/RoutingManager'; -import { afterTakeInquiry } from '../../../../app/livechat/server/lib/hooks'; -import { settings } from '../../../../app/settings/server'; -import { AutoTransferChatScheduler } from '../../../app/livechat-enterprise/server/lib/AutoTransferChatScheduler'; -import { debouncedDispatchWaitingQueueStatus } from '../../../app/livechat-enterprise/server/lib/Helper'; -import { OmnichannelQueueInactivityMonitor } from '../../../app/livechat-enterprise/server/lib/QueueInactivityMonitor'; -import { cbLogger } from '../../../app/livechat-enterprise/server/lib/logger'; +import { RoutingManager } from '../../../../server/lib/omnichannel/RoutingManager'; +import { afterTakeInquiry } from '../../../../server/lib/omnichannel/hooks'; +import { settings } from '../../../../server/settings'; +import { AutoTransferChatScheduler } from '../../lib/omnichannel/AutoTransferChatScheduler'; +import { debouncedDispatchWaitingQueueStatus } from '../../lib/omnichannel/Helper'; +import { OmnichannelQueueInactivityMonitor } from '../../lib/omnichannel/QueueInactivityMonitor'; +import { cbLogger } from '../../lib/omnichannel/logger'; afterTakeInquiry.patch( async ( diff --git a/apps/meteor/ee/server/hooks/omnichannel/applyRoomRestrictions.ts b/apps/meteor/ee/server/hooks/omnichannel/applyRoomRestrictions.ts index 3f701f37c1af2..7ad34faf66bc7 100644 --- a/apps/meteor/ee/server/hooks/omnichannel/applyRoomRestrictions.ts +++ b/apps/meteor/ee/server/hooks/omnichannel/applyRoomRestrictions.ts @@ -2,7 +2,7 @@ import type { IOmnichannelRoom } from '@rocket.chat/core-typings'; import type { FilterOperators } from 'mongodb'; import { callbacks } from '../../../../server/lib/callbacks'; -import { restrictQuery } from '../../../app/livechat-enterprise/server/lib/restrictQuery'; +import { restrictQuery } from '../../lib/omnichannel/restrictQuery'; callbacks.add( 'livechat.applyRoomRestrictions', diff --git a/apps/meteor/ee/server/hooks/omnichannel/applySimultaneousChatsRestrictions.ts b/apps/meteor/ee/server/hooks/omnichannel/applySimultaneousChatsRestrictions.ts index 9f6ca9bbd14fc..9496cb10dbbc0 100644 --- a/apps/meteor/ee/server/hooks/omnichannel/applySimultaneousChatsRestrictions.ts +++ b/apps/meteor/ee/server/hooks/omnichannel/applySimultaneousChatsRestrictions.ts @@ -2,8 +2,8 @@ import type { ILivechatDepartment, AvailableAgentsAggregation } from '@rocket.ch import { LivechatDepartment } from '@rocket.chat/models'; import type { Filter } from 'mongodb'; -import { settings } from '../../../../app/settings/server'; import { callbacks } from '../../../../server/lib/callbacks'; +import { settings } from '../../../../server/settings'; export async function getChatLimitsQuery(departmentId?: string): Promise> { const limitFilter: Filter = []; diff --git a/apps/meteor/ee/server/hooks/omnichannel/beforeJoinRoom.ts b/apps/meteor/ee/server/hooks/omnichannel/beforeJoinRoom.ts index 300439849b7c6..3db850d786cb6 100644 --- a/apps/meteor/ee/server/hooks/omnichannel/beforeJoinRoom.ts +++ b/apps/meteor/ee/server/hooks/omnichannel/beforeJoinRoom.ts @@ -2,9 +2,9 @@ import { isOmnichannelRoom } from '@rocket.chat/core-typings'; import type { IUser, IRoom } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; -import { settings } from '../../../../app/settings/server'; import { callbacks } from '../../../../server/lib/callbacks'; -import { isAgentWithinChatLimits } from '../../../app/livechat-enterprise/server/lib/Helper'; +import { settings } from '../../../../server/settings'; +import { isAgentWithinChatLimits } from '../../lib/omnichannel/Helper'; callbacks.add( 'beforeJoinRoom', diff --git a/apps/meteor/ee/server/hooks/omnichannel/beforeNewRoom.ts b/apps/meteor/ee/server/hooks/omnichannel/beforeNewRoom.ts index cefa5b96fa93d..c50abe37186b2 100644 --- a/apps/meteor/ee/server/hooks/omnichannel/beforeNewRoom.ts +++ b/apps/meteor/ee/server/hooks/omnichannel/beforeNewRoom.ts @@ -2,8 +2,8 @@ import type { IOmnichannelRoomInfo, IOmnichannelRoomExtraData, IOmnichannelRoom import { OmnichannelServiceLevelAgreements } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { beforeNewRoom } from '../../../../app/livechat/server/lib/hooks'; import { isPlainObject } from '../../../../lib/utils/isPlainObject'; +import { beforeNewRoom } from '../../../../server/lib/omnichannel/hooks'; export const beforeNewRoomPatched = async ( _next: any, diff --git a/apps/meteor/ee/server/hooks/omnichannel/beforeRoutingChat.ts b/apps/meteor/ee/server/hooks/omnichannel/beforeRoutingChat.ts index 6c54f607c8250..18540497065ba 100644 --- a/apps/meteor/ee/server/hooks/omnichannel/beforeRoutingChat.ts +++ b/apps/meteor/ee/server/hooks/omnichannel/beforeRoutingChat.ts @@ -1,14 +1,14 @@ import type { ILivechatInquiryRecord, SelectedAgent, ILivechatDepartment } from '@rocket.chat/core-typings'; import { LivechatDepartment, LivechatInquiry, LivechatRooms } from '@rocket.chat/models'; -import { notifyOnLivechatInquiryChanged, notifyOnRoomChangedById } from '../../../../app/lib/server/lib/notifyListener'; -import { allowAgentSkipQueue } from '../../../../app/livechat/server/lib/Helper'; -import { saveQueueInquiry } from '../../../../app/livechat/server/lib/QueueManager'; -import { setDepartmentForGuest } from '../../../../app/livechat/server/lib/departmentsLib'; -import { beforeRouteChat } from '../../../../app/livechat/server/lib/hooks'; -import { online } from '../../../../app/livechat/server/lib/service-status'; -import { settings } from '../../../../app/settings/server'; -import { cbLogger } from '../../../app/livechat-enterprise/server/lib/logger'; +import { notifyOnLivechatInquiryChanged, notifyOnRoomChangedById } from '../../../../server/lib/notifyListener'; +import { allowAgentSkipQueue } from '../../../../server/lib/omnichannel/Helper'; +import { saveQueueInquiry } from '../../../../server/lib/omnichannel/QueueManager'; +import { setDepartmentForGuest } from '../../../../server/lib/omnichannel/departmentsLib'; +import { beforeRouteChat } from '../../../../server/lib/omnichannel/hooks'; +import { online } from '../../../../server/lib/omnichannel/service-status'; +import { settings } from '../../../../server/settings'; +import { cbLogger } from '../../lib/omnichannel/logger'; beforeRouteChat.patch( async ( diff --git a/apps/meteor/ee/server/hooks/omnichannel/checkAgentBeforeTakeInquiry.ts b/apps/meteor/ee/server/hooks/omnichannel/checkAgentBeforeTakeInquiry.ts index 539bcbd03132c..f94b9f14edd78 100644 --- a/apps/meteor/ee/server/hooks/omnichannel/checkAgentBeforeTakeInquiry.ts +++ b/apps/meteor/ee/server/hooks/omnichannel/checkAgentBeforeTakeInquiry.ts @@ -1,11 +1,11 @@ import { Users } from '@rocket.chat/models'; -import { allowAgentSkipQueue } from '../../../../app/livechat/server/lib/Helper'; -import { checkOnlineAgents } from '../../../../app/livechat/server/lib/service-status'; -import { settings } from '../../../../app/settings/server'; import { callbacks } from '../../../../server/lib/callbacks'; -import { isAgentWithinChatLimits } from '../../../app/livechat-enterprise/server/lib/Helper'; -import { cbLogger } from '../../../app/livechat-enterprise/server/lib/logger'; +import { allowAgentSkipQueue } from '../../../../server/lib/omnichannel/Helper'; +import { checkOnlineAgents } from '../../../../server/lib/omnichannel/service-status'; +import { settings } from '../../../../server/settings'; +import { isAgentWithinChatLimits } from '../../lib/omnichannel/Helper'; +import { cbLogger } from '../../lib/omnichannel/logger'; const validateMaxChats = async ({ agent, diff --git a/apps/meteor/ee/server/hooks/omnichannel/handleNextAgentPreferredEvents.ts b/apps/meteor/ee/server/hooks/omnichannel/handleNextAgentPreferredEvents.ts index fd934e5ea8d47..51fd313e080b4 100644 --- a/apps/meteor/ee/server/hooks/omnichannel/handleNextAgentPreferredEvents.ts +++ b/apps/meteor/ee/server/hooks/omnichannel/handleNextAgentPreferredEvents.ts @@ -1,12 +1,12 @@ import type { IUser, SelectedAgent } from '@rocket.chat/core-typings'; import { LivechatVisitors, LivechatContacts, LivechatInquiry, LivechatRooms, Users } from '@rocket.chat/models'; -import { notifyOnLivechatInquiryChanged } from '../../../../app/lib/server/lib/notifyListener'; -import { RoutingManager } from '../../../../app/livechat/server/lib/RoutingManager'; -import { migrateVisitorIfMissingContact } from '../../../../app/livechat/server/lib/contacts/migrateVisitorIfMissingContact'; -import { checkDefaultAgentOnNewRoom } from '../../../../app/livechat/server/lib/hooks'; -import { settings } from '../../../../app/settings/server'; import { callbacks } from '../../../../server/lib/callbacks'; +import { notifyOnLivechatInquiryChanged } from '../../../../server/lib/notifyListener'; +import { RoutingManager } from '../../../../server/lib/omnichannel/RoutingManager'; +import { migrateVisitorIfMissingContact } from '../../../../server/lib/omnichannel/contacts/migrateVisitorIfMissingContact'; +import { checkDefaultAgentOnNewRoom } from '../../../../server/lib/omnichannel/hooks'; +import { settings } from '../../../../server/settings'; const normalizeDefaultAgent = (agent?: Pick | null): SelectedAgent | undefined => { if (!agent) { diff --git a/apps/meteor/ee/server/hooks/omnichannel/onAgentAssignmentFailed.ts b/apps/meteor/ee/server/hooks/omnichannel/onAgentAssignmentFailed.ts index 64af8d2071f98..9a1b1af7a7d48 100644 --- a/apps/meteor/ee/server/hooks/omnichannel/onAgentAssignmentFailed.ts +++ b/apps/meteor/ee/server/hooks/omnichannel/onAgentAssignmentFailed.ts @@ -1,7 +1,7 @@ import type { IOmnichannelRoom } from '@rocket.chat/core-typings'; -import { settings } from '../../../../app/settings/server'; import { callbacks } from '../../../../server/lib/callbacks'; +import { settings } from '../../../../server/settings'; const handleOnAgentAssignmentFailed = async ( room: IOmnichannelRoom, diff --git a/apps/meteor/ee/server/hooks/omnichannel/onBusinessHourStart.ts b/apps/meteor/ee/server/hooks/omnichannel/onBusinessHourStart.ts index 88be598051080..e71c5c256abfd 100644 --- a/apps/meteor/ee/server/hooks/omnichannel/onBusinessHourStart.ts +++ b/apps/meteor/ee/server/hooks/omnichannel/onBusinessHourStart.ts @@ -1,8 +1,8 @@ import { LivechatBusinessHourBehaviors } from '@rocket.chat/core-typings'; -import { settings } from '../../../../app/settings/server'; import { callbacks } from '../../../../server/lib/callbacks'; -import { MultipleBusinessHoursBehavior } from '../../../app/livechat-enterprise/server/business-hour/Multiple'; +import { settings } from '../../../../server/settings'; +import { MultipleBusinessHoursBehavior } from '../../lib/omnichannel/business-hour/Multiple'; callbacks.add( 'on-business-hour-start', diff --git a/apps/meteor/ee/server/hooks/omnichannel/onCloseLivechat.ts b/apps/meteor/ee/server/hooks/omnichannel/onCloseLivechat.ts index b1466ef572cef..d288c4d595388 100644 --- a/apps/meteor/ee/server/hooks/omnichannel/onCloseLivechat.ts +++ b/apps/meteor/ee/server/hooks/omnichannel/onCloseLivechat.ts @@ -1,10 +1,10 @@ import type { IOmnichannelRoom } from '@rocket.chat/core-typings'; import { LivechatRooms } from '@rocket.chat/models'; -import { settings } from '../../../../app/settings/server'; import { callbacks } from '../../../../server/lib/callbacks'; -import { AutoCloseOnHoldScheduler } from '../../../app/livechat-enterprise/server/lib/AutoCloseOnHoldScheduler'; -import { debouncedDispatchWaitingQueueStatus } from '../../../app/livechat-enterprise/server/lib/Helper'; +import { settings } from '../../../../server/settings'; +import { AutoCloseOnHoldScheduler } from '../../lib/omnichannel/AutoCloseOnHoldScheduler'; +import { debouncedDispatchWaitingQueueStatus } from '../../lib/omnichannel/Helper'; type LivechatCloseCallbackParams = { room: IOmnichannelRoom; diff --git a/apps/meteor/ee/server/hooks/omnichannel/onLoadConfigApi.ts b/apps/meteor/ee/server/hooks/omnichannel/onLoadConfigApi.ts index 56fe5ff110168..113e54cf9a878 100644 --- a/apps/meteor/ee/server/hooks/omnichannel/onLoadConfigApi.ts +++ b/apps/meteor/ee/server/hooks/omnichannel/onLoadConfigApi.ts @@ -1,7 +1,7 @@ import type { IOmnichannelRoom } from '@rocket.chat/core-typings'; import { getExtraConfigInfo } from '../../../../server/api/v1/omnichannel/lib/livechat'; -import { getLivechatQueueInfo, getLivechatCustomFields } from '../../../app/livechat-enterprise/server/lib/Helper'; +import { getLivechatQueueInfo, getLivechatCustomFields } from '../../lib/omnichannel/Helper'; getExtraConfigInfo.patch( async ( diff --git a/apps/meteor/ee/server/hooks/omnichannel/onTransferFailure.ts b/apps/meteor/ee/server/hooks/omnichannel/onTransferFailure.ts index 1d6a546780ad5..958f2b89ba69c 100644 --- a/apps/meteor/ee/server/hooks/omnichannel/onTransferFailure.ts +++ b/apps/meteor/ee/server/hooks/omnichannel/onTransferFailure.ts @@ -2,10 +2,10 @@ import { isOmnichannelRoom } from '@rocket.chat/core-typings'; import type { IRoom, ILivechatVisitor, ILivechatDepartment, TransferData, AtLeast } from '@rocket.chat/core-typings'; import { LivechatDepartment } from '@rocket.chat/models'; -import { forwardRoomToDepartment } from '../../../../app/livechat/server/lib/Helper'; -import { settings } from '../../../../app/settings/server'; import { callbacks } from '../../../../server/lib/callbacks'; -import { cbLogger } from '../../../app/livechat-enterprise/server/lib/logger'; +import { forwardRoomToDepartment } from '../../../../server/lib/omnichannel/Helper'; +import { settings } from '../../../../server/settings'; +import { cbLogger } from '../../lib/omnichannel/logger'; const onTransferFailure = async ( room: IRoom, diff --git a/apps/meteor/ee/server/hooks/omnichannel/resumeOnHold.ts b/apps/meteor/ee/server/hooks/omnichannel/resumeOnHold.ts index 227051b139626..37024efdb9df0 100644 --- a/apps/meteor/ee/server/hooks/omnichannel/resumeOnHold.ts +++ b/apps/meteor/ee/server/hooks/omnichannel/resumeOnHold.ts @@ -3,9 +3,9 @@ import type { ILivechatVisitor, IMessage, IOmnichannelRoom, IUser } from '@rocke import { isMessageFromVisitor, isEditedMessage } from '@rocket.chat/core-typings'; import { LivechatRooms, LivechatVisitors, Users } from '@rocket.chat/models'; -import { callbackLogger } from '../../../../app/livechat/server/lib/logger'; import { callbacks } from '../../../../server/lib/callbacks'; import { i18n } from '../../../../server/lib/i18n'; +import { callbackLogger } from '../../../../server/lib/omnichannel/logger'; const resumeOnHoldCommentAndUser = async (room: IOmnichannelRoom): Promise<{ comment: string; resumedBy: IUser }> => { const { diff --git a/apps/meteor/ee/server/hooks/omnichannel/scheduleAutoTransfer.ts b/apps/meteor/ee/server/hooks/omnichannel/scheduleAutoTransfer.ts index 08f27130f62f4..088eb88c01ad6 100644 --- a/apps/meteor/ee/server/hooks/omnichannel/scheduleAutoTransfer.ts +++ b/apps/meteor/ee/server/hooks/omnichannel/scheduleAutoTransfer.ts @@ -1,9 +1,9 @@ import type { IMessage, IOmnichannelRoom } from '@rocket.chat/core-typings'; -import type { CloseRoomParams } from '../../../../app/livechat/server/lib/localTypes'; -import { settings } from '../../../../app/settings/server'; import { callbacks } from '../../../../server/lib/callbacks'; -import { AutoTransferChatScheduler } from '../../../app/livechat-enterprise/server/lib/AutoTransferChatScheduler'; +import type { CloseRoomParams } from '../../../../server/lib/omnichannel/localTypes'; +import { settings } from '../../../../server/settings'; +import { AutoTransferChatScheduler } from '../../lib/omnichannel/AutoTransferChatScheduler'; type LivechatCloseCallbackParams = { room: IOmnichannelRoom; diff --git a/apps/meteor/ee/server/hooks/omnichannel/sendPdfTranscriptOnClose.ts b/apps/meteor/ee/server/hooks/omnichannel/sendPdfTranscriptOnClose.ts index 67f5a1fa4c610..fd28f3c21cec8 100644 --- a/apps/meteor/ee/server/hooks/omnichannel/sendPdfTranscriptOnClose.ts +++ b/apps/meteor/ee/server/hooks/omnichannel/sendPdfTranscriptOnClose.ts @@ -1,9 +1,9 @@ import type { IOmnichannelRoom } from '@rocket.chat/core-typings'; import { isOmnichannelRoom } from '@rocket.chat/core-typings'; -import type { CloseRoomParams } from '../../../../app/livechat/server/lib/localTypes'; import { callbacks } from '../../../../server/lib/callbacks'; -import { requestPdfTranscript } from '../../../app/livechat-enterprise/server/lib/requestPdfTranscript'; +import type { CloseRoomParams } from '../../../../server/lib/omnichannel/localTypes'; +import { requestPdfTranscript } from '../../lib/omnichannel/requestPdfTranscript'; type LivechatCloseCallbackParams = { room: IOmnichannelRoom; diff --git a/apps/meteor/ee/server/hooks/omnichannel/setPredictedVisitorAbandonmentTime.ts b/apps/meteor/ee/server/hooks/omnichannel/setPredictedVisitorAbandonmentTime.ts index 82eff84bb042a..3b78907b0c090 100644 --- a/apps/meteor/ee/server/hooks/omnichannel/setPredictedVisitorAbandonmentTime.ts +++ b/apps/meteor/ee/server/hooks/omnichannel/setPredictedVisitorAbandonmentTime.ts @@ -2,10 +2,10 @@ import type { IMessage } from '@rocket.chat/core-typings'; import { isEditedMessage, isMessageFromVisitor } from '@rocket.chat/core-typings'; import moment from 'moment'; -import { settings } from '../../../../app/settings/server'; import { markRoomResponded } from '../../../../server/hooks/omnichannel/markRoomResponded'; import { callbacks } from '../../../../server/lib/callbacks'; -import { setPredictedVisitorAbandonmentTime } from '../../../app/livechat-enterprise/server/lib/Helper'; +import { settings } from '../../../../server/settings'; +import { setPredictedVisitorAbandonmentTime } from '../../lib/omnichannel/Helper'; function shouldSaveInactivity(message: IMessage): boolean { if (message.t || isEditedMessage(message) || isMessageFromVisitor(message)) { diff --git a/apps/meteor/ee/server/index.ts b/apps/meteor/ee/server/index.ts index db95640b08d83..1fa96430b1d3d 100644 --- a/apps/meteor/ee/server/index.ts +++ b/apps/meteor/ee/server/index.ts @@ -3,10 +3,10 @@ import './lib/license/settings'; import './meteor-methods/license'; import './api/v1/canned-responses'; import './lib/canned-responses'; -import '../app/livechat-enterprise/server/index'; +import './lib/omnichannel'; import './lib/message-read-receipt'; import './api'; -import '../app/settings/server/index'; +import './settings'; import './requestSeatsRoute'; import './configuration/index'; import './local-services/ldap/service'; diff --git a/apps/meteor/ee/app/authorization/lib/guestPermissions.ts b/apps/meteor/ee/server/lib/authorization/guestPermissions.ts similarity index 100% rename from apps/meteor/ee/app/authorization/lib/guestPermissions.ts rename to apps/meteor/ee/server/lib/authorization/guestPermissions.ts diff --git a/apps/meteor/ee/server/lib/authorization/resetEnterprisePermissions.ts b/apps/meteor/ee/server/lib/authorization/resetEnterprisePermissions.ts index 616dc5aab4fdd..df346e6fd6e15 100644 --- a/apps/meteor/ee/server/lib/authorization/resetEnterprisePermissions.ts +++ b/apps/meteor/ee/server/lib/authorization/resetEnterprisePermissions.ts @@ -1,6 +1,6 @@ import { Permissions } from '@rocket.chat/models'; -import { guestPermissions } from '../../../app/authorization/lib/guestPermissions'; +import { guestPermissions } from './guestPermissions'; export const resetEnterprisePermissions = async function (): Promise { await Permissions.updateMany( diff --git a/apps/meteor/ee/server/lib/canned-responses/settings.ts b/apps/meteor/ee/server/lib/canned-responses/settings.ts index 56eacee8c56c0..e5aa3c1959ecd 100644 --- a/apps/meteor/ee/server/lib/canned-responses/settings.ts +++ b/apps/meteor/ee/server/lib/canned-responses/settings.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../../../app/settings/server'; +import { settingsRegistry } from '../../../../server/settings'; const omnichannelEnabledQuery = { _id: 'Livechat_enabled', value: true }; diff --git a/apps/meteor/ee/server/lib/deviceManagement/session.ts b/apps/meteor/ee/server/lib/deviceManagement/session.ts index 564be1b8ef90e..0e6dbf29ea44b 100644 --- a/apps/meteor/ee/server/lib/deviceManagement/session.ts +++ b/apps/meteor/ee/server/lib/deviceManagement/session.ts @@ -5,12 +5,12 @@ import { Meteor } from 'meteor/meteor'; import moment from 'moment'; import { UAParser } from 'ua-parser-js'; -import { settings } from '../../../../app/settings/server'; import { t } from '../../../../app/utils/lib/i18n'; -import { getUserPreference } from '../../../../app/utils/server/lib/getUserPreference'; import * as Mailer from '../../../../server/lib/notifications/email/api'; import { UAParserDesktop, UAParserMobile } from '../../../../server/lib/statistics/lib/UAParserCustom'; +import { getUserPreference } from '../../../../server/lib/utils/lib/getUserPreference'; import { deviceManagementEvents } from '../../../../server/services/device-management/events'; +import { settings } from '../../../../server/settings'; let mailTemplates: string; diff --git a/apps/meteor/ee/server/lib/deviceManagement/startup.ts b/apps/meteor/ee/server/lib/deviceManagement/startup.ts index ee79d34da6517..f00bcb4f4275e 100644 --- a/apps/meteor/ee/server/lib/deviceManagement/startup.ts +++ b/apps/meteor/ee/server/lib/deviceManagement/startup.ts @@ -1,6 +1,6 @@ import { Permissions } from '@rocket.chat/models'; -import { settingsRegistry } from '../../../../app/settings/server/index'; +import { settingsRegistry } from '../../../../server/settings'; export const createPermissions = async (): Promise => { await Promise.all([ diff --git a/apps/meteor/ee/server/lib/ldap/Manager.spec.ts b/apps/meteor/ee/server/lib/ldap/Manager.spec.ts index 3ebff2f9858e7..dd40dab9cac25 100644 --- a/apps/meteor/ee/server/lib/ldap/Manager.spec.ts +++ b/apps/meteor/ee/server/lib/ldap/Manager.spec.ts @@ -15,8 +15,8 @@ const { LDAPEEManager } = proxyquire.noCallThru().load('./Manager', { '@rocket.chat/license': { License: { hasModule: () => false } }, '@rocket.chat/models': { Users: {}, Roles: {}, Subscriptions: subscriptionsStub, Rooms: roomsStub }, '../../../../server/lib/import/definitions/IConversionCallbacks': {}, - '../../../../app/settings/server': { settings: settingsStub }, - '../../../../app/utils/server/lib/getValidRoomName': { getValidRoomName: (name: string) => Promise.resolve(name) }, + '../../../../server/settings': { settings: settingsStub }, + '../../../../server/lib/utils/lib/getValidRoomName': { getValidRoomName: (name: string) => Promise.resolve(name) }, '../../../../lib/utils/arrayUtils': { ensureArray: (value: unknown) => (Array.isArray(value) ? value : [value]) }, '../../../../server/lib/ldap/Connection': { LDAPConnection: class {} }, '../../../../server/lib/ldap/Logger': { logger: loggerStub, searchLogger: loggerStub, mapLogger: loggerStub }, diff --git a/apps/meteor/ee/server/lib/ldap/Manager.ts b/apps/meteor/ee/server/lib/ldap/Manager.ts index 2dba4d7e41adf..650cfcb1d3baa 100644 --- a/apps/meteor/ee/server/lib/ldap/Manager.ts +++ b/apps/meteor/ee/server/lib/ldap/Manager.ts @@ -6,8 +6,6 @@ import type ldapjs from 'ldapjs'; import type { FindCursor } from 'mongodb'; import { copyCustomFieldsLDAP } from './copyCustomFieldsLDAP'; -import { settings } from '../../../../app/settings/server'; -import { getValidRoomName } from '../../../../app/utils/server/lib/getValidRoomName'; import { ensureArray } from '../../../../lib/utils/arrayUtils'; import type { ImporterAfterImportCallback, @@ -21,6 +19,8 @@ import { addUserToRoom } from '../../../../server/lib/rooms/addUserToRoom'; import { createRoom } from '../../../../server/lib/rooms/createRoom'; import { removeUserFromRoom } from '../../../../server/lib/rooms/removeUserFromRoom'; import { setUserActiveStatus } from '../../../../server/lib/users/setUserActiveStatus'; +import { getValidRoomName } from '../../../../server/lib/utils/lib/getValidRoomName'; +import { settings } from '../../../../server/settings'; import { syncUserRoles } from '../syncUserRoles'; export class LDAPEEManager extends LDAPManager { diff --git a/apps/meteor/ee/server/lib/ldap/copyCustomFieldsLDAP.ts b/apps/meteor/ee/server/lib/ldap/copyCustomFieldsLDAP.ts index d6a79e176934f..3ef9f4d2c1115 100644 --- a/apps/meteor/ee/server/lib/ldap/copyCustomFieldsLDAP.ts +++ b/apps/meteor/ee/server/lib/ldap/copyCustomFieldsLDAP.ts @@ -2,8 +2,8 @@ import type { IImportUser, ILDAPEntry } from '@rocket.chat/core-typings'; import type { Logger } from '@rocket.chat/logger'; import { replacesNestedValues } from './replacesNestedValues'; -import { templateVarHandler } from '../../../../app/utils/lib/templateVarHandler'; import { getNestedProp } from '../../../../server/lib/getNestedProp'; +import { templateVarHandler } from '../../../../server/lib/utils/lib/templateVarHandler'; export const copyCustomFieldsLDAP = ( { diff --git a/apps/meteor/ee/server/lib/license/airGappedRestrictions.ts b/apps/meteor/ee/server/lib/license/airGappedRestrictions.ts index 03bc38e46ef41..61911c6f36ac6 100644 --- a/apps/meteor/ee/server/lib/license/airGappedRestrictions.ts +++ b/apps/meteor/ee/server/lib/license/airGappedRestrictions.ts @@ -1,8 +1,8 @@ import { AirGappedRestriction, License } from '@rocket.chat/license'; import { Settings, Statistics } from '@rocket.chat/models'; -import { notifyOnSettingChangedById } from '../../../../app/lib/server/lib/notifyListener'; import { i18n } from '../../../../server/lib/i18n'; +import { notifyOnSettingChangedById } from '../../../../server/lib/notifyListener'; import { sendMessagesToAdmins } from '../../../../server/lib/sendMessagesToAdmins'; import { updateAuditedBySystem } from '../../../../server/settings/lib/auditedSettingUpdates'; diff --git a/apps/meteor/ee/server/lib/license/license.internalService.ts b/apps/meteor/ee/server/lib/license/license.internalService.ts index 6600353afee2d..3cd9086ada460 100644 --- a/apps/meteor/ee/server/lib/license/license.internalService.ts +++ b/apps/meteor/ee/server/lib/license/license.internalService.ts @@ -3,7 +3,7 @@ import { api, ServiceClassInternal } from '@rocket.chat/core-services'; import type { LicenseModule } from '@rocket.chat/core-typings'; import { License } from '@rocket.chat/license'; -import { guestPermissions } from '../../../app/authorization/lib/guestPermissions'; +import { guestPermissions } from '../authorization/guestPermissions'; import { resetEnterprisePermissions } from '../authorization/resetEnterprisePermissions'; export class LicenseService extends ServiceClassInternal implements ILicense { diff --git a/apps/meteor/ee/server/lib/license/settings.ts b/apps/meteor/ee/server/lib/license/settings.ts index 045c74e331e4c..5b3f02cc03078 100644 --- a/apps/meteor/ee/server/lib/license/settings.ts +++ b/apps/meteor/ee/server/lib/license/settings.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../../../app/settings/server'; +import { settingsRegistry } from '../../../../server/settings'; // The proper name for this group is Premium, but we can't change it because it's already in use and we will break the settings // TODO: Keep this until next major updates diff --git a/apps/meteor/ee/server/lib/license/startup.ts b/apps/meteor/ee/server/lib/license/startup.ts index 77b43953e5aad..4131d1752ee4a 100644 --- a/apps/meteor/ee/server/lib/license/startup.ts +++ b/apps/meteor/ee/server/lib/license/startup.ts @@ -6,10 +6,10 @@ import { wrapExceptions } from '@rocket.chat/tools'; import moment from 'moment'; import { getAppCount } from './lib/getAppCount'; -import { notifyOnSettingChangedById } from '../../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../../app/settings/server'; import { callbacks } from '../../../../server/lib/callbacks'; import { syncWorkspace } from '../../../../server/lib/cloud/syncWorkspace'; +import { notifyOnSettingChangedById } from '../../../../server/lib/notifyListener'; +import { settings } from '../../../../server/settings'; export const startLicense = async () => { settings.watch('Site_Url', (value) => { diff --git a/apps/meteor/ee/server/lib/message-read-receipt/ReadReceipt.ts b/apps/meteor/ee/server/lib/message-read-receipt/ReadReceipt.ts index 81bac33d3f189..23745f8773f0f 100644 --- a/apps/meteor/ee/server/lib/message-read-receipt/ReadReceipt.ts +++ b/apps/meteor/ee/server/lib/message-read-receipt/ReadReceipt.ts @@ -2,9 +2,9 @@ import { api } from '@rocket.chat/core-services'; import type { IMessage, IRoom, IUser, IReadReceipt, IReadReceiptWithUser } from '@rocket.chat/core-typings'; import { LivechatVisitors, ReadReceipts, ReadReceiptsArchive, Messages, Rooms, Subscriptions, Users } from '@rocket.chat/models'; -import { notifyOnRoomChangedById, notifyOnMessageChange } from '../../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../../app/settings/server'; import { SystemLogger } from '../../../../server/lib/logger/system'; +import { notifyOnRoomChangedById, notifyOnMessageChange } from '../../../../server/lib/notifyListener'; +import { settings } from '../../../../server/settings'; // debounced function by roomId, so multiple calls within 2 seconds to same roomId runs only once const list: Record = {}; diff --git a/apps/meteor/ee/server/lib/oauth/Manager.ts b/apps/meteor/ee/server/lib/oauth/Manager.ts index 37d34d415fc3f..230f9da3e6dda 100644 --- a/apps/meteor/ee/server/lib/oauth/Manager.ts +++ b/apps/meteor/ee/server/lib/oauth/Manager.ts @@ -2,9 +2,9 @@ import type { IUser } from '@rocket.chat/core-typings'; import { Logger } from '@rocket.chat/logger'; import { Roles, Rooms, Users } from '@rocket.chat/models'; -import { getValidRoomName } from '../../../../app/utils/server/lib/getValidRoomName'; import { addUserToRoom } from '../../../../server/lib/rooms/addUserToRoom'; import { createRoom } from '../../../../server/lib/rooms/createRoom'; +import { getValidRoomName } from '../../../../server/lib/utils/lib/getValidRoomName'; import { syncUserRoles } from '../syncUserRoles'; const logger = new Logger('OAuth'); diff --git a/apps/meteor/ee/app/livechat-enterprise/server/lib/AutoCloseOnHoldScheduler.ts b/apps/meteor/ee/server/lib/omnichannel/AutoCloseOnHoldScheduler.ts similarity index 97% rename from apps/meteor/ee/app/livechat-enterprise/server/lib/AutoCloseOnHoldScheduler.ts rename to apps/meteor/ee/server/lib/omnichannel/AutoCloseOnHoldScheduler.ts index 82a80e411120f..ccfbbfb8509df 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/lib/AutoCloseOnHoldScheduler.ts +++ b/apps/meteor/ee/server/lib/omnichannel/AutoCloseOnHoldScheduler.ts @@ -7,7 +7,7 @@ import { MongoInternals } from 'meteor/mongo'; import moment from 'moment'; import { schedulerLogger } from './logger'; -import { closeRoom } from '../../../../../app/livechat/server/lib/closeRoom'; +import { closeRoom } from '../../../../server/lib/omnichannel/closeRoom'; const SCHEDULER_NAME = 'omnichannel_auto_close_on_hold_scheduler'; diff --git a/apps/meteor/ee/app/livechat-enterprise/server/lib/AutoTransferChatScheduler.ts b/apps/meteor/ee/server/lib/omnichannel/AutoTransferChatScheduler.ts similarity index 93% rename from apps/meteor/ee/app/livechat-enterprise/server/lib/AutoTransferChatScheduler.ts rename to apps/meteor/ee/server/lib/omnichannel/AutoTransferChatScheduler.ts index c6c39c4512030..cde6280ecce5d 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/lib/AutoTransferChatScheduler.ts +++ b/apps/meteor/ee/server/lib/omnichannel/AutoTransferChatScheduler.ts @@ -6,10 +6,10 @@ import { Meteor } from 'meteor/meteor'; import { MongoInternals } from 'meteor/mongo'; import { schedulerLogger } from './logger'; -import { forwardRoomToAgent } from '../../../../../app/livechat/server/lib/Helper'; -import { RoutingManager } from '../../../../../app/livechat/server/lib/RoutingManager'; -import { returnRoomAsInquiry } from '../../../../../app/livechat/server/lib/rooms'; -import { settings } from '../../../../../app/settings/server'; +import { forwardRoomToAgent } from '../../../../server/lib/omnichannel/Helper'; +import { RoutingManager } from '../../../../server/lib/omnichannel/RoutingManager'; +import { returnRoomAsInquiry } from '../../../../server/lib/omnichannel/rooms'; +import { settings } from '../../../../server/settings'; const SCHEDULER_NAME = 'omnichannel_scheduler'; diff --git a/apps/meteor/ee/app/livechat-enterprise/server/lib/Department.ts b/apps/meteor/ee/server/lib/omnichannel/Department.ts similarity index 100% rename from apps/meteor/ee/app/livechat-enterprise/server/lib/Department.ts rename to apps/meteor/ee/server/lib/omnichannel/Department.ts diff --git a/apps/meteor/ee/app/livechat-enterprise/server/lib/Helper.ts b/apps/meteor/ee/server/lib/omnichannel/Helper.ts similarity index 97% rename from apps/meteor/ee/app/livechat-enterprise/server/lib/Helper.ts rename to apps/meteor/ee/server/lib/omnichannel/Helper.ts index d4a1bcc89f9b4..c65e405f74703 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/lib/Helper.ts +++ b/apps/meteor/ee/server/lib/omnichannel/Helper.ts @@ -21,10 +21,10 @@ import { OmnichannelQueueInactivityMonitor } from './QueueInactivityMonitor'; import { updateInquiryQueueSla } from './SlaHelper'; import { memoizeDebounce } from './debounceByParams'; import { logger } from './logger'; -import { getOmniChatSortQuery } from '../../../../../app/livechat/lib/inquiries'; -import { getInquirySortMechanismSetting } from '../../../../../app/livechat/server/lib/settings'; -import { settings } from '../../../../../app/settings/server'; -import { callbacks } from '../../../../../server/lib/callbacks'; +import { getOmniChatSortQuery } from '../../../../app/livechat/lib/inquiries'; +import { callbacks } from '../../../../server/lib/callbacks'; +import { getInquirySortMechanismSetting } from '../../../../server/lib/omnichannel/settings'; +import { settings } from '../../../../server/settings'; type QueueInfo = { message: { diff --git a/apps/meteor/ee/app/livechat-enterprise/server/lib/LivechatEnterprise.ts b/apps/meteor/ee/server/lib/omnichannel/LivechatEnterprise.ts similarity index 95% rename from apps/meteor/ee/app/livechat-enterprise/server/lib/LivechatEnterprise.ts rename to apps/meteor/ee/server/lib/omnichannel/LivechatEnterprise.ts index 57f29a4d87ede..4f34aa9e7cfe2 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/lib/LivechatEnterprise.ts +++ b/apps/meteor/ee/server/lib/omnichannel/LivechatEnterprise.ts @@ -7,9 +7,9 @@ import { Meteor } from 'meteor/meteor'; import { updateSLAInquiries } from './Helper'; import { removeSLAFromRooms } from './SlaHelper'; -import { callbacks } from '../../../../../server/lib/callbacks'; -import { addUserRolesAsync } from '../../../../../server/lib/roles/addUserRoles'; -import { removeUserFromRolesAsync } from '../../../../../server/lib/roles/removeUserFromRoles'; +import { callbacks } from '../../../../server/lib/callbacks'; +import { addUserRolesAsync } from '../../../../server/lib/roles/addUserRoles'; +import { removeUserFromRolesAsync } from '../../../../server/lib/roles/removeUserFromRoles'; export const LivechatEnterprise = { async addMonitor(username: string) { diff --git a/apps/meteor/ee/app/livechat-enterprise/server/lib/QueueInactivityMonitor.ts b/apps/meteor/ee/server/lib/omnichannel/QueueInactivityMonitor.ts similarity index 95% rename from apps/meteor/ee/app/livechat-enterprise/server/lib/QueueInactivityMonitor.ts rename to apps/meteor/ee/server/lib/omnichannel/QueueInactivityMonitor.ts index 5877f0ea8b01b..d8727e313c1c2 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/lib/QueueInactivityMonitor.ts +++ b/apps/meteor/ee/server/lib/omnichannel/QueueInactivityMonitor.ts @@ -7,9 +7,9 @@ import { MongoInternals } from 'meteor/mongo'; import type { Db } from 'mongodb'; import { schedulerLogger } from './logger'; -import { closeRoom } from '../../../../../app/livechat/server/lib/closeRoom'; -import { settings } from '../../../../../app/settings/server'; -import { i18n } from '../../../../../server/lib/i18n'; +import { i18n } from '../../../../server/lib/i18n'; +import { closeRoom } from '../../../../server/lib/omnichannel/closeRoom'; +import { settings } from '../../../../server/settings'; const SCHEDULER_NAME = 'omnichannel_queue_inactivity_monitor'; diff --git a/apps/meteor/ee/app/livechat-enterprise/server/lib/SlaHelper.ts b/apps/meteor/ee/server/lib/omnichannel/SlaHelper.ts similarity index 94% rename from apps/meteor/ee/app/livechat-enterprise/server/lib/SlaHelper.ts rename to apps/meteor/ee/server/lib/omnichannel/SlaHelper.ts index 9bcda4bbc33dd..0d07f99eb1e8a 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/lib/SlaHelper.ts +++ b/apps/meteor/ee/server/lib/omnichannel/SlaHelper.ts @@ -2,12 +2,12 @@ import { Message } from '@rocket.chat/core-services'; import type { IOmnichannelServiceLevelAgreements, IUser } from '@rocket.chat/core-typings'; import { LivechatInquiry, LivechatRooms } from '@rocket.chat/models'; +import { callbacks } from '../../../../server/lib/callbacks'; import { notifyOnRoomChangedById, notifyOnLivechatInquiryChangedByRoom, notifyOnLivechatInquiryChanged, -} from '../../../../../app/lib/server/lib/notifyListener'; -import { callbacks } from '../../../../../server/lib/callbacks'; +} from '../../../../server/lib/notifyListener'; export const removeSLAFromRooms = async (slaId: string, userId: string) => { const extraQuery = await callbacks.run('livechat.applyRoomRestrictions', {}, { userId }); diff --git a/apps/meteor/ee/app/livechat-enterprise/server/lib/VisitorInactivityMonitor.ts b/apps/meteor/ee/server/lib/omnichannel/VisitorInactivityMonitor.ts similarity index 93% rename from apps/meteor/ee/app/livechat-enterprise/server/lib/VisitorInactivityMonitor.ts rename to apps/meteor/ee/server/lib/omnichannel/VisitorInactivityMonitor.ts index ed81fa5f6f5d8..c152bdca6a53e 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/lib/VisitorInactivityMonitor.ts +++ b/apps/meteor/ee/server/lib/omnichannel/VisitorInactivityMonitor.ts @@ -5,11 +5,11 @@ import type { MainLogger } from '@rocket.chat/logger'; import { LivechatVisitors, LivechatRooms, LivechatDepartment, Users } from '@rocket.chat/models'; import { schedulerLogger } from './logger'; -import { notifyOnRoomChangedById } from '../../../../../app/lib/server/lib/notifyListener'; -import { closeRoom } from '../../../../../app/livechat/server/lib/closeRoom'; -import { settings } from '../../../../../app/settings/server'; -import { callbacks } from '../../../../../server/lib/callbacks'; -import { i18n } from '../../../../../server/lib/i18n'; +import { callbacks } from '../../../../server/lib/callbacks'; +import { i18n } from '../../../../server/lib/i18n'; +import { notifyOnRoomChangedById } from '../../../../server/lib/notifyListener'; +import { closeRoom } from '../../../../server/lib/omnichannel/closeRoom'; +import { settings } from '../../../../server/settings'; const isPromiseRejectedResult = (result: any): result is PromiseRejectedResult => result && result.status === 'rejected'; diff --git a/apps/meteor/ee/app/livechat-enterprise/server/business-hour/Custom.ts b/apps/meteor/ee/server/lib/omnichannel/business-hour/Custom.ts similarity index 94% rename from apps/meteor/ee/app/livechat-enterprise/server/business-hour/Custom.ts rename to apps/meteor/ee/server/lib/omnichannel/business-hour/Custom.ts index 4e298971fc249..bbd36c294c7ff 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/business-hour/Custom.ts +++ b/apps/meteor/ee/server/lib/omnichannel/business-hour/Custom.ts @@ -2,14 +2,14 @@ import type { ILivechatBusinessHour } from '@rocket.chat/core-typings'; import { LivechatBusinessHourTypes } from '@rocket.chat/core-typings'; import { LivechatDepartment, LivechatDepartmentAgents, Users } from '@rocket.chat/models'; -import { businessHourManager } from '../../../../../app/livechat/server/business-hour'; -import type { IBusinessHourType } from '../../../../../app/livechat/server/business-hour/AbstractBusinessHour'; -import { AbstractBusinessHourType } from '../../../../../app/livechat/server/business-hour/AbstractBusinessHour'; +import { businessHourManager } from '../../../../../server/lib/omnichannel/business-hour'; +import type { IBusinessHourType } from '../../../../../server/lib/omnichannel/business-hour/AbstractBusinessHour'; +import { AbstractBusinessHourType } from '../../../../../server/lib/omnichannel/business-hour/AbstractBusinessHour'; import { filterBusinessHoursThatMustBeOpened, makeAgentsUnavailableBasedOnBusinessHour, -} from '../../../../../app/livechat/server/business-hour/Helper'; -import { bhLogger } from '../lib/logger'; +} from '../../../../../server/lib/omnichannel/business-hour/Helper'; +import { bhLogger } from '../logger'; type IBusinessHoursExtraProperties = { timezoneName: string; diff --git a/apps/meteor/ee/app/livechat-enterprise/server/business-hour/Helper.ts b/apps/meteor/ee/server/lib/omnichannel/business-hour/Helper.ts similarity index 86% rename from apps/meteor/ee/app/livechat-enterprise/server/business-hour/Helper.ts rename to apps/meteor/ee/server/lib/omnichannel/business-hour/Helper.ts index 71cd69b448bb1..741c5856b228b 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/business-hour/Helper.ts +++ b/apps/meteor/ee/server/lib/omnichannel/business-hour/Helper.ts @@ -5,9 +5,9 @@ import { LivechatDepartment, LivechatDepartmentAgents, Users } from '@rocket.cha import { makeAgentsUnavailableBasedOnBusinessHour, makeOnlineAgentsAvailable, -} from '../../../../../app/livechat/server/business-hour/Helper'; -import { getAgentIdsForBusinessHour } from '../../../../../app/livechat/server/business-hour/getAgentIdsForBusinessHour'; -import { businessHourLogger } from '../../../../../app/livechat/server/lib/logger'; +} from '../../../../../server/lib/omnichannel/business-hour/Helper'; +import { getAgentIdsForBusinessHour } from '../../../../../server/lib/omnichannel/business-hour/getAgentIdsForBusinessHour'; +import { businessHourLogger } from '../../../../../server/lib/omnichannel/logger'; export const getAgentIdsToHandle = async (businessHour: Pick): Promise => { if (businessHour.type === LivechatBusinessHourTypes.DEFAULT) { diff --git a/apps/meteor/ee/app/livechat-enterprise/server/business-hour/Multiple.ts b/apps/meteor/ee/server/lib/omnichannel/business-hour/Multiple.ts similarity index 95% rename from apps/meteor/ee/app/livechat-enterprise/server/business-hour/Multiple.ts rename to apps/meteor/ee/server/lib/omnichannel/business-hour/Multiple.ts index 85301ce0ac1df..f71f371c75dd8 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/business-hour/Multiple.ts +++ b/apps/meteor/ee/server/lib/omnichannel/business-hour/Multiple.ts @@ -5,18 +5,18 @@ import { isTruthy } from '@rocket.chat/tools'; import moment from 'moment'; import { openBusinessHour, removeBusinessHourByAgentIds } from './Helper'; -import { businessHourManager } from '../../../../../app/livechat/server/business-hour'; -import type { IBusinessHourBehavior } from '../../../../../app/livechat/server/business-hour/AbstractBusinessHour'; -import { AbstractBusinessHourBehavior } from '../../../../../app/livechat/server/business-hour/AbstractBusinessHour'; +import { businessHourManager } from '../../../../../server/lib/omnichannel/business-hour'; +import type { IBusinessHourBehavior } from '../../../../../server/lib/omnichannel/business-hour/AbstractBusinessHour'; +import { AbstractBusinessHourBehavior } from '../../../../../server/lib/omnichannel/business-hour/AbstractBusinessHour'; import { filterBusinessHoursThatMustBeOpened, filterBusinessHoursThatMustBeOpenedByDay, makeOnlineAgentsAvailable, makeAgentsUnavailableBasedOnBusinessHour, -} from '../../../../../app/livechat/server/business-hour/Helper'; -import { closeBusinessHour } from '../../../../../app/livechat/server/business-hour/closeBusinessHour'; -import { settings } from '../../../../../app/settings/server'; -import { bhLogger } from '../lib/logger'; +} from '../../../../../server/lib/omnichannel/business-hour/Helper'; +import { closeBusinessHour } from '../../../../../server/lib/omnichannel/business-hour/closeBusinessHour'; +import { settings } from '../../../../../server/settings'; +import { bhLogger } from '../logger'; export class MultipleBusinessHoursBehavior extends AbstractBusinessHourBehavior implements IBusinessHourBehavior { constructor() { diff --git a/apps/meteor/ee/app/livechat-enterprise/server/business-hour/index.ts b/apps/meteor/ee/server/lib/omnichannel/business-hour/index.ts similarity index 100% rename from apps/meteor/ee/app/livechat-enterprise/server/business-hour/index.ts rename to apps/meteor/ee/server/lib/omnichannel/business-hour/index.ts diff --git a/apps/meteor/ee/app/livechat-enterprise/server/business-hour/lib/business-hour.ts b/apps/meteor/ee/server/lib/omnichannel/business-hour/lib/business-hour.ts similarity index 97% rename from apps/meteor/ee/app/livechat-enterprise/server/business-hour/lib/business-hour.ts rename to apps/meteor/ee/server/lib/omnichannel/business-hour/lib/business-hour.ts index e84a497adcbd2..d04b10a409bec 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/business-hour/lib/business-hour.ts +++ b/apps/meteor/ee/server/lib/omnichannel/business-hour/lib/business-hour.ts @@ -3,7 +3,7 @@ import { LivechatBusinessHours, LivechatDepartment } from '@rocket.chat/models'; import { escapeRegExp } from '@rocket.chat/string-helpers'; import { hasPermissionAsync } from '../../../../../../server/lib/authorization/hasPermission'; -import type { IPaginatedResponse, IPagination } from '../../../../../server/api/v1/omnichannel/lib/definition'; +import type { IPaginatedResponse, IPagination } from '../../../../api/v1/omnichannel/lib/definition'; interface IResponse extends IPaginatedResponse { businessHours: ILivechatBusinessHour[]; diff --git a/apps/meteor/ee/app/livechat-enterprise/server/lib/debounceByParams.ts b/apps/meteor/ee/server/lib/omnichannel/debounceByParams.ts similarity index 100% rename from apps/meteor/ee/app/livechat-enterprise/server/lib/debounceByParams.ts rename to apps/meteor/ee/server/lib/omnichannel/debounceByParams.ts diff --git a/apps/meteor/ee/server/lib/omnichannel/index.ts b/apps/meteor/ee/server/lib/omnichannel/index.ts new file mode 100644 index 0000000000000..af31dfc3607df --- /dev/null +++ b/apps/meteor/ee/server/lib/omnichannel/index.ts @@ -0,0 +1,39 @@ +import { License } from '@rocket.chat/license'; +import { patchOmniCore } from '@rocket.chat/omni-core-ee'; +import { Meteor } from 'meteor/meteor'; + +import '../../hooks/omnichannel/afterTakeInquiry'; +import '../../hooks/omnichannel/beforeNewInquiry'; +import '../../hooks/omnichannel/beforeNewRoom'; +import '../../hooks/omnichannel/beforeRoutingChat'; +import '../../hooks/omnichannel/checkAgentBeforeTakeInquiry'; +import '../../hooks/omnichannel/handleNextAgentPreferredEvents'; +import '../../hooks/omnichannel/onCheckRoomParamsApi'; +import '../../hooks/omnichannel/onLoadConfigApi'; +import '../../hooks/omnichannel/onSaveVisitorInfo'; +import '../../hooks/omnichannel/scheduleAutoTransfer'; +import '../../hooks/omnichannel/resumeOnHold'; +import '../../hooks/omnichannel/afterOnHold'; +import '../../hooks/omnichannel/onTransferFailure'; +import './routing/LoadBalancing'; +import './routing/LoadRotation'; +import './AutoCloseOnHoldScheduler'; +import './business-hour'; +import '../../api/v1/omnichannel'; +import { createDefaultPriorities } from './priorities'; + +patchOmniCore(); + +await License.onLicense('livechat-enterprise', async () => { + require('../../hooks/omnichannel'); + await import('./startup'); + const { createPermissions } = await import('./permissions'); + const { createSettings } = await import('./settings'); + await import('./unit'); + + Meteor.startup(() => { + void createSettings(); + void createPermissions(); + void createDefaultPriorities(); + }); +}); diff --git a/apps/meteor/ee/app/livechat-enterprise/server/lib/logger.ts b/apps/meteor/ee/server/lib/omnichannel/logger.ts similarity index 100% rename from apps/meteor/ee/app/livechat-enterprise/server/lib/logger.ts rename to apps/meteor/ee/server/lib/omnichannel/logger.ts diff --git a/apps/meteor/ee/app/livechat-enterprise/server/outboundcomms/rest.ts b/apps/meteor/ee/server/lib/omnichannel/outboundcomms/rest.ts similarity index 98% rename from apps/meteor/ee/app/livechat-enterprise/server/outboundcomms/rest.ts rename to apps/meteor/ee/server/lib/omnichannel/outboundcomms/rest.ts index c6639f30015dc..bbb4b90004b46 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/outboundcomms/rest.ts +++ b/apps/meteor/ee/server/lib/omnichannel/outboundcomms/rest.ts @@ -1,7 +1,7 @@ import type { IOutboundMessage, IOutboundProvider, IOutboundProviderMetadata, ValidOutboundProvider } from '@rocket.chat/core-typings'; import { ajv } from '@rocket.chat/rest-typings'; -import type { OutboundCommsEndpoints } from '../../../../server/api/v1/omnichannel/outbound'; +import type { OutboundCommsEndpoints } from '../../../api/v1/omnichannel/outbound'; declare module '@rocket.chat/rest-typings' { // eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-empty-interface diff --git a/apps/meteor/ee/app/livechat-enterprise/server/permissions.ts b/apps/meteor/ee/server/lib/omnichannel/permissions.ts similarity index 100% rename from apps/meteor/ee/app/livechat-enterprise/server/permissions.ts rename to apps/meteor/ee/server/lib/omnichannel/permissions.ts diff --git a/apps/meteor/ee/app/livechat-enterprise/server/priorities.ts b/apps/meteor/ee/server/lib/omnichannel/priorities.ts similarity index 100% rename from apps/meteor/ee/app/livechat-enterprise/server/priorities.ts rename to apps/meteor/ee/server/lib/omnichannel/priorities.ts diff --git a/apps/meteor/ee/app/livechat-enterprise/server/lib/requestPdfTranscript.ts b/apps/meteor/ee/server/lib/omnichannel/requestPdfTranscript.ts similarity index 100% rename from apps/meteor/ee/app/livechat-enterprise/server/lib/requestPdfTranscript.ts rename to apps/meteor/ee/server/lib/omnichannel/requestPdfTranscript.ts diff --git a/apps/meteor/ee/app/livechat-enterprise/server/lib/restrictQuery.ts b/apps/meteor/ee/server/lib/omnichannel/restrictQuery.ts similarity index 100% rename from apps/meteor/ee/app/livechat-enterprise/server/lib/restrictQuery.ts rename to apps/meteor/ee/server/lib/omnichannel/restrictQuery.ts diff --git a/apps/meteor/ee/app/livechat-enterprise/server/lib/routing/LoadBalancing.ts b/apps/meteor/ee/server/lib/omnichannel/routing/LoadBalancing.ts similarity index 80% rename from apps/meteor/ee/app/livechat-enterprise/server/lib/routing/LoadBalancing.ts rename to apps/meteor/ee/server/lib/omnichannel/routing/LoadBalancing.ts index 9d1fd9fcfda91..adc4fd3f58338 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/lib/routing/LoadBalancing.ts +++ b/apps/meteor/ee/server/lib/omnichannel/routing/LoadBalancing.ts @@ -1,9 +1,9 @@ import { Users } from '@rocket.chat/models'; -import { RoutingManager } from '../../../../../../app/livechat/server/lib/RoutingManager'; -import { settings } from '../../../../../../app/settings/server'; -import type { IRoutingManagerConfig } from '../../../../../../definition/IRoutingManagerConfig'; -import { getChatLimitsQuery } from '../../../../../server/hooks/omnichannel/applySimultaneousChatsRestrictions'; +import type { IRoutingManagerConfig } from '../../../../../definition/IRoutingManagerConfig'; +import { RoutingManager } from '../../../../../server/lib/omnichannel/RoutingManager'; +import { settings } from '../../../../../server/settings'; +import { getChatLimitsQuery } from '../../../hooks/omnichannel/applySimultaneousChatsRestrictions'; import { logger } from '../logger'; /* Load Balancing Queuing method: diff --git a/apps/meteor/ee/app/livechat-enterprise/server/lib/routing/LoadRotation.ts b/apps/meteor/ee/server/lib/omnichannel/routing/LoadRotation.ts similarity index 81% rename from apps/meteor/ee/app/livechat-enterprise/server/lib/routing/LoadRotation.ts rename to apps/meteor/ee/server/lib/omnichannel/routing/LoadRotation.ts index a46e58ed24c8c..f31f3646ee235 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/lib/routing/LoadRotation.ts +++ b/apps/meteor/ee/server/lib/omnichannel/routing/LoadRotation.ts @@ -1,10 +1,10 @@ import type { IOmnichannelCustomAgent } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; -import { RoutingManager } from '../../../../../../app/livechat/server/lib/RoutingManager'; -import { settings } from '../../../../../../app/settings/server'; -import type { IRoutingManagerConfig } from '../../../../../../definition/IRoutingManagerConfig'; -import { getChatLimitsQuery } from '../../../../../server/hooks/omnichannel/applySimultaneousChatsRestrictions'; +import type { IRoutingManagerConfig } from '../../../../../definition/IRoutingManagerConfig'; +import { RoutingManager } from '../../../../../server/lib/omnichannel/RoutingManager'; +import { settings } from '../../../../../server/settings'; +import { getChatLimitsQuery } from '../../../hooks/omnichannel/applySimultaneousChatsRestrictions'; import { logger } from '../logger'; /* Load Rotation Queuing method: diff --git a/apps/meteor/ee/app/livechat-enterprise/server/settings.ts b/apps/meteor/ee/server/lib/omnichannel/settings.ts similarity index 99% rename from apps/meteor/ee/app/livechat-enterprise/server/settings.ts rename to apps/meteor/ee/server/lib/omnichannel/settings.ts index 935f73cc34bf9..dd32db7ba369d 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/settings.ts +++ b/apps/meteor/ee/server/lib/omnichannel/settings.ts @@ -1,7 +1,7 @@ import { OmnichannelSortingMechanismSettingType } from '@rocket.chat/core-typings'; import { Settings } from '@rocket.chat/models'; -import { settingsRegistry } from '../../../../app/settings/server'; +import { settingsRegistry } from '../../../../server/settings'; const omnichannelEnabledQuery = { _id: 'Livechat_enabled', value: true }; const businessHoursEnabled = { _id: 'Livechat_enable_business_hours', value: true }; diff --git a/apps/meteor/ee/app/livechat-enterprise/server/startup.ts b/apps/meteor/ee/server/lib/omnichannel/startup.ts similarity index 78% rename from apps/meteor/ee/app/livechat-enterprise/server/startup.ts rename to apps/meteor/ee/server/lib/omnichannel/startup.ts index a6caaec6ff849..01e37127ad993 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/startup.ts +++ b/apps/meteor/ee/server/lib/omnichannel/startup.ts @@ -1,12 +1,12 @@ import { Meteor } from 'meteor/meteor'; +import { updatePredictedVisitorAbandonment, updateQueueInactivityTimeout } from './Helper'; +import { VisitorInactivityMonitor } from './VisitorInactivityMonitor'; import { MultipleBusinessHoursBehavior } from './business-hour/Multiple'; -import { updatePredictedVisitorAbandonment, updateQueueInactivityTimeout } from './lib/Helper'; -import { VisitorInactivityMonitor } from './lib/VisitorInactivityMonitor'; -import { logger } from './lib/logger'; -import { businessHourManager } from '../../../../app/livechat/server/business-hour'; -import { SingleBusinessHourBehavior } from '../../../../app/livechat/server/business-hour/Single'; -import { settings } from '../../../../app/settings/server'; +import { logger } from './logger'; +import { businessHourManager } from '../../../../server/lib/omnichannel/business-hour'; +import { SingleBusinessHourBehavior } from '../../../../server/lib/omnichannel/business-hour/Single'; +import { settings } from '../../../../server/settings'; const visitorActivityMonitor = new VisitorInactivityMonitor(); const businessHours = { diff --git a/apps/meteor/ee/app/livechat-enterprise/server/lib/unit.ts b/apps/meteor/ee/server/lib/omnichannel/unit.ts similarity index 75% rename from apps/meteor/ee/app/livechat-enterprise/server/lib/unit.ts rename to apps/meteor/ee/server/lib/omnichannel/unit.ts index ccd4394139277..459a387e968c3 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/lib/unit.ts +++ b/apps/meteor/ee/server/lib/omnichannel/unit.ts @@ -2,8 +2,8 @@ import { LivechatUnit } from '@rocket.chat/models'; import { getUnitsFromUser } from '@rocket.chat/omni-core-ee'; import { Meteor } from 'meteor/meteor'; -import type { CheckUnitsFromUser } from '../../../../../server/api/v1/omnichannel/lib/livechat'; -import { checkUnitsFromUser } from '../../../../../server/api/v1/omnichannel/lib/livechat'; +import type { CheckUnitsFromUser } from '../../../../server/api/v1/omnichannel/lib/livechat'; +import { checkUnitsFromUser } from '../../../../server/api/v1/omnichannel/lib/livechat'; checkUnitsFromUser.patch(async (_next, { businessUnit, userId }: CheckUnitsFromUser) => { if (!businessUnit) { diff --git a/apps/meteor/ee/server/lib/roles/insertRole.ts b/apps/meteor/ee/server/lib/roles/insertRole.ts index d9151fee7b876..1f6f7ac360db8 100644 --- a/apps/meteor/ee/server/lib/roles/insertRole.ts +++ b/apps/meteor/ee/server/lib/roles/insertRole.ts @@ -2,8 +2,8 @@ import { api, MeteorError } from '@rocket.chat/core-services'; import type { IRole } from '@rocket.chat/core-typings'; import { Roles } from '@rocket.chat/models'; -import { notifyOnRoleChanged } from '../../../../app/lib/server/lib/notifyListener'; import { isValidRoleScope } from '../../../../lib/roles/isValidRoleScope'; +import { notifyOnRoleChanged } from '../../../../server/lib/notifyListener'; type InsertRoleOptions = { broadcastUpdate?: boolean; diff --git a/apps/meteor/ee/server/lib/roles/updateRole.ts b/apps/meteor/ee/server/lib/roles/updateRole.ts index 7f1cf926c22db..5ecc17465ea93 100644 --- a/apps/meteor/ee/server/lib/roles/updateRole.ts +++ b/apps/meteor/ee/server/lib/roles/updateRole.ts @@ -2,8 +2,8 @@ import { api, MeteorError } from '@rocket.chat/core-services'; import type { IRole } from '@rocket.chat/core-typings'; import { Roles } from '@rocket.chat/models'; -import { notifyOnRoleChangedById } from '../../../../app/lib/server/lib/notifyListener'; import { isValidRoleScope } from '../../../../lib/roles/isValidRoleScope'; +import { notifyOnRoleChangedById } from '../../../../server/lib/notifyListener'; type UpdateRoleOptions = { broadcastUpdate?: boolean; diff --git a/apps/meteor/ee/server/lib/syncUserRoles.ts b/apps/meteor/ee/server/lib/syncUserRoles.ts index f3a380a8f2280..9c11431b3b356 100644 --- a/apps/meteor/ee/server/lib/syncUserRoles.ts +++ b/apps/meteor/ee/server/lib/syncUserRoles.ts @@ -3,9 +3,9 @@ import type { IUser, IRole, AtLeast } from '@rocket.chat/core-typings'; import { License } from '@rocket.chat/license'; import { Users } from '@rocket.chat/models'; -import { settings } from '../../../app/settings/server'; import { addUserRolesAsync } from '../../../server/lib/roles/addUserRoles'; import { removeUserFromRolesAsync } from '../../../server/lib/roles/removeUserFromRoles'; +import { settings } from '../../../server/settings'; type setUserRolesOptions = { // If specified, the function will not add nor remove any role that is not on this list. diff --git a/apps/meteor/ee/app/livechat-enterprise/server/services/omnichannel.internalService.ts b/apps/meteor/ee/server/local-services/omnichannel.internalService.ts similarity index 93% rename from apps/meteor/ee/app/livechat-enterprise/server/services/omnichannel.internalService.ts rename to apps/meteor/ee/server/local-services/omnichannel.internalService.ts index b4ff69668f38a..3aa76171923b8 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/services/omnichannel.internalService.ts +++ b/apps/meteor/ee/server/local-services/omnichannel.internalService.ts @@ -5,16 +5,16 @@ import type { IOmnichannelRoom, IUser, ILivechatInquiryRecord, IOmnichannelSyste import { Logger } from '@rocket.chat/logger'; import { LivechatRooms, Subscriptions, LivechatInquiry } from '@rocket.chat/models'; +import { callbacks } from '../../../server/lib/callbacks'; import { notifyOnSubscriptionChangedByRoomId, notifyOnLivechatInquiryChangedById, notifyOnRoomChangedById, -} from '../../../../../app/lib/server/lib/notifyListener'; -import { dispatchAgentDelegated } from '../../../../../app/livechat/server/lib/Helper'; -import { queueInquiry } from '../../../../../app/livechat/server/lib/QueueManager'; -import { RoutingManager } from '../../../../../app/livechat/server/lib/RoutingManager'; -import { settings } from '../../../../../app/settings/server'; -import { callbacks } from '../../../../../server/lib/callbacks'; +} from '../../../server/lib/notifyListener'; +import { dispatchAgentDelegated } from '../../../server/lib/omnichannel/Helper'; +import { queueInquiry } from '../../../server/lib/omnichannel/QueueManager'; +import { RoutingManager } from '../../../server/lib/omnichannel/RoutingManager'; +import { settings } from '../../../server/settings'; export class OmnichannelEE extends ServiceClassInternal implements IOmnichannelEEService { protected name = 'omnichannel-ee'; diff --git a/apps/meteor/ee/server/meteor-methods/license.ts b/apps/meteor/ee/server/meteor-methods/license.ts index 08e3996098ce4..c3b511759ea87 100644 --- a/apps/meteor/ee/server/meteor-methods/license.ts +++ b/apps/meteor/ee/server/meteor-methods/license.ts @@ -4,7 +4,7 @@ import { License } from '@rocket.chat/license'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; +import { methodDeprecationLogger } from '../../../server/lib/deprecationWarningLogger'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/ee/server/patches/closeBusinessHour.ts b/apps/meteor/ee/server/patches/closeBusinessHour.ts index 7163f66ee34b0..c90bdbdf60f58 100644 --- a/apps/meteor/ee/server/patches/closeBusinessHour.ts +++ b/apps/meteor/ee/server/patches/closeBusinessHour.ts @@ -1,5 +1,5 @@ -import { closeBusinessHour, closeBusinessHourByAgentIds } from '../../../app/livechat/server/business-hour/closeBusinessHour'; -import { getAgentIdsToHandle } from '../../app/livechat-enterprise/server/business-hour/Helper'; +import { closeBusinessHour, closeBusinessHourByAgentIds } from '../../../server/lib/omnichannel/business-hour/closeBusinessHour'; +import { getAgentIdsToHandle } from '../lib/omnichannel/business-hour/Helper'; closeBusinessHour.patch(async (_next, businessHour) => { const agentIds = await getAgentIdsToHandle(businessHour); diff --git a/apps/meteor/ee/server/patches/fetchContactHistory.ts b/apps/meteor/ee/server/patches/fetchContactHistory.ts index 6eb288eed12d3..1528e21e5ca4a 100644 --- a/apps/meteor/ee/server/patches/fetchContactHistory.ts +++ b/apps/meteor/ee/server/patches/fetchContactHistory.ts @@ -1,7 +1,7 @@ import { License } from '@rocket.chat/license'; import { LivechatRooms } from '@rocket.chat/models'; -import { fetchContactHistory } from '../../../app/livechat/server/lib/contacts/getContactHistory'; +import { fetchContactHistory } from '../../../server/lib/omnichannel/contacts/getContactHistory'; fetchContactHistory.patch( async (next, params) => { diff --git a/apps/meteor/ee/server/patches/isAgentAvailableToTakeContactInquiry.ts b/apps/meteor/ee/server/patches/isAgentAvailableToTakeContactInquiry.ts index 8c44b3a996845..0d44ea1b68811 100644 --- a/apps/meteor/ee/server/patches/isAgentAvailableToTakeContactInquiry.ts +++ b/apps/meteor/ee/server/patches/isAgentAvailableToTakeContactInquiry.ts @@ -2,9 +2,9 @@ import type { ILivechatContact, ILivechatVisitor, IOmnichannelSource } from '@ro import { License } from '@rocket.chat/license'; import { LivechatContacts } from '@rocket.chat/models'; -import { isAgentAvailableToTakeContactInquiry } from '../../../app/livechat/server/lib/contacts/isAgentAvailableToTakeContactInquiry'; -import { isVerifiedChannelInSource } from '../../../app/livechat/server/lib/contacts/isVerifiedChannelInSource'; -import { settings } from '../../../app/settings/server'; +import { isAgentAvailableToTakeContactInquiry } from '../../../server/lib/omnichannel/contacts/isAgentAvailableToTakeContactInquiry'; +import { isVerifiedChannelInSource } from '../../../server/lib/omnichannel/contacts/isVerifiedChannelInSource'; +import { settings } from '../../../server/settings'; // If the contact is unknown and the setting to block unknown contacts is on, we must not allow the agent to take this inquiry // if the contact is not verified in this channel and the block unverified contacts setting is on, we should not allow the inquiry to be taken diff --git a/apps/meteor/ee/server/patches/mergeContacts.ts b/apps/meteor/ee/server/patches/mergeContacts.ts index b3d4f84ce1a37..86927b77983ab 100644 --- a/apps/meteor/ee/server/patches/mergeContacts.ts +++ b/apps/meteor/ee/server/patches/mergeContacts.ts @@ -3,11 +3,11 @@ import { License } from '@rocket.chat/license'; import { LivechatContacts, LivechatRooms, Settings } from '@rocket.chat/models'; import type { ClientSession } from 'mongodb'; -import { notifyOnSettingChanged } from '../../../app/lib/server/lib/notifyListener'; import { isSameChannel } from '../../../app/livechat/lib/isSameChannel'; -import { ContactMerger } from '../../../app/livechat/server/lib/contacts/ContactMerger'; -import { mergeContacts } from '../../../app/livechat/server/lib/contacts/mergeContacts'; -import { contactLogger as logger } from '../../app/livechat-enterprise/server/lib/logger'; +import { notifyOnSettingChanged } from '../../../server/lib/notifyListener'; +import { ContactMerger } from '../../../server/lib/omnichannel/contacts/ContactMerger'; +import { mergeContacts } from '../../../server/lib/omnichannel/contacts/mergeContacts'; +import { contactLogger as logger } from '../lib/omnichannel/logger'; export const runMergeContacts = async ( _next: any, diff --git a/apps/meteor/ee/server/patches/verifyContactChannel.ts b/apps/meteor/ee/server/patches/verifyContactChannel.ts index 8e7a2c05cf840..f533f9107adec 100644 --- a/apps/meteor/ee/server/patches/verifyContactChannel.ts +++ b/apps/meteor/ee/server/patches/verifyContactChannel.ts @@ -3,11 +3,11 @@ import type { ILivechatContact, IOmnichannelRoom } from '@rocket.chat/core-typin import { License } from '@rocket.chat/license'; import { LivechatContacts, LivechatInquiry, LivechatRooms } from '@rocket.chat/models'; -import { QueueManager } from '../../../app/livechat/server/lib/QueueManager'; -import { mergeContacts } from '../../../app/livechat/server/lib/contacts/mergeContacts'; -import { verifyContactChannel } from '../../../app/livechat/server/lib/contacts/verifyContactChannel'; import { client, shouldRetryTransaction } from '../../../server/database/utils'; -import { contactLogger as logger } from '../../app/livechat-enterprise/server/lib/logger'; +import { QueueManager } from '../../../server/lib/omnichannel/QueueManager'; +import { mergeContacts } from '../../../server/lib/omnichannel/contacts/mergeContacts'; +import { verifyContactChannel } from '../../../server/lib/omnichannel/contacts/verifyContactChannel'; +import { contactLogger as logger } from '../lib/omnichannel/logger'; type VerifyContactChannelParams = { contactId: string; diff --git a/apps/meteor/ee/server/settings/abac.ts b/apps/meteor/ee/server/settings/abac.ts index 63e5bec4e0fe4..0e86a6f8cb555 100644 --- a/apps/meteor/ee/server/settings/abac.ts +++ b/apps/meteor/ee/server/settings/abac.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../../app/settings/server'; +import { settingsRegistry } from '../../../server/settings'; const abacEnabledQuery = { _id: 'ABAC_Enabled', value: true }; const virtruPdpQuery = [abacEnabledQuery, { _id: 'ABAC_PDP_Type', value: 'virtru' }]; diff --git a/apps/meteor/ee/server/settings/contact-verification.ts b/apps/meteor/ee/server/settings/contact-verification.ts index b62b164a7b907..9e75e9eb118c8 100644 --- a/apps/meteor/ee/server/settings/contact-verification.ts +++ b/apps/meteor/ee/server/settings/contact-verification.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../../app/settings/server'; +import { settingsRegistry } from '../../../server/settings'; export const addSettings = async (): Promise => { const omnichannelEnabledQuery = { _id: 'Livechat_enabled', value: true }; diff --git a/apps/meteor/ee/server/settings/deviceManagement.ts b/apps/meteor/ee/server/settings/deviceManagement.ts index 133c0095a60d6..c7e730998b160 100644 --- a/apps/meteor/ee/server/settings/deviceManagement.ts +++ b/apps/meteor/ee/server/settings/deviceManagement.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../../app/settings/server'; +import { settingsRegistry } from '../../../server/settings'; export async function addSettings(): Promise { await settingsRegistry.addGroup('Device_Management', async function () { diff --git a/apps/meteor/ee/app/settings/server/index.ts b/apps/meteor/ee/server/settings/index.ts similarity index 100% rename from apps/meteor/ee/app/settings/server/index.ts rename to apps/meteor/ee/server/settings/index.ts diff --git a/apps/meteor/ee/server/settings/ldap.ts b/apps/meteor/ee/server/settings/ldap.ts index 5087eca6b3a68..c3dc3b8c1aecd 100644 --- a/apps/meteor/ee/server/settings/ldap.ts +++ b/apps/meteor/ee/server/settings/ldap.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../../app/settings/server'; +import { settingsRegistry } from '../../../server/settings'; export const ldapIntervalValuesToCronMap: Record = { every_1_hour: '0 * * * *', diff --git a/apps/meteor/ee/server/settings/outlookCalendar.ts b/apps/meteor/ee/server/settings/outlookCalendar.ts index 7252a388e9f52..74951c61a254d 100644 --- a/apps/meteor/ee/server/settings/outlookCalendar.ts +++ b/apps/meteor/ee/server/settings/outlookCalendar.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../../app/settings/server'; +import { settingsRegistry } from '../../../server/settings'; export function addSettings(): void { void settingsRegistry.addGroup('Outlook_Calendar', async function () { diff --git a/apps/meteor/ee/server/settings/saml.ts b/apps/meteor/ee/server/settings/saml.ts index 03132c5f93835..28978e1424dc6 100644 --- a/apps/meteor/ee/server/settings/saml.ts +++ b/apps/meteor/ee/server/settings/saml.ts @@ -1,4 +1,3 @@ -import { settingsRegistry } from '../../../app/settings/server'; import { defaultAuthnContextTemplate, defaultAuthRequestTemplate, @@ -10,6 +9,7 @@ import { defaultMetadataTemplate, defaultMetadataCertificateTemplate, } from '../../../server/lib/saml/lib/constants'; +import { settingsRegistry } from '../../../server/settings'; export const addSettings = async function (name: string): Promise { await settingsRegistry.addGroup('SAML', async function () { diff --git a/apps/meteor/ee/app/settings/server/settings.internalService.ts b/apps/meteor/ee/server/settings/settings.internalService.ts similarity index 100% rename from apps/meteor/ee/app/settings/server/settings.internalService.ts rename to apps/meteor/ee/server/settings/settings.internalService.ts diff --git a/apps/meteor/ee/app/settings/server/settings.ts b/apps/meteor/ee/server/settings/settings.ts similarity index 91% rename from apps/meteor/ee/app/settings/server/settings.ts rename to apps/meteor/ee/server/settings/settings.ts index 451f22937d305..26f5afa6bc184 100644 --- a/apps/meteor/ee/app/settings/server/settings.ts +++ b/apps/meteor/ee/server/settings/settings.ts @@ -4,8 +4,8 @@ import { License } from '@rocket.chat/license'; import { Settings } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { settings, SettingsEvents } from '../../../../app/settings/server'; -import { use } from '../../../../app/settings/server/Middleware'; +import { settings, SettingsEvents } from '../../../server/settings'; +import { use } from '../../../server/settings/Middleware'; export function changeSettingValue(record: ISetting): SettingValue { if (!record.enterprise) { diff --git a/apps/meteor/ee/server/settings/video-conference.ts b/apps/meteor/ee/server/settings/video-conference.ts index 18d3108f57d01..81ff49e49a6d2 100644 --- a/apps/meteor/ee/server/settings/video-conference.ts +++ b/apps/meteor/ee/server/settings/video-conference.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../../app/settings/server'; +import { settingsRegistry } from '../../../server/settings'; export function addSettings(): Promise { return settingsRegistry.addGroup('Video_Conference', async function () { diff --git a/apps/meteor/ee/server/settings/voip.ts b/apps/meteor/ee/server/settings/voip.ts index 5468145e6c67c..42c424005679a 100644 --- a/apps/meteor/ee/server/settings/voip.ts +++ b/apps/meteor/ee/server/settings/voip.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../../app/settings/server'; +import { settingsRegistry } from '../../../server/settings'; export function addSettings(): Promise { return settingsRegistry.addGroup('VoIP_TeamCollab', async function () { diff --git a/apps/meteor/ee/server/startup/federation.ts b/apps/meteor/ee/server/startup/federation.ts index c258823c90b5e..8a8b53bc28bf5 100644 --- a/apps/meteor/ee/server/startup/federation.ts +++ b/apps/meteor/ee/server/startup/federation.ts @@ -4,8 +4,8 @@ import { InstanceStatus } from '@rocket.chat/instance-status'; import { License } from '@rocket.chat/license'; import { Logger } from '@rocket.chat/logger'; -import { settings } from '../../../app/settings/server'; import { StreamerCentral } from '../../../server/modules/streamer/streamer.module'; +import { settings } from '../../../server/settings'; import { registerFederationRoutes } from '../api/federation'; const logger = new Logger('Federation'); diff --git a/apps/meteor/ee/server/startup/readReceiptsArchive.ts b/apps/meteor/ee/server/startup/readReceiptsArchive.ts index 6595410fd5e2c..3e05688d4b90e 100644 --- a/apps/meteor/ee/server/startup/readReceiptsArchive.ts +++ b/apps/meteor/ee/server/startup/readReceiptsArchive.ts @@ -1,4 +1,4 @@ -import { settings } from '../../../app/settings/server'; +import { settings } from '../../../server/settings'; import { readReceiptsArchiveCron } from '../cron/readReceiptsArchive'; // Watch for settings changes and update the cron schedule diff --git a/apps/meteor/ee/server/startup/services.ts b/apps/meteor/ee/server/startup/services.ts index 67ed7eebfaf9d..6ff97f4354486 100644 --- a/apps/meteor/ee/server/startup/services.ts +++ b/apps/meteor/ee/server/startup/services.ts @@ -2,12 +2,12 @@ import { AbacService } from '@rocket.chat/abac'; import { api } from '@rocket.chat/core-services'; import { isRunningMs } from '../../../server/lib/isRunningMs'; -import { OmnichannelEE } from '../../app/livechat-enterprise/server/services/omnichannel.internalService'; -import { EnterpriseSettings } from '../../app/settings/server/settings.internalService'; import { LicenseService } from '../lib/license/license.internalService'; import { InstanceService } from '../local-services/instance/service'; import { LDAPEEService } from '../local-services/ldap/service'; import { MessageReadsService } from '../local-services/message-reads/service'; +import { OmnichannelEE } from '../local-services/omnichannel.internalService'; +import { EnterpriseSettings } from '../settings/settings.internalService'; // TODO consider registering these services only after a valid license is added api.registerService(new EnterpriseSettings()); diff --git a/apps/meteor/ee/server/startup/upsell.ts b/apps/meteor/ee/server/startup/upsell.ts index 751f921ea7b00..ae3d3d3b4c46f 100644 --- a/apps/meteor/ee/server/startup/upsell.ts +++ b/apps/meteor/ee/server/startup/upsell.ts @@ -2,7 +2,7 @@ import { License } from '@rocket.chat/license'; import { Settings } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { notifyOnSettingChangedById } from '../../../app/lib/server/lib/notifyListener'; +import { notifyOnSettingChangedById } from '../../../server/lib/notifyListener'; import { updateAuditedBySystem } from '../../../server/settings/lib/auditedSettingUpdates'; const handleHadTrial = (): void => { diff --git a/apps/meteor/ee/tests/unit/apps/livechat-enterprise/server/lib/isAgentAvailableToTakeContactInquiry.spec.ts b/apps/meteor/ee/tests/unit/apps/livechat-enterprise/server/lib/isAgentAvailableToTakeContactInquiry.spec.ts index 0d6658958588f..d92ebec9ccabf 100644 --- a/apps/meteor/ee/tests/unit/apps/livechat-enterprise/server/lib/isAgentAvailableToTakeContactInquiry.spec.ts +++ b/apps/meteor/ee/tests/unit/apps/livechat-enterprise/server/lib/isAgentAvailableToTakeContactInquiry.spec.ts @@ -16,7 +16,7 @@ const { runIsAgentAvailableToTakeContactInquiry } = proxyquire .noCallThru() .load('../../../../../../server/patches/isAgentAvailableToTakeContactInquiry', { '@rocket.chat/models': modelsMock, - '../../../app/settings/server': { + '../../../server/settings': { settings: settingsMock, }, }); diff --git a/apps/meteor/ee/tests/unit/apps/livechat-enterprise/server/lib/mergeContacts.spec.ts b/apps/meteor/ee/tests/unit/apps/livechat-enterprise/server/lib/mergeContacts.spec.ts index dad4ceaf13568..0b7c978f837a1 100644 --- a/apps/meteor/ee/tests/unit/apps/livechat-enterprise/server/lib/mergeContacts.spec.ts +++ b/apps/meteor/ee/tests/unit/apps/livechat-enterprise/server/lib/mergeContacts.spec.ts @@ -22,10 +22,10 @@ const contactMergerStub = { }; const { runMergeContacts } = proxyquire.noCallThru().load('../../../../../../server/patches/mergeContacts', { - '../../../app/livechat/server/lib/contacts/mergeContacts': { mergeContacts: { patch: sinon.stub() } }, - '../../../app/livechat/server/lib/contacts/ContactMerger': { ContactMerger: contactMergerStub }, - '../../../app/livechat-enterprise/server/lib/logger': { logger: { info: sinon.stub(), debug: sinon.stub() } }, - '../../../app/lib/server/lib/notifyListener': { notifyOnSettingChanged: sinon.stub() }, + '../../../server/lib/omnichannel/contacts/mergeContacts': { mergeContacts: { patch: sinon.stub() } }, + '../../../server/lib/omnichannel/contacts/ContactMerger': { ContactMerger: contactMergerStub }, + '../lib/omnichannel/logger': { contactLogger: { info: sinon.stub(), debug: sinon.stub() } }, + '../../../server/lib/notifyListener': { notifyOnSettingChanged: sinon.stub() }, '@rocket.chat/models': modelsMock, }); diff --git a/apps/meteor/ee/tests/unit/apps/livechat-enterprise/server/lib/verifyContactChannel.spec.ts b/apps/meteor/ee/tests/unit/apps/livechat-enterprise/server/lib/verifyContactChannel.spec.ts index cdf310b585216..089b7abb98168 100644 --- a/apps/meteor/ee/tests/unit/apps/livechat-enterprise/server/lib/verifyContactChannel.spec.ts +++ b/apps/meteor/ee/tests/unit/apps/livechat-enterprise/server/lib/verifyContactChannel.spec.ts @@ -37,11 +37,11 @@ const queueManager = { }; const { runVerifyContactChannel } = proxyquire.noCallThru().load('../../../../../../server/patches/verifyContactChannel', { - '../../../app/livechat/server/lib/contacts/mergeContacts': { mergeContacts: mergeContactsStub }, - '../../../app/livechat/server/lib/contacts/verifyContactChannel': { verifyContactChannel: { patch: sinon.stub() } }, - '../../../app/livechat/server/lib/QueueManager': { QueueManager: queueManager }, + '../../../server/lib/omnichannel/contacts/mergeContacts': { mergeContacts: mergeContactsStub }, + '../../../server/lib/omnichannel/contacts/verifyContactChannel': { verifyContactChannel: { patch: sinon.stub() } }, + '../../../server/lib/omnichannel/QueueManager': { QueueManager: queueManager }, '../../../server/database/utils': { client: clientMock }, - '../../../app/livechat-enterprise/server/lib/logger': { logger: { info: sinon.stub(), debug: sinon.stub() } }, + '../lib/omnichannel/logger': { contactLogger: { info: sinon.stub(), debug: sinon.stub() } }, '@rocket.chat/models': modelsMock, }); diff --git a/apps/meteor/ee/tests/unit/server/airgappedRestrictions/airgappedRestrictions.spec.ts b/apps/meteor/ee/tests/unit/server/airgappedRestrictions/airgappedRestrictions.spec.ts index ff222daafc6c7..3c1a10c7fc265 100644 --- a/apps/meteor/ee/tests/unit/server/airgappedRestrictions/airgappedRestrictions.spec.ts +++ b/apps/meteor/ee/tests/unit/server/airgappedRestrictions/airgappedRestrictions.spec.ts @@ -60,7 +60,7 @@ proxyquire.noCallThru().load('../../../../server/lib/license/airGappedRestrictio findLastStatsToken: mocks.findLastToken, }, }, - '../../../../app/lib/server/lib/notifyListener': { + '../../../../server/lib/notifyListener': { notifyOnSettingChangedById: mocks.notifySetting, }, '../../../../server/lib/i18n': { diff --git a/apps/meteor/ee/tests/unit/server/hooks/omnichannel/afterInquiryQueued.spec.ts b/apps/meteor/ee/tests/unit/server/hooks/omnichannel/afterInquiryQueued.spec.ts index a65a07962ec87..dac5e1efb04ea 100644 --- a/apps/meteor/ee/tests/unit/server/hooks/omnichannel/afterInquiryQueued.spec.ts +++ b/apps/meteor/ee/tests/unit/server/hooks/omnichannel/afterInquiryQueued.spec.ts @@ -16,13 +16,13 @@ const queueMonitorStub = { const { afterInquiryQueuedFunc: afterInquiryQueued } = proxyquire .noCallThru() .load('../../../../../server/hooks/omnichannel/afterInquiryQueued.ts', { - '../../../../app/settings/server': { + '../../../../server/settings': { settings: settingStub, }, - '../../../app/livechat-enterprise/server/lib/QueueInactivityMonitor': { + '../../lib/omnichannel/QueueInactivityMonitor': { OmnichannelQueueInactivityMonitor: queueMonitorStub, }, - '../../../../app/livechat/server/lib/hooks': { + '../../../../server/lib/omnichannel/hooks': { afterInquiryQueued: { patch: sinon.stub() }, }, }); diff --git a/apps/meteor/tests/unit/app/license/server/canEnableApp.spec.ts b/apps/meteor/ee/tests/unit/server/lib/license/canEnableApp.spec.ts similarity index 97% rename from apps/meteor/tests/unit/app/license/server/canEnableApp.spec.ts rename to apps/meteor/ee/tests/unit/server/lib/license/canEnableApp.spec.ts index 3d4c5fd15c967..86cbbe4e0db12 100644 --- a/apps/meteor/tests/unit/app/license/server/canEnableApp.spec.ts +++ b/apps/meteor/ee/tests/unit/server/lib/license/canEnableApp.spec.ts @@ -5,7 +5,7 @@ import type { Apps } from '@rocket.chat/core-services'; import type { LicenseImp } from '@rocket.chat/license'; import { expect } from 'chai'; -import { _canEnableApp } from '../../../../../ee/server/lib/license/canEnableApp'; +import { _canEnableApp } from '../../../../../server/lib/license/canEnableApp'; const getDefaultApp = (): IAppStorageItem => ({ _id: '6706d9258e0ca97c2f0cc885', diff --git a/apps/meteor/ee/tests/unit/apps/livechat-enterprise/lib/AutoCloseOnHold.tests.ts b/apps/meteor/ee/tests/unit/server/lib/omnichannel/AutoCloseOnHold.tests.ts similarity index 97% rename from apps/meteor/ee/tests/unit/apps/livechat-enterprise/lib/AutoCloseOnHold.tests.ts rename to apps/meteor/ee/tests/unit/server/lib/omnichannel/AutoCloseOnHold.tests.ts index 4539f5e63fa21..9ad6c9ef9cc49 100644 --- a/apps/meteor/ee/tests/unit/apps/livechat-enterprise/lib/AutoCloseOnHold.tests.ts +++ b/apps/meteor/ee/tests/unit/server/lib/omnichannel/AutoCloseOnHold.tests.ts @@ -64,7 +64,7 @@ const mocks = { }, }, }, - '../../../../../app/livechat/server/lib/closeRoom': { closeRoom: mockLivechatCloseRoom }, + '../../../../server/lib/omnichannel/closeRoom': { closeRoom: mockLivechatCloseRoom }, './logger': { schedulerLogger: mockLogger }, '@rocket.chat/models': { LivechatRooms: mockLivechatRooms, @@ -74,7 +74,7 @@ const mocks = { const { AutoCloseOnHoldSchedulerClass } = proxyquire .noCallThru() - .load('../../../../../app/livechat-enterprise/server/lib/AutoCloseOnHoldScheduler', mocks); + .load('../../../../../server/lib/omnichannel/AutoCloseOnHoldScheduler', mocks); describe('AutoCloseOnHoldScheduler', () => { beforeEach(() => { diff --git a/apps/meteor/ee/tests/unit/apps/livechat-enterprise/lib/AutoTransferChatsScheduler.tests.ts b/apps/meteor/ee/tests/unit/server/lib/omnichannel/AutoTransferChatsScheduler.tests.ts similarity index 94% rename from apps/meteor/ee/tests/unit/apps/livechat-enterprise/lib/AutoTransferChatsScheduler.tests.ts rename to apps/meteor/ee/tests/unit/server/lib/omnichannel/AutoTransferChatsScheduler.tests.ts index f54837299f577..dccc7f014d50e 100644 --- a/apps/meteor/ee/tests/unit/apps/livechat-enterprise/lib/AutoTransferChatsScheduler.tests.ts +++ b/apps/meteor/ee/tests/unit/server/lib/omnichannel/AutoTransferChatsScheduler.tests.ts @@ -70,10 +70,10 @@ const mocks = { }, }, }, - '../../../../../app/livechat/server/lib/RoutingManager': { RoutingManager: { getConfig: routingConfigMock, getNextAgent } }, - '../../../../../app/livechat/server/lib/Helper': { forwardRoomToAgent }, - '../../../../../app/livechat/server/lib/rooms': { returnRoomAsInquiry: returnRoomAsInquiryMock }, - '../../../../../app/settings/server': { settings: { get: settingsGet } }, + '../../../../server/lib/omnichannel/RoutingManager': { RoutingManager: { getConfig: routingConfigMock, getNextAgent } }, + '../../../../server/lib/omnichannel/Helper': { forwardRoomToAgent }, + '../../../../server/lib/omnichannel/rooms': { returnRoomAsInquiry: returnRoomAsInquiryMock }, + '../../../../server/settings': { settings: { get: settingsGet } }, './logger': { schedulerLogger: mockLogger }, '@rocket.chat/models': { LivechatRooms: mockLivechatRooms, @@ -83,7 +83,7 @@ const mocks = { const { AutoTransferChatSchedulerClass } = proxyquire .noCallThru() - .load('../../../../../app/livechat-enterprise/server/lib/AutoTransferChatScheduler', mocks); + .load('../../../../../server/lib/omnichannel/AutoTransferChatScheduler', mocks); describe('AutoTransferChats', () => { describe('getSchedulerUser', () => { diff --git a/apps/meteor/ee/tests/unit/apps/livechat-enterprise/lib/Helper.tests.ts b/apps/meteor/ee/tests/unit/server/lib/omnichannel/Helper.tests.ts similarity index 94% rename from apps/meteor/ee/tests/unit/apps/livechat-enterprise/lib/Helper.tests.ts rename to apps/meteor/ee/tests/unit/server/lib/omnichannel/Helper.tests.ts index a9c99df7f7cee..11f0a48a5c367 100644 --- a/apps/meteor/ee/tests/unit/apps/livechat-enterprise/lib/Helper.tests.ts +++ b/apps/meteor/ee/tests/unit/server/lib/omnichannel/Helper.tests.ts @@ -13,13 +13,13 @@ const departmentsMock = { findOneById: sinon.stub() }; const mocks = { 'meteor/meteor': { Meteor: { startup: sinon.stub() } }, './QueueInactivityMonitor': { stop: sinon.stub() }, - '../../../../../app/livechat/server/lib/settings': { getInquirySortMechanismSetting: sinon.stub() }, - '../../../../../app/livechat/lib/inquiries': { getOmniChatSortQuery: sinon.stub() }, - '../../../../../app/settings/server': { settings: { get: settingGetMock } }, + '../../../../server/lib/omnichannel/settings': { getInquirySortMechanismSetting: sinon.stub() }, + '../../../../app/livechat/lib/inquiries': { getOmniChatSortQuery: sinon.stub() }, + '../../../../server/settings': { settings: { get: settingGetMock } }, '@rocket.chat/models': { Users: usersModelMock, LivechatDepartment: departmentsMock }, }; -const { isAgentWithinChatLimits } = proxyquire.noCallThru().load('../../../../../app/livechat-enterprise/server/lib/Helper.ts', mocks); +const { isAgentWithinChatLimits } = proxyquire.noCallThru().load('../../../../../server/lib/omnichannel/Helper.ts', mocks); describe('isAgentWithinChatLimits', () => { beforeEach(() => { diff --git a/apps/meteor/ee/tests/unit/apps/livechat-enterprise/server/lib/QueueInactivityMonitor.spec.ts b/apps/meteor/ee/tests/unit/server/lib/omnichannel/QueueInactivityMonitor.spec.ts similarity index 95% rename from apps/meteor/ee/tests/unit/apps/livechat-enterprise/server/lib/QueueInactivityMonitor.spec.ts rename to apps/meteor/ee/tests/unit/server/lib/omnichannel/QueueInactivityMonitor.spec.ts index 526c981b83bdc..50ed9beb352e9 100644 --- a/apps/meteor/ee/tests/unit/apps/livechat-enterprise/server/lib/QueueInactivityMonitor.spec.ts +++ b/apps/meteor/ee/tests/unit/server/lib/omnichannel/QueueInactivityMonitor.spec.ts @@ -34,16 +34,16 @@ const settingsMock = { settings: { get: sinon.stub() } }; const { OmnichannelQueueInactivityMonitorClass } = proxyquire .noCallThru() - .load('../../../../../../app/livechat-enterprise/server/lib/QueueInactivityMonitor', { + .load('../../../../../server/lib/omnichannel/QueueInactivityMonitor', { '@rocket.chat/agenda': { Agenda: sinon.stub().returns(AgendaStub), }, '@rocket.chat/models': modelsMock, 'meteor/meteor': meteorMock, 'meteor/mongo': mongoMock, - '../../../../../app/livechat/server/lib/closeRoom': livechatMock, - '../../../../../app/settings/server': settingsMock, - '../../../../../server/lib/i18n': { i18n: { t: sinon.stub().returns('Closed automatically') } }, + '../../../../server/lib/omnichannel/closeRoom': livechatMock, + '../../../../server/settings': settingsMock, + '../../../../server/lib/i18n': { i18n: { t: sinon.stub().returns('Closed automatically') } }, }); describe('OmnichannelQueueInactivityMonitorClass', () => { diff --git a/apps/meteor/tests/unit/app/livechat-enterprise/server/business-hour/Custom.spec.ts b/apps/meteor/ee/tests/unit/server/lib/omnichannel/business-hour/Custom.spec.ts similarity index 96% rename from apps/meteor/tests/unit/app/livechat-enterprise/server/business-hour/Custom.spec.ts rename to apps/meteor/ee/tests/unit/server/lib/omnichannel/business-hour/Custom.spec.ts index b2e873bb65d33..22cf13c3b1d6f 100644 --- a/apps/meteor/tests/unit/app/livechat-enterprise/server/business-hour/Custom.spec.ts +++ b/apps/meteor/ee/tests/unit/server/lib/omnichannel/business-hour/Custom.spec.ts @@ -34,8 +34,8 @@ const registerBusinessHourTypeStub = sinon.stub(); // Only the DB layer and the meteor-heavy imports are stubbed; Custom.ts, // AbstractBusinessHour (real convertWorkHours/baseSaveBusinessHour) and // Helper run for real. -proxyquire.noCallThru().load('../../../../../../ee/app/livechat-enterprise/server/business-hour/Custom', { - '../../../../../app/livechat/server/business-hour': { +proxyquire.noCallThru().load('../../../../../../server/lib/omnichannel/business-hour/Custom', { + '../../../../../server/lib/omnichannel/business-hour': { businessHourManager: { registerBusinessHourType: registerBusinessHourTypeStub }, }, '@rocket.chat/models': { @@ -45,7 +45,7 @@ proxyquire.noCallThru().load('../../../../../../ee/app/livechat-enterprise/serve 'LivechatDepartmentAgents': LivechatDepartmentAgentsStub, 'Users': UsersStub, }, - '../../../lib/server/lib/notifyListener': { + '../../notifyListener': { '@global': true, 'notifyOnUserChange': sinon.stub(), 'notifyOnUserChangeAsync': sinon.stub(), diff --git a/apps/meteor/tests/unit/server/livechat/lib/requestPdfTranscript.spec.ts b/apps/meteor/ee/tests/unit/server/lib/omnichannel/requestPdfTranscript.spec.ts similarity index 88% rename from apps/meteor/tests/unit/server/livechat/lib/requestPdfTranscript.spec.ts rename to apps/meteor/ee/tests/unit/server/lib/omnichannel/requestPdfTranscript.spec.ts index f9eadc7dae9d5..6ab2541d90c55 100644 --- a/apps/meteor/tests/unit/server/livechat/lib/requestPdfTranscript.spec.ts +++ b/apps/meteor/ee/tests/unit/server/lib/omnichannel/requestPdfTranscript.spec.ts @@ -6,18 +6,16 @@ import sinon from 'sinon'; const workOnPdfStub = sinon.stub(); const queueWorkStub = sinon.stub(); -const { requestPdfTranscript } = proxyquire - .noCallThru() - .load('../../../../../ee/app/livechat-enterprise/server/lib/requestPdfTranscript.ts', { - '@rocket.chat/core-services': { - OmnichannelTranscript: { - workOnPdf: workOnPdfStub, - }, - QueueWorker: { - queueWork: queueWorkStub, - }, +const { requestPdfTranscript } = proxyquire.noCallThru().load('../../../../../server/lib/omnichannel/requestPdfTranscript.ts', { + '@rocket.chat/core-services': { + OmnichannelTranscript: { + workOnPdf: workOnPdfStub, }, - }); + QueueWorker: { + queueWork: queueWorkStub, + }, + }, +}); describe('requestPdfTranscript', () => { const currentTestModeValue = process.env.TEST_MODE; diff --git a/apps/meteor/ee/tests/unit/apps/livechat-enterprise/lib/restrictQuery.tests.ts b/apps/meteor/ee/tests/unit/server/lib/omnichannel/restrictQuery.tests.ts similarity index 99% rename from apps/meteor/ee/tests/unit/apps/livechat-enterprise/lib/restrictQuery.tests.ts rename to apps/meteor/ee/tests/unit/server/lib/omnichannel/restrictQuery.tests.ts index 5dc3adb558fc6..1131c70b17b12 100644 --- a/apps/meteor/ee/tests/unit/apps/livechat-enterprise/lib/restrictQuery.tests.ts +++ b/apps/meteor/ee/tests/unit/server/lib/omnichannel/restrictQuery.tests.ts @@ -9,7 +9,7 @@ type RestrictQueryParams = { }; describe('restrictQuery', () => { - const modulePath = '../../../../../app/livechat-enterprise/server/lib/restrictQuery'; + const modulePath = '../../../../../server/lib/omnichannel/restrictQuery'; // Helper to require the SUT with injected stubs const loadSut = ({ diff --git a/apps/meteor/jest.config.ts b/apps/meteor/jest.config.ts index dc25c7e5d01bd..137e1e6e07114 100644 --- a/apps/meteor/jest.config.ts +++ b/apps/meteor/jest.config.ts @@ -34,8 +34,7 @@ export default { displayName: 'server', preset: server.preset, testMatch: [ - '/app/livechat/server/business-hour/**/*.spec.ts?(x)', - '/app/livechat/server/api/**/*.spec.ts', + '/server/lib/omnichannel/business-hour/**/*.spec.ts?(x)', '/ee/server/lib/authorization/validateUserRoles.spec.ts', '/ee/server/lib/license/**/*.spec.ts', '/ee/server/patches/**/*.spec.ts', @@ -46,14 +45,10 @@ export default { '/server/services/import/**/*.spec.ts', '/server/settings/lib/**.spec.ts', '/server/cron/**.spec.ts', - '/app/api/server/**.spec.ts', - '/app/api/server/helpers/**.spec.ts', - '/app/api/server/middlewares/**.spec.ts', '/server/api/*.spec.ts', '/server/api/lib/getUserInfo.spec.ts', '/server/api/v1/middlewares/*.spec.ts', '/server/lib/cloud/version-check/**/*.spec.ts', - '/app/apple/lib/**.spec.ts', '/server/lib/auth-providers/apple/**.spec.ts', ], coveragePathIgnorePatterns: ['/node_modules/'], diff --git a/apps/meteor/scripts/migration/check-broken-imports.mjs b/apps/meteor/scripts/migration/check-broken-imports.mjs deleted file mode 100644 index 33b09c4f96827..0000000000000 --- a/apps/meteor/scripts/migration/check-broken-imports.mjs +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env node - -/** - * Disposable migration helper: finds relative imports that do not resolve to a - * file on disk. Catches the directories ESLint ignores (its known blind spot - * during this migration — see MIGRATION_PLAN.md). - */ - -import fs from 'node:fs'; -import path from 'node:path'; - -const ROOT = path.resolve(import.meta.dirname, '../..'); -const dirs = process.argv.slice(2).length - ? process.argv.slice(2) - : ['app', 'server', 'ee', 'lib', 'imports', 'client', 'definition', 'tests']; - -const IMPORT_RE = /(?:from\s+|import\s+|(?:import|require)\s*\(\s*)(['"])(\.[^'"]+)\1/g; -const EXT = ['.ts', '.tsx', '.js', '.jsx']; - -function getAllFiles(dir) { - const results = []; - if (!fs.existsSync(dir)) return results; - for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { - const full = path.join(dir, entry.name); - if (entry.isDirectory()) results.push(...getAllFiles(full)); - else if (EXT.some((e) => entry.name.endsWith(e))) results.push(full); - } - return results; -} - -function resolves(fromFile, spec) { - const resolved = path.resolve(path.dirname(fromFile), spec); - const noJsExt = resolved.replace(/\.js$/, ''); - const candidates = [ - resolved, - ...EXT.map((e) => `${resolved}${e}`), - `${noJsExt}.ts`, - `${noJsExt}.tsx`, - ...EXT.map((e) => path.join(resolved, `index${e}`)), - `${resolved}.d.ts`, - `${resolved}.json`, - `${resolved}.css`, - `${resolved}.info`, - ]; - return candidates.some((c) => fs.existsSync(c) && fs.statSync(c).isFile()); -} - -let problems = 0; -for (const dir of dirs) { - for (const file of getAllFiles(path.join(ROOT, dir))) { - const content = fs.readFileSync(file, 'utf8'); - for (const m of content.matchAll(IMPORT_RE)) { - if (!resolves(file, m[2])) { - console.log(`${path.relative(ROOT, file)}: unresolved import ${m[2]}`); - problems++; - } - } - } -} -for (const entry of fs.readdirSync(ROOT, { withFileTypes: true })) { - if (!entry.isFile() || !EXT.some((e) => entry.name.endsWith(e))) continue; - const file = path.join(ROOT, entry.name); - const content = fs.readFileSync(file, 'utf8'); - for (const m of content.matchAll(IMPORT_RE)) { - if (!resolves(file, m[2])) { - console.log(`${entry.name}: unresolved import ${m[2]}`); - problems++; - } - } -} -console.log(problems ? `\n${problems} unresolved import(s).` : 'All relative imports resolve.'); -process.exit(problems ? 1 : 0); diff --git a/apps/meteor/scripts/migration/check-mock-keys.mjs b/apps/meteor/scripts/migration/check-mock-keys.mjs deleted file mode 100644 index c5639e92c1d14..0000000000000 --- a/apps/meteor/scripts/migration/check-mock-keys.mjs +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/env node - -/** - * Disposable migration helper: verifies proxyquire/jest.mock string literals. - * - * - proxyquire `.load('', { '': ... })`: the target must resolve to - * a real file, and every relative key must literally match an import specifier - * used by the loaded module (proxyquire matches keys literally). - * - `jest.mock('')`: a relative key must resolve to a real file from the - * spec's directory. - * - * Scans all *.spec.ts / *.tests.{ts,js} under the given dirs (default: app, - * server, ee, tests, imports). - */ - -import fs from 'node:fs'; -import path from 'node:path'; - -const ROOT = path.resolve(import.meta.dirname, '../..'); -const dirs = process.argv.slice(2).length ? process.argv.slice(2) : ['app', 'server', 'ee', 'tests', 'imports']; - -function getAllFiles(dir) { - const results = []; - if (!fs.existsSync(dir)) return results; - for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { - const full = path.join(dir, entry.name); - if (entry.isDirectory()) results.push(...getAllFiles(full)); - else if (/\.(spec|tests)\.(ts|js)$/.test(entry.name)) results.push(full); - } - return results; -} - -function resolveModule(fromDir, spec) { - const resolved = path.resolve(fromDir, spec); - const noJsExt = resolved.replace(/\.js$/, ''); - for (const c of [ - resolved, - `${resolved}.ts`, - `${resolved}.tsx`, - `${resolved}.js`, - `${noJsExt}.ts`, - path.join(resolved, 'index.ts'), - path.join(resolved, 'index.js'), - ]) { - if (fs.existsSync(c) && fs.statSync(c).isFile()) return c; - } - return null; -} - -let problems = 0; -for (const dir of dirs) { - for (const specFile of getAllFiles(path.join(ROOT, dir))) { - const content = fs.readFileSync(specFile, 'utf8'); - const rel = path.relative(ROOT, specFile); - - // jest.mock relative keys must resolve from the spec's dir - for (const m of content.matchAll(/jest\.mock\(\s*(['"])(\.[^'"]+)\1/g)) { - if (!resolveModule(path.dirname(specFile), m[2])) { - console.log(`${rel}: jest.mock key does not resolve: ${m[2]}`); - problems++; - } - } - - // proxyquire targets + literal keys - for (const m of content.matchAll(/\.load\(\s*(['"])(\.[^'"]+)\1\s*,/g)) { - const target = m[2]; - const targetFile = resolveModule(path.dirname(specFile), target); - if (!targetFile) { - console.log(`${rel}: proxyquire target does not resolve: ${target}`); - problems++; - continue; - } - const modContent = fs.readFileSync(targetFile, 'utf8'); - const modSpecifiers = new Set( - [...modContent.matchAll(/(?:from\s+|import\s+|(?:import|require)\s*\(\s*)(['"])([^'"]+)\1/g)].map((x) => x[2]), - ); - // keys of the stub object immediately following this .load( target, - // only when the second argument is an inline object literal - const after = content.slice(m.index + m[0].length); - if (!/^\s*\{/.test(after)) continue; - const open = after.indexOf('{'); - // naive brace matching to find the stubs object end - let depth = 0; - let end = open; - for (let i = open; i < after.length; i++) { - if (after[i] === '{') depth++; - else if (after[i] === '}') { - depth--; - if (depth === 0) { - end = i; - break; - } - } - } - const stubs = after.slice(open, end + 1); - for (const k of stubs.matchAll(/(['"])(\.[^'"]+)\1\s*:/g)) { - if (!modSpecifiers.has(k[2])) { - console.log(`${rel}: stale proxyquire key for ${path.relative(ROOT, targetFile)}: ${k[2]}`); - problems++; - } - } - } - } -} -console.log(problems ? `\n${problems} problem(s) found.` : 'All mock keys OK.'); -process.exit(problems ? 1 : 0); diff --git a/apps/meteor/scripts/migration/move-batch.mjs b/apps/meteor/scripts/migration/move-batch.mjs deleted file mode 100644 index 49272b1ea3420..0000000000000 --- a/apps/meteor/scripts/migration/move-batch.mjs +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/env node - -/** - * Disposable migration script: moves multiple modules from a TSV manifest. - * - * Usage: - * node move-batch.mjs - * - * Manifest format (TSV, one pair per line): - * app/slashcommands-ban/server server/slashcommands/ban - * app/slashcommands-kick/server server/slashcommands/kick - * - * After all moves, runs `yarn lint --quiet` to verify no imports broke. - */ - -import { execFileSync, execSync } from 'node:child_process'; -import fs from 'node:fs'; -import path from 'node:path'; - -const ROOT = path.resolve(import.meta.dirname, '../..'); -const manifestPath = process.argv[2]; - -if (!manifestPath) { - console.error('Usage: node move-batch.mjs '); - process.exit(1); -} - -const manifest = fs - .readFileSync(manifestPath, 'utf8') - .split('\n') - .map((line) => line.trim()) - .filter((line) => line && !line.startsWith('#')); - -console.log(`Processing ${manifest.length} entries from ${manifestPath}\n`); - -// License-boundary guard: validate every row up front so a community manifest -// can never carry an `ee/` source and an EE manifest can never point outside -// `ee/`. This mirrors the hard check in move-module.mjs (see MIGRATION_PLAN.md). -const hasEESegment = (p) => p.split('/').includes('ee'); -const boundaryViolations = manifest - .map((line) => line.split('\t').map((s) => s.trim())) - .filter(([fromDir, toDir]) => fromDir && toDir && hasEESegment(fromDir) !== hasEESegment(toDir)); -if (boundaryViolations.length > 0) { - console.error('License-boundary violation in manifest — every `ee/` source must map to an `ee/` destination (and vice versa):'); - for (const [fromDir, toDir] of boundaryViolations) { - console.error(` ${fromDir} → ${toDir}`); - } - process.exit(1); -} - -let failed = 0; - -for (const line of manifest) { - const [fromDir, toDir] = line.split('\t').map((s) => s.trim()); - if (!fromDir || !toDir) { - console.error(`Skipping malformed line: ${line}`); - failed++; - continue; - } - - try { - const scriptPath = path.join(import.meta.dirname, 'move-module.mjs'); - execFileSync(process.execPath, [scriptPath, '--from', fromDir, '--to', toDir], { - cwd: ROOT, - stdio: 'inherit', - }); - } catch (err) { - console.error(`FAILED: ${fromDir} → ${toDir}`); - console.error(err.message); - failed++; - } -} - -console.log(`\n${'─'.repeat(60)}`); -console.log(`Batch complete. ${manifest.length - failed}/${manifest.length} succeeded.`); - -if (failed > 0) { - console.error(`${failed} entries failed.`); - process.exit(1); -} - -// Verify no imports broke. `yarn lint --quiet` is the authoritative check for -// unresolved imports (see MIGRATION_PLAN.md); `--quiet` hides warnings so -// import errors stand out. tsc is avoided here because it also surfaces -// pre-existing, unrelated type errors. -console.log('\nRunning yarn lint --quiet to verify...'); -try { - execSync('yarn lint --quiet', { cwd: ROOT, stdio: 'inherit', timeout: 300_000 }); - console.log('Lint check passed.'); -} catch { - console.error('Lint check FAILED. Fix the errors above before committing.'); - process.exit(1); -} diff --git a/apps/meteor/scripts/migration/move-module.mjs b/apps/meteor/scripts/migration/move-module.mjs deleted file mode 100644 index ef1b61a22a174..0000000000000 --- a/apps/meteor/scripts/migration/move-module.mjs +++ /dev/null @@ -1,368 +0,0 @@ -#!/usr/bin/env node - -/** - * Disposable migration script: moves a module directory and updates all imports. - * - * Usage: - * node move-module.mjs --from app/slashcommands-ban/server --to server/slashcommands/ban - * - * All paths are relative to the Meteor app root (apps/meteor/). - * - * What it does: - * 1. git mv every file from to - * 2. Update relative imports WITHIN moved files (their position in the tree changed) - * 3. Update relative imports in OTHER files that referenced the moved module - */ - -import { execFileSync } from 'node:child_process'; -import fs from 'node:fs'; -import path from 'node:path'; - -// ── CLI args ───────────────────────────────────────────────────────────────── - -const args = process.argv.slice(2); -const fromIdx = args.indexOf('--from'); -const toIdx = args.indexOf('--to'); - -if (fromIdx === -1 || toIdx === -1 || !args[fromIdx + 1] || !args[toIdx + 1]) { - console.error('Usage: node move-module.mjs --from --to '); - console.error('Paths are relative to apps/meteor/'); - process.exit(1); -} - -const ROOT = path.resolve(import.meta.dirname, '../..'); -const fromRel = args[fromIdx + 1]; -const toRel = args[toIdx + 1]; -const fromAbs = path.resolve(ROOT, fromRel); -const toAbs = path.resolve(ROOT, toRel); - -const dryRun = args.includes('--dry-run'); - -// ── License-boundary guard (mandatory) ───────────────────────────────────────── -// EE code is protected by the Enterprise license *only* because it lives under an -// `ee/` path. A move that crosses the boundary in either direction would silently -// relicense the file, so we refuse it loudly before touching anything. -// Normalize (resolve + relativize against ROOT) before checking, so `..` segments -// can't sneak a boundary-crossing path past a raw string match (e.g. `ee/../server` -// contains the literal `ee` segment but actually resolves into the community tree). -const hasEESegment = (p) => path.relative(ROOT, path.resolve(ROOT, p)).split(path.sep).includes('ee'); -if (hasEESegment(fromRel) !== hasEESegment(toRel)) { - console.error('License-boundary violation: a move must keep `ee/` sources under `ee/` and community sources outside `ee/`.'); - console.error(` from: ${fromRel} (ee: ${hasEESegment(fromRel)})`); - console.error(` to: ${toRel} (ee: ${hasEESegment(toRel)})`); - process.exit(1); -} - -if (!fs.existsSync(fromAbs)) { - console.error(`Source does not exist: ${fromAbs}`); - process.exit(1); -} - -// A move can target either a directory (move all files within it) or a single -// file. For a single file, `--to` may be the full destination file path or a -// destination directory. -const isFileMove = fs.statSync(fromAbs).isFile(); - -// ── Helpers ────────────────────────────────────────────────────────────────── - -function getAllFiles(dir, exts = ['.ts', '.js', '.tsx', '.jsx']) { - const results = []; - if (!fs.existsSync(dir)) return results; - for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { - const full = path.join(dir, entry.name); - if (entry.isDirectory()) { - results.push(...getAllFiles(full, exts)); - } else if (exts.some((ext) => entry.name.endsWith(ext))) { - results.push(full); - } - } - return results; -} - -/** - * Given a file at `fromFile` that has `import ... from ''`, - * resolve that specifier to an absolute filesystem path. - * Returns null if it's not a relative import or can't be resolved. - */ -function resolveImportSpecifier(fromFile, specifier) { - if (!specifier.startsWith('.')) return null; // skip package imports - const dir = path.dirname(fromFile); - const resolved = path.resolve(dir, specifier); - // Try to find the actual file (could be .ts, /index.ts, etc.) - for (const candidate of [ - `${resolved}.ts`, - `${resolved}.tsx`, - `${resolved}.js`, - `${resolved}.jsx`, - path.join(resolved, 'index.ts'), - path.join(resolved, 'index.js'), - resolved, // exact match (rare) - ]) { - if (fs.existsSync(candidate)) return candidate; - } - // Return the resolved path even if we can't find the file - // (it might have been moved already) - return resolved; -} - -/** - * Compute a relative import specifier from `fromFile` to `targetAbs`. - * Strips extensions and /index suffix to match TypeScript conventions. - */ -function computeRelativeSpecifier(fromFile, targetAbs) { - const fromDir = path.dirname(fromFile); - let rel = path.relative(fromDir, targetAbs); - // Remove file extensions - rel = rel.replace(/\.(ts|tsx|js|jsx)$/, ''); - // Remove /index suffix - rel = rel.replace(/\/index$/, ''); - // Ensure it starts with ./ or ../ - if (!rel.startsWith('.')) { - rel = `./${rel}`; - } - return rel; -} - -// Regex to match import specifiers. Covers static `import x from 'y'`, -// re-exports `export { x } from 'y'`, bare `import 'y'`, dynamic `import('y')`, -// and CommonJS `require('y')`. -const IMPORT_RE = /(?:from\s+|import\s+|(?:import|require)\s*\(\s*)(['"])([^'"]+)\1/g; - -/** - * Update all relative imports in a file based on its old and new positions. - * `movedFiles` is a Map of all files being moved - * in the same operation, so we can resolve imports to co-moved siblings. - */ -function updateImportsInFile(filePath, oldFilePath, movedFiles = new Map()) { - let content = fs.readFileSync(filePath, 'utf8'); - let changed = false; - - content = content.replace(IMPORT_RE, (match, quote, specifier) => { - if (!specifier.startsWith('.')) return match; // skip package imports - - // Resolve the specifier relative to the OLD file location - let absoluteTarget = resolveImportSpecifier(oldFilePath, specifier); - if (!absoluteTarget) return match; - - // If the target also moved (sibling file in same module), use its new location - for (const [oldPath, newPath] of movedFiles) { - const oldNoExt = oldPath.replace(/\.(ts|tsx|js|jsx)$/, ''); - // Check exact match or match stripping extension - if (absoluteTarget === oldPath || absoluteTarget === oldNoExt) { - absoluteTarget = newPath; - break; - } - // Only treat as "inside a moved index dir" with a proper separator boundary - if (absoluteTarget.startsWith(oldNoExt + path.sep)) { - absoluteTarget = newPath + absoluteTarget.slice(oldPath.length); - break; - } - } - - // Compute new relative specifier from the NEW file location - const newSpecifier = computeRelativeSpecifier(filePath, absoluteTarget); - - if (newSpecifier !== specifier) { - changed = true; - return match.replace(specifier, newSpecifier); - } - return match; - }); - - if (changed) { - fs.writeFileSync(filePath, content, 'utf8'); - } - return changed; -} - -/** - * Check if a file imports from any path within the given directory. - * Returns the matched import specifiers. - */ -function findImportsFrom(filePath, targetDirAbs) { - const content = fs.readFileSync(filePath, 'utf8'); - const matches = []; - let m; - const re = new RegExp(IMPORT_RE.source, 'g'); - while ((m = re.exec(content)) !== null) { - const specifier = m[2]; - if (!specifier.startsWith('.')) continue; - const resolved = resolveImportSpecifier(filePath, specifier); - if (resolved && (resolved === targetDirAbs || resolved.startsWith(targetDirAbs + path.sep))) { - matches.push({ specifier, resolved }); - } - } - return matches; -} - -/** - * Update imports in external files that reference the moved module. - * `oldRef`/`newRef` are the old and new absolute paths — a directory for a dir - * move, or a file path for a single-file move. - * - * This runs AFTER `git mv`, so the source no longer exists on disk and - * `resolveImportSpecifier` returns an extensionless fallback path. We therefore - * compare with extensions stripped rather than relying on the exact resolved path. - */ -function updateExternalImports(externalFile, oldRef, newRef) { - const stripExt = (p) => p.replace(/\.(ts|tsx|js|jsx)$/, ''); - const oldRefNoExt = stripExt(oldRef); - // When the moved file is a directory's `index`, importers may reference the - // directory itself (e.g. `import '../api/server'`). Post-`git mv` the index - // is gone, so resolution falls back to the bare directory path — match that too. - // Use path.basename so this is separator-safe (a directory-index move on - // Windows resolves oldRef with `\` separators, which a hardcoded `/` misses). - const oldIsIndex = /^index\.(ts|tsx|js|jsx)$/.test(path.basename(oldRef)); - const oldRefDir = path.dirname(oldRef); - - let content = fs.readFileSync(externalFile, 'utf8'); - let changed = false; - - content = content.replace(IMPORT_RE, (match, quote, specifier) => { - if (!specifier.startsWith('.')) return match; - - const resolved = resolveImportSpecifier(externalFile, specifier); - if (!resolved) return match; - - let newAbsolute; - if (stripExt(resolved) === oldRefNoExt || (oldIsIndex && resolved === oldRefDir)) { - // Exact match: the moved file/dir-root itself, or the directory whose - // index file was moved. - newAbsolute = newRef; - } else if (resolved.startsWith(oldRef + path.sep)) { - // A file inside the moved directory — preserve its relative offset. - newAbsolute = path.join(newRef, path.relative(oldRef, resolved)); - } else { - return match; - } - - const newSpecifier = computeRelativeSpecifier(externalFile, newAbsolute); - if (newSpecifier !== specifier) { - changed = true; - return match.replace(specifier, newSpecifier); - } - return match; - }); - - if (changed) { - fs.writeFileSync(externalFile, content, 'utf8'); - } - return changed; -} - -// ── Main ───────────────────────────────────────────────────────────────────── - -console.log(`Moving: ${fromRel} → ${toRel}`); - -// 1. Collect files to move and build the old→new path mapping. -// `oldRef`/`newRef` are the absolute path prefixes used to match external -// imports — the directory itself for a dir move, or the file path for a single -// file (in which case only an exact match counts). -const pathMap = new Map(); // oldAbsPath → newAbsPath -const oldRef = fromAbs; -let newRef = toAbs; - -if (isFileMove) { - // `--to` is a file path if it carries a known extension, otherwise a dir. - const toLooksLikeFile = /\.(ts|tsx|js|jsx)$/.test(toRel); - const newFile = toLooksLikeFile ? toAbs : path.join(toAbs, path.basename(fromAbs)); - pathMap.set(fromAbs, newFile); - newRef = newFile; - console.log(' Single-file move'); -} else { - const filesToMove = getAllFiles(fromAbs); - if (filesToMove.length === 0) { - console.error('No .ts/.js files found in source directory'); - process.exit(1); - } - console.log(` Found ${filesToMove.length} files to move`); - for (const oldFile of filesToMove) { - const relToFrom = path.relative(fromAbs, oldFile); - const newFile = path.join(toAbs, relToFrom); - pathMap.set(oldFile, newFile); - } -} - -// 3. Find external files that import from the old location -console.log(' Scanning for external files that import from the moved module...'); -// `tests` is included so unit/e2e tests that import the moved module (or mirror -// its path) get their specifiers rewritten too — otherwise `tsc` later fails. -// `imports` (personal-access-tokens et al.) also imports server code — missing it -// left stale specifiers that only `tsc` caught (found during Phase 4). -const searchDirs = ['app', 'server', 'ee', 'lib', 'tests', 'imports', 'client', 'definition', 'packages'].map((d) => path.join(ROOT, d)); -const externalFiles = []; -for (const dir of searchDirs) { - if (fs.existsSync(dir)) { - externalFiles.push(...getAllFiles(dir)); - } -} - -const affectedExternalFiles = []; -for (const ext of externalFiles) { - if (pathMap.has(ext)) continue; // skip files being moved - const imports = findImportsFrom(ext, oldRef); - if (imports.length > 0) { - affectedExternalFiles.push(ext); - } -} -if (affectedExternalFiles.length > 0) { - console.log(` Found ${affectedExternalFiles.length} external files with imports to update`); -} - -// 4. Move files with git mv -if (!dryRun) { - // Create destination directories - for (const [, newFile] of pathMap) { - fs.mkdirSync(path.dirname(newFile), { recursive: true }); - } - - for (const [oldFile, newFile] of pathMap) { - execFileSync('git', ['mv', oldFile, newFile], { cwd: ROOT, stdio: 'pipe' }); - } - console.log(` Moved ${pathMap.size} files`); -} else { - console.log(' [DRY RUN] Would move:'); - for (const [oldFile, newFile] of pathMap) { - console.log(` ${path.relative(ROOT, oldFile)} → ${path.relative(ROOT, newFile)}`); - } -} - -// 5. Update imports WITHIN moved files -if (!dryRun) { - let updatedCount = 0; - for (const [oldFile, newFile] of pathMap) { - if (updateImportsInFile(newFile, oldFile, pathMap)) { - updatedCount++; - } - } - console.log(` Updated imports in ${updatedCount} moved files`); -} - -// 6. Update imports in external files -if (!dryRun) { - let updatedExternal = 0; - for (const ext of affectedExternalFiles) { - if (updateExternalImports(ext, oldRef, newRef)) { - updatedExternal++; - } - } - if (updatedExternal > 0) { - console.log(` Updated imports in ${updatedExternal} external files`); - } -} - -// 7. Clean up empty source directory (directory moves only) -if (!dryRun && !isFileMove) { - // Remove the now-empty source directory (if it's truly empty after git mv) - try { - const remaining = fs.readdirSync(fromAbs); - if (remaining.length === 0) { - fs.rmdirSync(fromAbs); - console.log(` Removed empty directory: ${fromRel}`); - } - } catch { - // Directory might already be gone - } -} - -console.log('Done.\n'); diff --git a/apps/meteor/scripts/migration/phase1-commands.tsv b/apps/meteor/scripts/migration/phase1-commands.tsv deleted file mode 100644 index 9dd53cc2bf36a..0000000000000 --- a/apps/meteor/scripts/migration/phase1-commands.tsv +++ /dev/null @@ -1,20 +0,0 @@ -# Phase 1: Slash commands migration -# Format: old-pathnew-path (relative to apps/meteor/) -app/slashcommand-asciiarts/server server/slashcommands/asciiarts -app/slashcommands-archiveroom/server server/slashcommands/archiveroom -app/slashcommands-ban/server server/slashcommands/ban -app/slashcommands-create/server server/slashcommands/create -app/slashcommands-help/server server/slashcommands/help -app/slashcommands-hide/server server/slashcommands/hide -app/slashcommands-invite/server server/slashcommands/invite -app/slashcommands-inviteall/server server/slashcommands/inviteall -app/slashcommands-join/server server/slashcommands/join -app/slashcommands-kick/server server/slashcommands/kick -app/slashcommands-leave/server server/slashcommands/leave -app/slashcommands-me/server server/slashcommands/me -app/slashcommands-msg/server server/slashcommands/msg -app/slashcommands-mute/server server/slashcommands/mute -app/slashcommands-status/server server/slashcommands/status -app/slashcommands-topic/server server/slashcommands/topic -app/slashcommands-unarchiveroom/server server/slashcommands/unarchiveroom -app/bot-helpers/server server/lib/bot-helpers diff --git a/apps/meteor/scripts/migration/phase2-bridges.tsv b/apps/meteor/scripts/migration/phase2-bridges.tsv deleted file mode 100644 index 53f01a189d825..0000000000000 --- a/apps/meteor/scripts/migration/phase2-bridges.tsv +++ /dev/null @@ -1,7 +0,0 @@ -# Phase 2: External bridges migration -# Format: old-pathnew-path (relative to apps/meteor/) -app/irc/server server/bridges/irc -app/slackbridge/server server/bridges/slack -app/smarsh-connector/server server/bridges/smarsh -app/webdav/server server/bridges/webdav -app/nextcloud/server server/bridges/nextcloud diff --git a/apps/meteor/scripts/migration/phase4-ee-authorization.tsv b/apps/meteor/scripts/migration/phase4-ee-authorization.tsv deleted file mode 100644 index ea8fbb5d27f46..0000000000000 --- a/apps/meteor/scripts/migration/phase4-ee-authorization.tsv +++ /dev/null @@ -1,6 +0,0 @@ -# Phase 4 EE mirror: EE authorization functions migration (stays inside ee/) -# callback.ts (hook, Phase 6b) and index.ts (aggregator) stay behind for later phases. -# Format: old-pathnew-path (relative to apps/meteor/) -ee/app/authorization/server/validateUserRoles.ts ee/server/lib/authorization/validateUserRoles.ts -ee/app/authorization/server/validateUserRoles.spec.ts ee/server/lib/authorization/validateUserRoles.spec.ts -ee/app/authorization/server/resetEnterprisePermissions.ts ee/server/lib/authorization/resetEnterprisePermissions.ts diff --git a/apps/meteor/scripts/migration/phase4-test-mirrors.tsv b/apps/meteor/scripts/migration/phase4-test-mirrors.tsv deleted file mode 100644 index d7bb8ffed8e6a..0000000000000 --- a/apps/meteor/scripts/migration/phase4-test-mirrors.tsv +++ /dev/null @@ -1,17 +0,0 @@ -# Phase 4 follow-up: relocate tests/unit mirrors of modules moved in Phases 3-4 -# so the tests/unit tree keeps mirroring the source tree. -# Format: old-pathnew-path (relative to apps/meteor/) -tests/unit/app/api/server/v1/lib/checkPermissions.spec.ts tests/unit/server/api/checkPermissions.spec.ts -tests/unit/app/api/server/v1/lib/checkPermissionsForInvocation.spec.ts tests/unit/server/api/checkPermissionsForInvocation.spec.ts -tests/unit/app/api/server/v1/lib/isValidQuery.spec.ts tests/unit/server/api/lib/isValidQuery.spec.ts -tests/unit/app/cloud/server/functions/syncWorkspace/syncCloudData.spec.ts tests/unit/server/lib/cloud/syncWorkspace/syncCloudData.spec.ts -tests/unit/app/lib/server/functions/banUserFromRoom.spec.ts tests/unit/server/lib/rooms/banUserFromRoom.spec.ts -tests/unit/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.spec.ts tests/unit/server/lib/rooms/getRoomByNameOrIdWithOptionToJoin.spec.ts -tests/unit/app/lib/server/functions/closeLivechatRoom.tests.ts tests/unit/server/lib/omnichannel/closeLivechatRoom.tests.ts -tests/unit/app/lib/server/functions/extractMentionsFromMessageAST.spec.ts tests/unit/server/lib/messages/extractMentionsFromMessageAST.spec.ts -tests/unit/app/lib/server/functions/disableCustomScripts.tests.ts tests/unit/server/lib/shared/disableCustomScripts.tests.ts -tests/unit/app/lib/server/functions/getModifiedHttpHeaders.tests.ts tests/unit/server/lib/shared/getModifiedHttpHeaders.tests.ts -tests/unit/app/lib/server/lib/validateNameChars.tests.ts tests/unit/server/lib/shared/validateNameChars.tests.ts -tests/unit/app/lib/server/functions/setUsername.spec.ts tests/unit/server/lib/users/setUsername.spec.ts -tests/unit/app/lib/server/functions/validateUsername.spec.ts tests/unit/server/lib/users/validateUsername.spec.ts -tests/unit/app/lib/server/functions/sendUserEmail.spec.ts tests/unit/server/lib/users/saveUser/sendUserEmail.spec.ts diff --git a/apps/meteor/scripts/migration/phase4a-users.tsv b/apps/meteor/scripts/migration/phase4a-users.tsv deleted file mode 100644 index f91392aba3906..0000000000000 --- a/apps/meteor/scripts/migration/phase4a-users.tsv +++ /dev/null @@ -1,26 +0,0 @@ -# Phase 4a: User functions migration -# Format: old-pathnew-path (relative to apps/meteor/) -app/lib/server/functions/setRealName.ts server/lib/users/setRealName.ts -app/lib/server/functions/setUsername.ts server/lib/users/setUsername.ts -app/lib/server/functions/setEmail.ts server/lib/users/setEmail.ts -app/lib/server/functions/saveUserIdentity.ts server/lib/users/saveUserIdentity.ts -app/lib/server/functions/setUserAvatar.ts server/lib/users/setUserAvatar.ts -app/lib/server/functions/setUserActiveStatus.ts server/lib/users/setUserActiveStatus.ts -app/lib/server/functions/setStatusText.ts server/lib/users/setStatusText.ts -app/lib/server/functions/getStatusText.ts server/lib/users/getStatusText.ts -app/lib/server/functions/deleteUser.ts server/lib/users/deleteUser.ts -app/lib/server/functions/getFullUserData.ts server/lib/users/getFullUserData.ts -app/lib/server/functions/getUsernameSuggestion.ts server/lib/users/getUsernameSuggestion.ts -app/lib/server/functions/getUserCreatedByApp.ts server/lib/users/getUserCreatedByApp.ts -app/lib/server/functions/getUserSingleOwnedRooms.ts server/lib/users/getUserSingleOwnedRooms.ts -app/lib/server/functions/getAvatarSuggestionForUser.ts server/lib/users/getAvatarSuggestionForUser.ts -app/lib/server/functions/checkEmailAvailability.ts server/lib/users/checkEmailAvailability.ts -app/lib/server/functions/checkUsernameAvailability.ts server/lib/users/checkUsernameAvailability.ts -app/lib/server/functions/validateUsername.ts server/lib/users/validateUsername.ts -app/lib/server/functions/saveCustomFields.ts server/lib/users/saveCustomFields.ts -app/lib/server/functions/saveCustomFieldsWithoutValidation.ts server/lib/users/saveCustomFieldsWithoutValidation.ts -app/lib/server/functions/validateCustomFields.js server/lib/users/validateCustomFields.js -app/lib/server/functions/blockUser.ts server/lib/users/blockUser.ts -app/lib/server/functions/unblockUser.ts server/lib/users/unblockUser.ts -app/lib/server/functions/unarchiveUserSubscriptions.ts server/lib/users/unarchiveUserSubscriptions.ts -app/lib/server/functions/saveUser server/lib/users/saveUser diff --git a/apps/meteor/scripts/migration/phase4b-rooms.tsv b/apps/meteor/scripts/migration/phase4b-rooms.tsv deleted file mode 100644 index a704e947804e6..0000000000000 --- a/apps/meteor/scripts/migration/phase4b-rooms.tsv +++ /dev/null @@ -1,21 +0,0 @@ -# Phase 4b: Room functions migration -# Format: old-pathnew-path (relative to apps/meteor/) -app/lib/server/functions/createRoom.ts server/lib/rooms/createRoom.ts -app/lib/server/functions/createDirectRoom.ts server/lib/rooms/createDirectRoom.ts -app/lib/server/functions/deleteRoom.ts server/lib/rooms/deleteRoom.ts -app/lib/server/functions/archiveRoom.ts server/lib/rooms/archiveRoom.ts -app/lib/server/functions/unarchiveRoom.ts server/lib/rooms/unarchiveRoom.ts -app/lib/server/functions/addUserToRoom.ts server/lib/rooms/addUserToRoom.ts -app/lib/server/functions/addUserToDefaultChannels.ts server/lib/rooms/addUserToDefaultChannels.ts -app/lib/server/functions/getDefaultChannels.ts server/lib/rooms/getDefaultChannels.ts -app/lib/server/functions/removeUserFromRoom.ts server/lib/rooms/removeUserFromRoom.ts -app/lib/server/functions/acceptRoomInvite.ts server/lib/rooms/acceptRoomInvite.ts -app/lib/server/functions/cleanRoomHistory.ts server/lib/rooms/cleanRoomHistory.ts -app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.ts server/lib/rooms/getRoomByNameOrIdWithOptionToJoin.ts -app/lib/server/functions/getRoomsWithSingleOwner.ts server/lib/rooms/getRoomsWithSingleOwner.ts -app/lib/server/functions/joinDefaultChannels.ts server/lib/rooms/joinDefaultChannels.ts -app/lib/server/functions/relinquishRoomOwnerships.ts server/lib/rooms/relinquishRoomOwnerships.ts -app/lib/server/functions/setRoomAvatar.ts server/lib/rooms/setRoomAvatar.ts -app/lib/server/functions/updateGroupDMsName.ts server/lib/rooms/updateGroupDMsName.ts -app/lib/server/functions/banUserFromRoom.ts server/lib/rooms/banUserFromRoom.ts -app/lib/server/functions/executeUnbanUserFromRoom.ts server/lib/rooms/executeUnbanUserFromRoom.ts diff --git a/apps/meteor/scripts/migration/phase4c-messages.tsv b/apps/meteor/scripts/migration/phase4c-messages.tsv deleted file mode 100644 index a1089a06fc646..0000000000000 --- a/apps/meteor/scripts/migration/phase4c-messages.tsv +++ /dev/null @@ -1,14 +0,0 @@ -# Phase 4c: Message functions migration -# Format: old-pathnew-path (relative to apps/meteor/) -app/lib/server/functions/sendMessage.ts server/lib/messages/sendMessage.ts -app/lib/server/functions/insertMessage.ts server/lib/messages/insertMessage.ts -app/lib/server/functions/deleteMessage.ts server/lib/messages/deleteMessage.ts -app/lib/server/functions/updateMessage.ts server/lib/messages/updateMessage.ts -app/lib/server/functions/loadMessageHistory.ts server/lib/messages/loadMessageHistory.ts -app/lib/server/functions/processWebhookMessage.ts server/lib/messages/processWebhookMessage.ts -app/lib/server/functions/parseUrlsInMessage.ts server/lib/messages/parseUrlsInMessage.ts -app/lib/server/functions/attachMessage.ts server/lib/messages/attachMessage.ts -app/lib/server/functions/isTheLastMessage.ts server/lib/messages/isTheLastMessage.ts -app/lib/server/functions/extractUrlsFromMessageAST.ts server/lib/messages/extractUrlsFromMessageAST.ts -app/lib/server/functions/extractUrlsFromMessageAST.spec.ts server/lib/messages/extractUrlsFromMessageAST.spec.ts -app/lib/server/functions/extractMentionsFromMessageAST.ts server/lib/messages/extractMentionsFromMessageAST.ts diff --git a/apps/meteor/scripts/migration/phase4d-other.tsv b/apps/meteor/scripts/migration/phase4d-other.tsv deleted file mode 100644 index 68a9bd4206f7d..0000000000000 --- a/apps/meteor/scripts/migration/phase4d-other.tsv +++ /dev/null @@ -1,11 +0,0 @@ -# Phase 4d: Other domain functions migration -# Format: old-pathnew-path (relative to apps/meteor/) -app/lib/server/functions/closeLivechatRoom.ts server/lib/omnichannel/closeLivechatRoom.ts -app/lib/server/functions/closeOmnichannelConversations.ts server/lib/omnichannel/closeOmnichannelConversations.ts -app/lib/server/functions/syncRolePrioritiesForRoomIfRequired.ts server/lib/rooms/syncRolePrioritiesForRoomIfRequired.ts -app/lib/server/functions/validateName.ts server/lib/shared/validateName.ts -app/lib/server/functions/validateNameChars.ts server/lib/shared/validateNameChars.ts -app/lib/server/functions/getModifiedHttpHeaders.ts server/lib/shared/getModifiedHttpHeaders.ts -app/lib/server/functions/disableCustomScripts.ts server/lib/shared/disableCustomScripts.ts -app/authorization/server/functions server/lib/authorization -app/cloud/server/functions server/lib/cloud diff --git a/apps/meteor/scripts/migration/phase5-ee-methods.tsv b/apps/meteor/scripts/migration/phase5-ee-methods.tsv deleted file mode 100644 index 2409e93c6de6e..0000000000000 --- a/apps/meteor/scripts/migration/phase5-ee-methods.tsv +++ /dev/null @@ -1,7 +0,0 @@ -# Phase 5 EE mirror: methods → ee/server/meteor-methods -# Format: old-pathnew-path (relative to apps/meteor/) -ee/server/methods ee/server/meteor-methods -ee/app/canned-responses/server/methods/saveCannedResponse.ts ee/server/meteor-methods/saveCannedResponse.ts -ee/app/canned-responses/server/methods/removeCannedResponse.ts ee/server/meteor-methods/removeCannedResponse.ts -ee/app/license/server/methods.ts ee/server/meteor-methods/license.ts -ee/app/livechat-enterprise/server/methods/removeBusinessHour.ts ee/server/meteor-methods/omnichannel/removeBusinessHour.ts diff --git a/apps/meteor/scripts/migration/phase5a-flat-methods.tsv b/apps/meteor/scripts/migration/phase5a-flat-methods.tsv deleted file mode 100644 index 2843d189279c1..0000000000000 --- a/apps/meteor/scripts/migration/phase5a-flat-methods.tsv +++ /dev/null @@ -1,49 +0,0 @@ -# Phase 5a: existing flat server/meteor-methods files → domain subfolders -# Format: old-pathnew-path (relative to apps/meteor/) -server/meteor-methods/deleteUser.ts server/meteor-methods/users/deleteUser.ts -server/meteor-methods/setUserActiveStatus.ts server/meteor-methods/users/setUserActiveStatus.ts -server/meteor-methods/registerUser.ts server/meteor-methods/users/registerUser.ts -server/meteor-methods/resetAvatar.ts server/meteor-methods/users/resetAvatar.ts -server/meteor-methods/setAvatarFromService.ts server/meteor-methods/users/setAvatarFromService.ts -server/meteor-methods/saveUserPreferences.ts server/meteor-methods/users/saveUserPreferences.ts -server/meteor-methods/saveUserProfile.ts server/meteor-methods/users/saveUserProfile.ts -server/meteor-methods/getUsersOfRoom.ts server/meteor-methods/users/getUsersOfRoom.ts -server/meteor-methods/userPresence.ts server/meteor-methods/users/userPresence.ts -server/meteor-methods/userSetUtcOffset.ts server/meteor-methods/users/userSetUtcOffset.ts -server/meteor-methods/ignoreUser.ts server/meteor-methods/users/ignoreUser.ts -server/meteor-methods/addAllUserToRoom.ts server/meteor-methods/rooms/addAllUserToRoom.ts -server/meteor-methods/addRoomLeader.ts server/meteor-methods/rooms/addRoomLeader.ts -server/meteor-methods/addRoomModerator.ts server/meteor-methods/rooms/addRoomModerator.ts -server/meteor-methods/addRoomOwner.ts server/meteor-methods/rooms/addRoomOwner.ts -server/meteor-methods/removeRoomLeader.ts server/meteor-methods/rooms/removeRoomLeader.ts -server/meteor-methods/removeRoomModerator.ts server/meteor-methods/rooms/removeRoomModerator.ts -server/meteor-methods/removeRoomOwner.ts server/meteor-methods/rooms/removeRoomOwner.ts -server/meteor-methods/removeUserFromRoom.ts server/meteor-methods/rooms/removeUserFromRoom.ts -server/meteor-methods/getRoomById.ts server/meteor-methods/rooms/getRoomById.ts -server/meteor-methods/getRoomIdByNameOrId.ts server/meteor-methods/rooms/getRoomIdByNameOrId.ts -server/meteor-methods/getRoomNameById.ts server/meteor-methods/rooms/getRoomNameById.ts -server/meteor-methods/browseChannels.ts server/meteor-methods/rooms/browseChannels.ts -server/meteor-methods/channelsList.ts server/meteor-methods/rooms/channelsList.ts -server/meteor-methods/getTotalChannels.ts server/meteor-methods/rooms/getTotalChannels.ts -server/meteor-methods/hideRoom.ts server/meteor-methods/rooms/hideRoom.ts -server/meteor-methods/openRoom.ts server/meteor-methods/rooms/openRoom.ts -server/meteor-methods/toggleFavorite.ts server/meteor-methods/rooms/toggleFavorite.ts -server/meteor-methods/muteUserInRoom.ts server/meteor-methods/rooms/muteUserInRoom.ts -server/meteor-methods/unmuteUserInRoom.ts server/meteor-methods/rooms/unmuteUserInRoom.ts -server/meteor-methods/createDirectMessage.ts server/meteor-methods/messages/createDirectMessage.ts -server/meteor-methods/deleteFileMessage.ts server/meteor-methods/messages/deleteFileMessage.ts -server/meteor-methods/messageSearch.ts server/meteor-methods/messages/messageSearch.ts -server/meteor-methods/loadHistory.ts server/meteor-methods/messages/loadHistory.ts -server/meteor-methods/loadMissedMessages.ts server/meteor-methods/messages/loadMissedMessages.ts -server/meteor-methods/loadNextMessages.ts server/meteor-methods/messages/loadNextMessages.ts -server/meteor-methods/loadSurroundingMessages.ts server/meteor-methods/messages/loadSurroundingMessages.ts -server/meteor-methods/readMessages.ts server/meteor-methods/messages/readMessages.ts -server/meteor-methods/readThreads.ts server/meteor-methods/messages/readThreads.ts -server/meteor-methods/afterVerifyEmail.ts server/meteor-methods/auth/afterVerifyEmail.ts -server/meteor-methods/sendConfirmationEmail.ts server/meteor-methods/auth/sendConfirmationEmail.ts -server/meteor-methods/sendForgotPasswordEmail.ts server/meteor-methods/auth/sendForgotPasswordEmail.ts -server/meteor-methods/logoutCleanUp.ts server/meteor-methods/auth/logoutCleanUp.ts -server/meteor-methods/getSetupWizardParameters.ts server/meteor-methods/settings/getSetupWizardParameters.ts -server/meteor-methods/loadLocale.ts server/meteor-methods/platform/loadLocale.ts -server/meteor-methods/OEmbedCacheCleanup.ts server/meteor-methods/platform/OEmbedCacheCleanup.ts -server/meteor-methods/requestDataDownload.ts server/meteor-methods/platform/requestDataDownload.ts diff --git a/apps/meteor/scripts/migration/phase5b-lib-methods.tsv b/apps/meteor/scripts/migration/phase5b-lib-methods.tsv deleted file mode 100644 index 4cf4b4331ef0b..0000000000000 --- a/apps/meteor/scripts/migration/phase5b-lib-methods.tsv +++ /dev/null @@ -1,37 +0,0 @@ -# Phase 5b: app/lib/server/methods → server/meteor-methods/ -# Format: old-pathnew-path (relative to apps/meteor/) -app/lib/server/methods/setRealName.ts server/meteor-methods/users/setRealName.ts -app/lib/server/methods/setEmail.ts server/meteor-methods/users/setEmail.ts -app/lib/server/methods/blockUser.ts server/meteor-methods/users/blockUser.ts -app/lib/server/methods/unblockUser.ts server/meteor-methods/users/unblockUser.ts -app/lib/server/methods/deleteUserOwnAccount.ts server/meteor-methods/users/deleteUserOwnAccount.ts -app/lib/server/methods/getUsernameSuggestion.ts server/meteor-methods/users/getUsernameSuggestion.ts -app/lib/server/methods/createChannel.ts server/meteor-methods/rooms/createChannel.ts -app/lib/server/methods/createPrivateGroup.ts server/meteor-methods/rooms/createPrivateGroup.ts -app/lib/server/methods/addUserToRoom.ts server/meteor-methods/rooms/addUserToRoom.ts -app/lib/server/methods/addUsersToRoom.ts server/meteor-methods/rooms/addUsersToRoom.ts -app/lib/server/methods/archiveRoom.ts server/meteor-methods/rooms/archiveRoom.ts -app/lib/server/methods/unarchiveRoom.ts server/meteor-methods/rooms/unarchiveRoom.ts -app/lib/server/methods/leaveRoom.ts server/meteor-methods/rooms/leaveRoom.ts -app/lib/server/methods/joinRoom.ts server/meteor-methods/rooms/joinRoom.ts -app/lib/server/methods/joinDefaultChannels.ts server/meteor-methods/rooms/joinDefaultChannels.ts -app/lib/server/methods/cleanRoomHistory.ts server/meteor-methods/rooms/cleanRoomHistory.ts -app/lib/server/methods/getRoomJoinCode.ts server/meteor-methods/rooms/getRoomJoinCode.ts -app/lib/server/methods/getRoomRoles.ts server/meteor-methods/rooms/getRoomRoles.ts -app/lib/server/methods/sendMessage.ts server/meteor-methods/messages/sendMessage.ts -app/lib/server/methods/updateMessage.ts server/meteor-methods/messages/updateMessage.ts -app/lib/server/methods/getChannelHistory.ts server/meteor-methods/messages/getChannelHistory.ts -app/lib/server/methods/getMessages.ts server/meteor-methods/messages/getMessages.ts -app/lib/server/methods/getSingleMessage.ts server/meteor-methods/messages/getSingleMessage.ts -app/lib/server/methods/executeSlashCommandPreview.ts server/meteor-methods/messages/executeSlashCommandPreview.ts -app/lib/server/methods/getSlashCommandPreviews.ts server/meteor-methods/messages/getSlashCommandPreviews.ts -app/lib/server/methods/addOAuthService.ts server/meteor-methods/auth/addOAuthService.ts -app/lib/server/methods/refreshOAuthService.ts server/meteor-methods/auth/refreshOAuthService.ts -app/lib/server/methods/removeOAuthService.ts server/meteor-methods/auth/removeOAuthService.ts -app/lib/server/methods/createToken.ts server/meteor-methods/auth/createToken.ts -app/lib/server/methods/checkRegistrationSecretURL.ts server/meteor-methods/auth/checkRegistrationSecretURL.ts -app/lib/server/methods/saveSetting.ts server/meteor-methods/settings/saveSetting.ts -app/lib/server/methods/saveSettings.ts server/meteor-methods/settings/saveSettings.ts -app/lib/server/methods/sendSMTPTestEmail.ts server/meteor-methods/settings/sendSMTPTestEmail.ts -app/lib/server/methods/restartServer.ts server/meteor-methods/platform/restartServer.ts -app/lib/server/methods/checkFederationConfiguration.ts server/meteor-methods/platform/checkFederationConfiguration.ts diff --git a/apps/meteor/scripts/migration/phase5c-feature-methods.tsv b/apps/meteor/scripts/migration/phase5c-feature-methods.tsv deleted file mode 100644 index f31a0814eeaf6..0000000000000 --- a/apps/meteor/scripts/migration/phase5c-feature-methods.tsv +++ /dev/null @@ -1,33 +0,0 @@ -# Phase 5c: feature methods → server/meteor-methods/ -# Format: old-pathnew-path (relative to apps/meteor/) -app/authorization/server/methods/addPermissionToRole.ts server/meteor-methods/auth/addPermissionToRole.ts -app/authorization/server/methods/addUserToRole.ts server/meteor-methods/auth/addUserToRole.ts -app/authorization/server/methods/removeRoleFromPermission.ts server/meteor-methods/auth/removeRoleFromPermission.ts -app/authorization/server/methods/removeUserFromRole.ts server/meteor-methods/auth/removeUserFromRole.ts -app/2fa/server/methods/checkCodesRemaining.ts server/meteor-methods/auth/checkCodesRemaining.ts -app/2fa/server/methods/disable.ts server/meteor-methods/auth/disable.ts -app/2fa/server/methods/enable.ts server/meteor-methods/auth/enable.ts -app/2fa/server/methods/regenerateCodes.ts server/meteor-methods/auth/regenerateCodes.ts -app/2fa/server/methods/validateTempToken.ts server/meteor-methods/auth/validateTempToken.ts -app/channel-settings/server/methods/saveRoomSettings.ts server/meteor-methods/rooms/saveRoomSettings.ts -app/threads/server/methods/followMessage.ts server/meteor-methods/messages/followMessage.ts -app/threads/server/methods/getThreadMessages.ts server/meteor-methods/messages/getThreadMessages.ts -app/threads/server/methods/getThreadsList.ts server/meteor-methods/messages/getThreadsList.ts -app/threads/server/methods/unfollowMessage.ts server/meteor-methods/messages/unfollowMessage.ts -app/discussion/server/methods/createDiscussion.ts server/meteor-methods/messages/createDiscussion.ts -app/livechat/server/methods/saveBusinessHour.ts server/meteor-methods/omnichannel/saveBusinessHour.ts -app/livechat/server/methods/sendFileLivechatMessage.ts server/meteor-methods/omnichannel/sendFileLivechatMessage.ts -app/livechat/server/methods/sendMessageLivechat.ts server/meteor-methods/omnichannel/sendMessageLivechat.ts -app/integrations/server/methods server/meteor-methods/integrations -app/importer/server/methods server/meteor-methods/import -app/autotranslate/server/methods/getProviderUiMetadata.ts server/meteor-methods/platform/getProviderUiMetadata.ts -app/autotranslate/server/methods/getSupportedLanguages.ts server/meteor-methods/platform/getSupportedLanguages.ts -app/autotranslate/server/methods/saveSettings.ts server/meteor-methods/platform/saveSettings.ts -app/autotranslate/server/methods/translateMessage.ts server/meteor-methods/platform/translateMessage.ts -app/e2e/server/methods/fetchMyKeys.ts server/meteor-methods/platform/fetchMyKeys.ts -app/e2e/server/methods/getUsersOfRoomWithoutKey.ts server/meteor-methods/platform/getUsersOfRoomWithoutKey.ts -app/e2e/server/methods/requestSubscriptionKeys.ts server/meteor-methods/platform/requestSubscriptionKeys.ts -app/e2e/server/methods/resetOwnE2EKey.ts server/meteor-methods/platform/resetOwnE2EKey.ts -app/e2e/server/methods/setRoomKeyID.ts server/meteor-methods/platform/setRoomKeyID.ts -app/e2e/server/methods/setUserPublicAndPrivateKeys.ts server/meteor-methods/platform/setUserPublicAndPrivateKeys.ts -app/e2e/server/methods/updateGroupKey.ts server/meteor-methods/platform/updateGroupKey.ts diff --git a/apps/meteor/scripts/migration/phase6a-auth-providers.tsv b/apps/meteor/scripts/migration/phase6a-auth-providers.tsv deleted file mode 100644 index 67f84fe282b7f..0000000000000 --- a/apps/meteor/scripts/migration/phase6a-auth-providers.tsv +++ /dev/null @@ -1,31 +0,0 @@ -# Phase 6a: auth providers → server/lib/auth-providers/ (+ methods → server/meteor-methods/) -# Format: old-pathnew-path (relative to apps/meteor/) -app/apple/server server/lib/auth-providers/apple -app/crowd/server/crowd.ts server/lib/auth-providers/crowd/crowd.ts -app/crowd/server/logger.ts server/lib/auth-providers/crowd/logger.ts -app/crowd/server/methods.ts server/meteor-methods/auth/crowd.ts -app/custom-oauth/server server/lib/auth-providers/custom-oauth -app/dolphin/server/lib.ts server/lib/auth-providers/dolphin.ts -app/drupal/server/lib.ts server/lib/auth-providers/drupal.ts -app/github/server/lib.ts server/lib/auth-providers/github.ts -app/github-enterprise/server/lib.ts server/lib/auth-providers/github-enterprise.ts -app/gitlab/server/lib.ts server/lib/auth-providers/gitlab.ts -app/google-oauth/server/index.js server/lib/auth-providers/google.js -app/iframe-login/server/iframe_server.ts server/lib/auth-providers/iframe.ts -app/wordpress/server/lib.ts server/lib/auth-providers/wordpress.ts -app/lib/server/oauth/facebook.js server/lib/auth-providers/oauth/facebook.js -app/lib/server/oauth/google.js server/lib/auth-providers/oauth/google.js -app/lib/server/oauth/oauth.js server/lib/auth-providers/oauth/oauth.js -app/lib/server/oauth/proxy.js server/lib/auth-providers/oauth/proxy.js -app/lib/server/oauth/twitter.js server/lib/auth-providers/oauth/twitter.js -app/meteor-accounts-saml/server/methods/addSamlService.ts server/meteor-methods/auth/addSamlService.ts -app/meteor-accounts-saml/server/methods/samlLogout.ts server/meteor-methods/auth/samlLogout.ts -app/meteor-accounts-saml/server server/lib/saml -app/2fa/server server/lib/2fa -app/token-login/server/login_token_server.js server/lib/auth/token-login.js -app/authentication/server/ILoginAttempt.ts server/lib/auth/ILoginAttempt.ts -app/authentication/server/lib/logLoginAttempts.ts server/lib/auth/logLoginAttempts.ts -app/authentication/server/lib/restrictLoginAttempts.ts server/lib/auth/restrictLoginAttempts.ts -app/authentication/server/startup/index.js server/lib/auth/startup.js -tests/unit/app/custom-oauth/server/transform_helpers.tests.js tests/unit/server/lib/auth-providers/custom-oauth/transform_helpers.tests.js -tests/unit/app/meteor-accounts-saml tests/unit/server/lib/saml diff --git a/apps/meteor/scripts/migration/phase6a-followup-oauth.tsv b/apps/meteor/scripts/migration/phase6a-followup-oauth.tsv deleted file mode 100644 index 1c777c9a797ef..0000000000000 --- a/apps/meteor/scripts/migration/phase6a-followup-oauth.tsv +++ /dev/null @@ -1,3 +0,0 @@ -# Phase 6a follow-up: OAuth providers missed by the plan table -app/linkedin/server/lib.ts server/lib/auth-providers/linkedin.ts -app/meteor-developer/server/lib.ts server/lib/auth-providers/meteor-developer.ts diff --git a/apps/meteor/scripts/migration/phase6b-ee-hooks.tsv b/apps/meteor/scripts/migration/phase6b-ee-hooks.tsv deleted file mode 100644 index 46c17cd0f91bc..0000000000000 --- a/apps/meteor/scripts/migration/phase6b-ee-hooks.tsv +++ /dev/null @@ -1,8 +0,0 @@ -# Phase 6b (EE mirror): hooks → ee/server/hooks// -# Format: old-pathnew-path (relative to apps/meteor/) -ee/app/livechat-enterprise/server/hooks ee/server/hooks/omnichannel -ee/app/canned-responses/server/hooks ee/server/hooks/canned-responses -ee/app/message-read-receipt/server/hooks/afterDeleteRoom.ts ee/server/hooks/messages/afterDeleteRoom.ts -ee/app/message-read-receipt/server/hooks/afterReadMessages.ts ee/server/hooks/messages/afterReadMessages.ts -ee/app/message-read-receipt/server/hooks/afterSaveMessage.ts ee/server/hooks/messages/afterSaveMessage.ts -ee/app/authorization/server/callback.ts ee/server/hooks/auth/callback.ts diff --git a/apps/meteor/scripts/migration/phase6b-hooks.tsv b/apps/meteor/scripts/migration/phase6b-hooks.tsv deleted file mode 100644 index 51ff83c593247..0000000000000 --- a/apps/meteor/scripts/migration/phase6b-hooks.tsv +++ /dev/null @@ -1,13 +0,0 @@ -# Phase 6b: hooks → server/hooks// -# Format: old-pathnew-path (relative to apps/meteor/) -app/authentication/server/hooks/login.ts server/hooks/auth/login.ts -app/discussion/server/hooks/propagateDiscussionMetadata.ts server/hooks/messages/propagateDiscussionMetadata.ts -app/threads/server/hooks/aftersavemessage.ts server/hooks/messages/processThreads.ts -app/lib/server/lib/afterSaveMessage.ts server/hooks/messages/afterSaveMessage.ts -app/lib/server/lib/notifyUsersOnMessage.ts server/hooks/messages/notifyUsersOnMessage.ts -app/lib/server/lib/sendNotificationsOnMessage.ts server/hooks/messages/sendNotificationsOnMessage.ts -app/lib/server/lib/beforeAddUserToRoom.ts server/hooks/rooms/beforeAddUserToRoom.ts -app/livechat/server/hooks server/hooks/omnichannel -tests/unit/app/livechat/server/hooks tests/unit/server/hooks/omnichannel -tests/unit/server/livechat/hooks/markRoomResponded.spec.ts tests/unit/server/hooks/omnichannel/markRoomResponded.spec.ts -tests/unit/server/livechat/hooks/beforeNewRoom.spec.ts tests/unit/server/hooks/omnichannel/beforeNewRoom.spec.ts diff --git a/apps/meteor/scripts/migration/phase6c-notifications.tsv b/apps/meteor/scripts/migration/phase6c-notifications.tsv deleted file mode 100644 index 8eca072a826c4..0000000000000 --- a/apps/meteor/scripts/migration/phase6c-notifications.tsv +++ /dev/null @@ -1,10 +0,0 @@ -# Phase 6c: notification libraries → server/lib/notifications/ -# Format: old-pathnew-path (relative to apps/meteor/) -app/push/server/methods.ts server/meteor-methods/platform/push.ts -app/push/server server/lib/notifications/push -app/push-notifications/server/methods/saveNotificationSettings.ts server/meteor-methods/users/saveNotificationSettings.ts -app/push-notifications/server server/lib/notifications/push-config -app/mailer/server server/lib/notifications/email -app/mail-messages/server server/lib/notifications/mail-messages -app/notification-queue/server/NotificationQueue.ts server/lib/notifications/queue/NotificationQueue.ts -app/notifications/server server/lib/notifications/core diff --git a/apps/meteor/scripts/migration/phase6d-messaging.tsv b/apps/meteor/scripts/migration/phase6d-messaging.tsv deleted file mode 100644 index 1908582e38ebd..0000000000000 --- a/apps/meteor/scripts/migration/phase6d-messaging.tsv +++ /dev/null @@ -1,14 +0,0 @@ -# Phase 6d: messaging libraries → server/lib/messaging/ -# Format: old-pathnew-path (relative to apps/meteor/) -app/mentions/server/methods/getUserMentionsByChannel.ts server/meteor-methods/messages/getUserMentionsByChannel.ts -app/mentions/server server/lib/messaging/mentions -app/threads/server/functions.ts server/lib/messaging/threads/functions.ts -app/discussion/server/permissions.ts server/lib/messaging/discussions/permissions.ts -app/reactions/server/setReaction.ts server/lib/messaging/reactions/setReaction.ts -app/message-pin/server/pinMessage.ts server/lib/messaging/pins/pinMessage.ts -app/message-star/server/starMessage.ts server/lib/messaging/stars/starMessage.ts -app/message-mark-as-unread/server/logger.ts server/lib/messaging/unread/logger.ts -app/message-mark-as-unread/server/unreadMessages.ts server/lib/messaging/unread/unreadMessages.ts -app/markdown/server/index.ts server/lib/messaging/markdown.ts -app/emoji/server/lib.ts server/lib/messaging/emoji.ts -tests/unit/app/mentions/server.tests.js tests/unit/server/lib/messaging/mentions/server.tests.js diff --git a/apps/meteor/scripts/migration/phase6e-media-import-libs.tsv b/apps/meteor/scripts/migration/phase6e-media-import-libs.tsv deleted file mode 100644 index 157dfe02b63f7..0000000000000 --- a/apps/meteor/scripts/migration/phase6e-media-import-libs.tsv +++ /dev/null @@ -1,49 +0,0 @@ -# Phase 6e: media, import, search, and remaining libraries -# Format: old-pathnew-path (relative to apps/meteor/) -# -- method split-outs first (order matters: files out before their parent dir moves) -- -app/file-upload/server/methods/sendFileMessage.spec.ts server/meteor-methods/messages/sendFileMessage.spec.ts -app/file-upload/server/methods/sendFileMessage.ts server/meteor-methods/messages/sendFileMessage.ts -app/file-upload/server/methods/getS3FileUrl.ts server/meteor-methods/media/getS3FileUrl.ts -app/file-upload/server/methods/isImagePreviewSupported.ts server/lib/media/file-upload/isImagePreviewSupported.ts -app/emoji-custom/server/methods/deleteEmojiCustom.ts server/meteor-methods/media/deleteEmojiCustom.ts -app/emoji-custom/server/methods/insertOrUpdateEmoji.ts server/meteor-methods/media/insertOrUpdateEmoji.ts -app/emoji-custom/server/methods/uploadEmojiCustom.ts server/meteor-methods/media/uploadEmojiCustom.ts -app/custom-sounds/server/methods/deleteCustomSound.ts server/meteor-methods/media/deleteCustomSound.ts -app/custom-sounds/server/methods/insertOrUpdateSound.ts server/meteor-methods/media/insertOrUpdateSound.ts -app/custom-sounds/server/methods/listCustomSounds.ts server/meteor-methods/media/listCustomSounds.ts -app/custom-sounds/server/methods/uploadCustomSound.ts server/meteor-methods/media/uploadCustomSound.ts -app/search/server/methods.ts server/meteor-methods/platform/search.ts -app/cloud/server/methods.ts server/meteor-methods/platform/cloud.ts -app/statistics/server/methods/getStatistics.ts server/meteor-methods/platform/getStatistics.ts -app/version-check/server/methods/banner_dismiss.ts server/meteor-methods/platform/banner_dismiss.ts -# -- integrations webhook API belongs to server/api -- -app/integrations/server/api/api.ts server/api/webhooks.ts -# -- media -- -app/file-upload/server server/lib/media/file-upload -app/file/server server/lib/media/file -app/emoji-custom/server server/lib/media/emoji-custom -app/emoji-native/server server/lib/media/emoji-native -app/custom-sounds/server server/lib/media/custom-sounds -app/assets/server server/lib/media/assets -# -- import -- -app/importer/server server/lib/import -app/importer-csv/server server/lib/import/csv -app/importer-slack/server server/lib/import/slack -app/importer-slack-users/server server/lib/import/slack-users -app/importer-omnichannel-contacts/server server/lib/import/omnichannel-contacts -app/importer-pending-avatars/server server/lib/import/pending-avatars -app/importer-pending-files/server server/lib/import/pending-files -# -- remaining libraries -- -app/search/server server/lib/search -app/autotranslate/server server/lib/autotranslate -app/e2e/server server/lib/e2e -app/integrations/server server/lib/integrations -app/statistics/server server/lib/statistics -app/metrics/server server/lib/metrics -app/cloud/server server/lib/cloud -app/version-check/server server/lib/cloud/version-check -app/license/server/airGappedRestrictionsWrapper.ts server/lib/cloud/license/airGappedRestrictionsWrapper.ts -# -- test mirrors -- -tests/unit/app/importer/server tests/unit/server/lib/import -tests/unit/app/statistics/server tests/unit/server/lib/statistics -tests/unit/app/e2e/server tests/unit/server/lib/e2e diff --git a/apps/meteor/scripts/migration/verify-no-old-imports.mjs b/apps/meteor/scripts/migration/verify-no-old-imports.mjs deleted file mode 100644 index dc8405dc1c070..0000000000000 --- a/apps/meteor/scripts/migration/verify-no-old-imports.mjs +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env node - -/** - * Disposable verification script: checks that no imports still reference - * old paths that should have been updated during migration. - * - * Usage: - * node verify-no-old-imports.mjs ... - * - * Example: - * node verify-no-old-imports.mjs "app/slashcommand" "app/bot-helpers/server" - * - * Scans all .ts/.js files under apps/meteor/ for import statements - * containing the given patterns and reports any matches. - */ - -import fs from 'node:fs'; -import path from 'node:path'; - -const ROOT = path.resolve(import.meta.dirname, '../..'); -const patterns = process.argv.slice(2); - -if (patterns.length === 0) { - console.error('Usage: node verify-no-old-imports.mjs ...'); - console.error('Example: node verify-no-old-imports.mjs "app/slashcommand" "app/bot-helpers/server"'); - process.exit(1); -} - -function getAllFiles(dir, exts = ['.ts', '.js', '.tsx', '.jsx']) { - const results = []; - if (!fs.existsSync(dir)) return results; - for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { - const full = path.join(dir, entry.name); - if (entry.isDirectory() && entry.name !== 'node_modules' && entry.name !== '.meteor') { - results.push(...getAllFiles(full, exts)); - } else if (exts.some((ext) => entry.name.endsWith(ext))) { - results.push(full); - } - } - return results; -} - -// Matches static imports/re-exports, bare imports, dynamic import(), and require(). -const IMPORT_RE = /(?:from\s+|import\s+|(?:import|require)\s*\(\s*)(['"])([^'"]+)\1/g; - -const searchDirs = ['app', 'server', 'ee', 'lib', 'tests', 'imports', 'client', 'definition', 'packages'].map((d) => path.join(ROOT, d)); - -let violations = 0; - -for (const dir of searchDirs) { - const files = getAllFiles(dir); - for (const file of files) { - const content = fs.readFileSync(file, 'utf8'); - const lines = content.split('\n'); - for (let i = 0; i < lines.length; i++) { - const line = lines[i]; - let m; - const re = new RegExp(IMPORT_RE.source, 'g'); - while ((m = re.exec(line)) !== null) { - const specifier = m[2]; - for (const pattern of patterns) { - if (specifier.includes(pattern)) { - const relPath = path.relative(ROOT, file); - console.log(` ${relPath}:${i + 1} → ${specifier}`); - violations++; - } - } - } - } - } -} - -if (violations === 0) { - console.log(`No imports found matching patterns: ${patterns.join(', ')}`); -} else { - console.error(`\nFound ${violations} import(s) still referencing old paths.`); - process.exit(1); -} diff --git a/apps/meteor/server/api/ApiClass.ts b/apps/meteor/server/api/ApiClass.ts index e9994cb09d271..44519a28407c9 100644 --- a/apps/meteor/server/api/ApiClass.ts +++ b/apps/meteor/server/api/ApiClass.ts @@ -43,17 +43,17 @@ import { getUserInfo } from './lib/getUserInfo'; import { parseJsonQuery } from './lib/parseJsonQuery'; import type { APIActionContext } from './router'; import { RocketChatAPIRouter } from './router'; -import { notifyOnUserChangeAsync } from '../../app/lib/server/lib/notifyListener'; -import { settings } from '../../app/settings/server'; -import { getNestedProp } from '../lib/getNestedProp'; -import { authenticationMiddlewareForHono } from './v1/middlewares/authenticationHono'; -import { permissionsMiddleware } from './v1/middlewares/permissions'; -import { getDefaultUserFields } from '../../app/utils/server/functions/getDefaultUserFields'; -import { license } from '../../ee/server/api/v1/middlewares/license'; import { isObject } from '../../lib/utils/isObject'; import { checkCodeForUser } from '../lib/2fa/code'; import { hasPermissionAsync } from '../lib/authorization/hasPermission'; +import { getNestedProp } from '../lib/getNestedProp'; +import { notifyOnUserChangeAsync } from '../lib/notifyListener'; import { shouldBreakInVersion } from '../lib/shouldBreakInVersion'; +import { authenticationMiddlewareForHono } from './v1/middlewares/authenticationHono'; +import { permissionsMiddleware } from './v1/middlewares/permissions'; +import { license } from '../../ee/server/api/v1/middlewares/license'; +import { getDefaultUserFields } from '../lib/utils/functions/getDefaultUserFields'; +import { settings } from '../settings'; const logger = new Logger('API'); diff --git a/apps/meteor/app/api/README.md b/apps/meteor/server/api/README.md similarity index 100% rename from apps/meteor/app/api/README.md rename to apps/meteor/server/api/README.md diff --git a/apps/meteor/server/api/api.helpers.ts b/apps/meteor/server/api/api.helpers.ts index e440dea8c44e0..63e4a642a02ba 100644 --- a/apps/meteor/server/api/api.helpers.ts +++ b/apps/meteor/server/api/api.helpers.ts @@ -1,9 +1,9 @@ import type { IUser } from '@rocket.chat/core-typings'; import type { ActionThis } from './definition'; -import type { DeprecationLoggerNextPlannedVersion } from '../../app/lib/server/lib/deprecationWarningLogger'; -import { apiDeprecationLogger } from '../../app/lib/server/lib/deprecationWarningLogger'; import { hasAllPermissionAsync, hasAtLeastOnePermissionAsync } from '../lib/authorization/hasPermission'; +import type { DeprecationLoggerNextPlannedVersion } from '../lib/deprecationWarningLogger'; +import { apiDeprecationLogger } from '../lib/deprecationWarningLogger'; type RequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | '*'; export type PermissionsPayload = { diff --git a/apps/meteor/server/api/api.ts b/apps/meteor/server/api/api.ts index 2207e7647e145..7d59683f07f8c 100644 --- a/apps/meteor/server/api/api.ts +++ b/apps/meteor/server/api/api.ts @@ -7,12 +7,12 @@ import { WebApp } from 'meteor/webapp'; import { APIClass } from './ApiClass'; import { type APIActionHandler, RocketChatAPIRouter } from './router'; import { metrics } from '../lib/metrics'; +import { settings } from '../settings'; import { cors } from './v1/middlewares/cors'; import { loggerMiddleware } from './v1/middlewares/logger'; import { metricsMiddleware } from './v1/middlewares/metrics'; import { remoteAddressMiddleware } from './v1/middlewares/remoteAddressMiddleware'; import { tracerSpanMiddleware } from './v1/middlewares/tracer'; -import { settings } from '../../app/settings/server'; const logger = new Logger('API'); diff --git a/apps/meteor/server/api/default/openApi.ts b/apps/meteor/server/api/default/openApi.ts index c0f8030e144e7..35e9e55a0d993 100644 --- a/apps/meteor/server/api/default/openApi.ts +++ b/apps/meteor/server/api/default/openApi.ts @@ -5,7 +5,7 @@ import express from 'express'; import { WebApp } from 'meteor/webapp'; import swaggerUi from 'swagger-ui-express'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; import { API } from '../api'; import { getTrimmedServerVersion } from '../lib/getTrimmedServerVersion'; diff --git a/apps/meteor/server/api/definition.ts b/apps/meteor/server/api/definition.ts index 7f795fac25f74..3f27770edb0b7 100644 --- a/apps/meteor/server/api/definition.ts +++ b/apps/meteor/server/api/definition.ts @@ -5,8 +5,8 @@ import type { Logger } from '@rocket.chat/logger'; import type { Method, MethodOf, OperationParams, OperationResult, PathPattern, UrlParams } from '@rocket.chat/rest-typings'; import type { ValidateFunction } from 'ajv'; -import type { DeprecationLoggerNextPlannedVersion } from '../../app/lib/server/lib/deprecationWarningLogger'; import type { ITwoFactorOptions } from '../lib/2fa/code'; +import type { DeprecationLoggerNextPlannedVersion } from '../lib/deprecationWarningLogger'; export type SuccessStatusCodes = Exclude, Range<200>>; diff --git a/apps/meteor/server/api/lib/composeRoomWithLastMessage.ts b/apps/meteor/server/api/lib/composeRoomWithLastMessage.ts index c96086157882a..022e21da1aadd 100644 --- a/apps/meteor/server/api/lib/composeRoomWithLastMessage.ts +++ b/apps/meteor/server/api/lib/composeRoomWithLastMessage.ts @@ -1,6 +1,6 @@ import type { IRoom } from '@rocket.chat/core-typings'; -import { normalizeMessagesForUser } from '../../../app/utils/server/lib/normalizeMessagesForUser'; +import { normalizeMessagesForUser } from '../../lib/utils/lib/normalizeMessagesForUser'; export async function composeRoomWithLastMessage(room: IRoom, userId: string) { if (room.lastMessage) { diff --git a/apps/meteor/server/api/lib/emailInbox.ts b/apps/meteor/server/api/lib/emailInbox.ts index 9850437c7ebb4..9c06f395d7b1e 100644 --- a/apps/meteor/server/api/lib/emailInbox.ts +++ b/apps/meteor/server/api/lib/emailInbox.ts @@ -2,7 +2,7 @@ import type { IEmailInbox } from '@rocket.chat/core-typings'; import { EmailInbox, Users } from '@rocket.chat/models'; import type { DeleteResult, Filter, InsertOneResult, Sort } from 'mongodb'; -import { notifyOnEmailInboxChanged } from '../../../app/lib/server/lib/notifyListener'; +import { notifyOnEmailInboxChanged } from '../../lib/notifyListener'; export const findEmailInboxes = async ({ query = {}, diff --git a/apps/meteor/server/api/lib/getPaginationItems.ts b/apps/meteor/server/api/lib/getPaginationItems.ts index 86c7c49cd7907..544acd53c8bad 100644 --- a/apps/meteor/server/api/lib/getPaginationItems.ts +++ b/apps/meteor/server/api/lib/getPaginationItems.ts @@ -1,7 +1,7 @@ // If the count query param is higher than the "API_Upper_Count_Limit" setting, then we limit that // If the count query param isn't defined, then we set it to the "API_Default_Count" setting // If the count is zero, then that means unlimited and is only allowed if the setting "API_Allow_Infinite_Count" is true -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; export async function getPaginationItems(params: { offset?: string | number | null; count?: string | number | null }): Promise<{ readonly offset: number; diff --git a/apps/meteor/server/api/lib/getServerInfo.spec.ts b/apps/meteor/server/api/lib/getServerInfo.spec.ts index 60f5ab4cdc509..1b543e9c6fcd8 100644 --- a/apps/meteor/server/api/lib/getServerInfo.spec.ts +++ b/apps/meteor/server/api/lib/getServerInfo.spec.ts @@ -23,7 +23,7 @@ describe.skip('#getServerInfo()', () => { '../../lib/cloud/supportedVersionsToken/supportedVersionsToken': { getCachedSupportedVersionsToken: getCachedSupportedVersionsTokenMock, }, - '../../../app/settings/server': { + '../../settings': { settings: new Map(), }, }); diff --git a/apps/meteor/server/api/lib/getServerInfo.ts b/apps/meteor/server/api/lib/getServerInfo.ts index 4ae591a45acef..e52ccd029da17 100644 --- a/apps/meteor/server/api/lib/getServerInfo.ts +++ b/apps/meteor/server/api/lib/getServerInfo.ts @@ -2,10 +2,10 @@ import type { IWorkspaceInfo } from '@rocket.chat/core-typings'; import { License } from '@rocket.chat/license'; import { getTrimmedServerVersion } from './getTrimmedServerVersion'; -import { settings } from '../../../app/settings/server'; import { Info, minimumClientVersions } from '../../../app/utils/rocketchat.info'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { getCachedSupportedVersionsToken, wrapPromise } from '../../lib/cloud/supportedVersionsToken/supportedVersionsToken'; +import { settings } from '../../settings'; export async function getServerInfo(userId?: string): Promise { const hasPermissionToViewStatistics = userId && (await hasPermissionAsync(userId, 'view-statistics')); diff --git a/apps/meteor/server/api/lib/getUserInfo.spec.ts b/apps/meteor/server/api/lib/getUserInfo.spec.ts index aa6c830f64951..9716fccf740c3 100644 --- a/apps/meteor/server/api/lib/getUserInfo.spec.ts +++ b/apps/meteor/server/api/lib/getUserInfo.spec.ts @@ -1,5 +1,5 @@ import { getUserInfo } from './getUserInfo'; -import type { CachedSettings } from '../../../app/settings/server/CachedSettings'; +import type { CachedSettings } from '../../settings/CachedSettings'; const mockInfoVersion = jest.fn(() => '7.5.0'); @@ -23,7 +23,7 @@ jest.mock('@rocket.chat/models', () => ({ const settings = new Map(); -jest.mock('../../../app/settings/server', () => ({ +jest.mock('../../settings', () => ({ settings: { getByRegexp(_id) { return [...settings].filter(([key]) => key.match(_id)) as any; diff --git a/apps/meteor/server/api/lib/getUserInfo.ts b/apps/meteor/server/api/lib/getUserInfo.ts index 829a3009e4ca3..adfbedefe4bef 100644 --- a/apps/meteor/server/api/lib/getUserInfo.ts +++ b/apps/meteor/server/api/lib/getUserInfo.ts @@ -1,10 +1,10 @@ import { isOAuthUser, type IMeApiUser, type IUser, type IUserEmail, type IUserCalendar } from '@rocket.chat/core-typings'; import semver from 'semver'; -import { settings } from '../../../app/settings/server'; import { Info } from '../../../app/utils/rocketchat.info'; -import { getURL } from '../../../app/utils/server/getURL'; -import { getUserPreference } from '../../../app/utils/server/lib/getUserPreference'; +import { getURL } from '../../lib/utils/getURL'; +import { getUserPreference } from '../../lib/utils/lib/getUserPreference'; +import { settings } from '../../settings'; const isVerifiedEmail = (me: IUser): false | IUserEmail | undefined => { if (!me || !Array.isArray(me.emails)) { diff --git a/apps/meteor/server/api/lib/maybeMigrateLivechatRoom.ts b/apps/meteor/server/api/lib/maybeMigrateLivechatRoom.ts index f00f7c3ee93b6..958e05f1f477b 100644 --- a/apps/meteor/server/api/lib/maybeMigrateLivechatRoom.ts +++ b/apps/meteor/server/api/lib/maybeMigrateLivechatRoom.ts @@ -4,7 +4,7 @@ import { LivechatRooms } from '@rocket.chat/models'; import type { FindOptions } from 'mongodb'; import { projectionAllowsAttribute } from './projectionAllowsAttribute'; -import { migrateVisitorIfMissingContact } from '../../../app/livechat/server/lib/contacts/migrateVisitorIfMissingContact'; +import { migrateVisitorIfMissingContact } from '../../lib/omnichannel/contacts/migrateVisitorIfMissingContact'; /** * If the room is a livechat room and it doesn't yet have a contact, trigger the migration for its visitor and source diff --git a/apps/meteor/server/api/lib/parseJsonQuery.ts b/apps/meteor/server/api/lib/parseJsonQuery.ts index dfec9a5161883..00389a33580a4 100644 --- a/apps/meteor/server/api/lib/parseJsonQuery.ts +++ b/apps/meteor/server/api/lib/parseJsonQuery.ts @@ -3,9 +3,9 @@ import { Meteor } from 'meteor/meteor'; import { clean } from './cleanQuery'; import { isValidQuery } from './isValidQuery'; -import { apiDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; import { isPlainObject } from '../../../lib/utils/isPlainObject'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { apiDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { API } from '../api'; import type { GenericRouteExecutionContext } from '../definition'; diff --git a/apps/meteor/server/api/lib/rooms.ts b/apps/meteor/server/api/lib/rooms.ts index c63d43f3125c7..341f53923ae9b 100644 --- a/apps/meteor/server/api/lib/rooms.ts +++ b/apps/meteor/server/api/lib/rooms.ts @@ -3,9 +3,9 @@ import { Rooms, Subscriptions } from '@rocket.chat/models'; import type { FindOptions, Sort } from 'mongodb'; import { scopeAdminRoomsForAbac } from './scopeAdminRoomsForAbac'; -import { stripABACManagedFieldsForAdmin } from '../../../app/authorization/server/lib/isABACManagedRoom'; import { adminFields } from '../../../lib/rooms/adminFields'; import { hasAtLeastOnePermissionAsync, hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { stripABACManagedFieldsForAdmin } from '../../lib/authorization/isABACManagedRoom'; export async function findAdminRooms({ uid, diff --git a/apps/meteor/server/api/lib/users.ts b/apps/meteor/server/api/lib/users.ts index bcebaaaf4ce14..1b1247f13cc37 100644 --- a/apps/meteor/server/api/lib/users.ts +++ b/apps/meteor/server/api/lib/users.ts @@ -4,8 +4,8 @@ import { escapeRegExp } from '@rocket.chat/string-helpers'; import type { Mongo } from 'meteor/mongo'; import type { Filter, FindOptions, RootFilterOperators } from 'mongodb'; -import { settings } from '../../../app/settings/server'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { settings } from '../../settings'; type UserAutoComplete = Required>; diff --git a/apps/meteor/server/api/v1/assets.ts b/apps/meteor/server/api/v1/assets.ts index 9a29c409a2e23..071850fa9e691 100644 --- a/apps/meteor/server/api/v1/assets.ts +++ b/apps/meteor/server/api/v1/assets.ts @@ -7,9 +7,9 @@ import { validateBadRequestErrorResponse, } from '@rocket.chat/rest-typings'; -import { notifyOnSettingChangedById } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; import { RocketChatAssets, refreshClients } from '../../lib/media/assets'; +import { notifyOnSettingChangedById } from '../../lib/notifyListener'; +import { settings } from '../../settings'; import { updateAuditedByUser } from '../../settings/lib/auditedSettingUpdates'; import { API } from '../api'; import { getUploadFormData } from '../lib/getUploadFormData'; diff --git a/apps/meteor/server/api/v1/autotranslate.ts b/apps/meteor/server/api/v1/autotranslate.ts index 8e174b3f9039f..d614d778120fa 100644 --- a/apps/meteor/server/api/v1/autotranslate.ts +++ b/apps/meteor/server/api/v1/autotranslate.ts @@ -9,11 +9,11 @@ import { isAutotranslateGetSupportedLanguagesParamsGET, } from '@rocket.chat/rest-typings'; -import { canAccessRoomAsync } from '../../../app/authorization/server'; -import { settings } from '../../../app/settings/server'; +import { canAccessRoomAsync } from '../../lib/authorization'; import { getSupportedLanguages } from '../../lib/autotranslate/functions/getSupportedLanguages'; import { saveAutoTranslateSettings } from '../../lib/autotranslate/functions/saveSettings'; import { translateMessage } from '../../lib/autotranslate/functions/translateMessage'; +import { settings } from '../../settings'; import type { ExtractRoutesFromAPI } from '../ApiClass'; import { API } from '../api'; diff --git a/apps/meteor/server/api/v1/channels.ts b/apps/meteor/server/api/v1/channels.ts index f8c8072c60b15..d433b823ac749 100644 --- a/apps/meteor/server/api/v1/channels.ts +++ b/apps/meteor/server/api/v1/channels.ts @@ -34,14 +34,13 @@ import { isTruthy } from '@rocket.chat/tools'; import { check, Match } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { canAccessRoomAsync } from '../../../app/authorization/server'; -import { settings } from '../../../app/settings/server'; -import { normalizeMessagesForUser } from '../../../app/utils/server/lib/normalizeMessagesForUser'; +import { canAccessRoomAsync } from '../../lib/authorization'; import { hasAllPermissionAsync, hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { eraseRoom } from '../../lib/eraseRoom'; import { findUsersOfRoom } from '../../lib/findUsersOfRoom'; import { mountIntegrationQueryBasedOnPermissions } from '../../lib/integrations/lib/mountQueriesBasedOnPermission'; import { openRoom } from '../../lib/openRoom'; +import { normalizeMessagesForUser } from '../../lib/utils/lib/normalizeMessagesForUser'; import { getChannelHistory } from '../../meteor-methods/messages/getChannelHistory'; import { getUserMentionsByChannel } from '../../meteor-methods/messages/getUserMentionsByChannel'; import { addAllUserToRoomFn } from '../../meteor-methods/rooms/addAllUserToRoom'; @@ -60,6 +59,7 @@ import { removeRoomOwner } from '../../meteor-methods/rooms/removeRoomOwner'; import { removeUserFromRoomMethod } from '../../meteor-methods/rooms/removeUserFromRoom'; import { saveRoomSettings } from '../../meteor-methods/rooms/saveRoomSettings'; import { executeUnarchiveRoom } from '../../meteor-methods/rooms/unarchiveRoom'; +import { settings } from '../../settings'; import { API } from '../api'; import { addUserToFileObj } from '../lib/addUserToFileObj'; import { composeRoomWithLastMessage } from '../lib/composeRoomWithLastMessage'; diff --git a/apps/meteor/server/api/v1/chat.ts b/apps/meteor/server/api/v1/chat.ts index 0fb4d345ceea8..a5d0f940eb4a3 100644 --- a/apps/meteor/server/api/v1/chat.ts +++ b/apps/meteor/server/api/v1/chat.ts @@ -30,9 +30,7 @@ import { import { escapeRegExp } from '@rocket.chat/string-helpers'; import { Meteor } from 'meteor/meteor'; -import { roomAccessAttributes } from '../../../app/authorization/server'; -import { settings } from '../../../app/settings/server'; -import { normalizeMessagesForUser } from '../../../app/utils/server/lib/normalizeMessagesForUser'; +import { roomAccessAttributes } from '../../lib/authorization'; import { canAccessRoomAsync, canAccessRoomIdAsync } from '../../lib/authorization/canAccessRoom'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { applyAirGappedRestrictionsValidation } from '../../lib/cloud/license/airGappedRestrictionsWrapper'; @@ -42,6 +40,7 @@ import { pinMessage, unpinMessage } from '../../lib/messaging/pins/pinMessage'; import { executeSetReaction } from '../../lib/messaging/reactions/setReaction'; import { starMessage } from '../../lib/messaging/stars/starMessage'; import { reportMessage } from '../../lib/moderation/reportMessage'; +import { normalizeMessagesForUser } from '../../lib/utils/lib/normalizeMessagesForUser'; import { followMessage } from '../../meteor-methods/messages/followMessage'; import { getSingleMessage } from '../../meteor-methods/messages/getSingleMessage'; import { messageSearch } from '../../meteor-methods/messages/messageSearch'; @@ -50,6 +49,7 @@ import { unfollowMessage } from '../../meteor-methods/messages/unfollowMessage'; import { executeUpdateMessage } from '../../meteor-methods/messages/updateMessage'; import { ignoreUser } from '../../meteor-methods/users/ignoreUser'; import { getMessageHistory } from '../../publications/messages'; +import { settings } from '../../settings'; import type { ExtractRoutesFromAPI } from '../ApiClass'; import { API } from '../api'; import { getPaginationItems } from '../lib/getPaginationItems'; diff --git a/apps/meteor/server/api/v1/commands.ts b/apps/meteor/server/api/v1/commands.ts index 6547a174aa91c..c7682665bca49 100644 --- a/apps/meteor/server/api/v1/commands.ts +++ b/apps/meteor/server/api/v1/commands.ts @@ -11,8 +11,8 @@ import { } from '@rocket.chat/rest-typings'; import objectPath from 'object-path'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; import { canAccessRoomIdAsync } from '../../lib/authorization/canAccessRoom'; +import { slashCommands } from '../../lib/utils/slashCommand'; import { executeSlashCommandPreview } from '../../meteor-methods/messages/executeSlashCommandPreview'; import { getSlashCommandPreviews } from '../../meteor-methods/messages/getSlashCommandPreviews'; import type { ExtractRoutesFromAPI } from '../ApiClass'; diff --git a/apps/meteor/server/api/v1/custom-user-status.ts b/apps/meteor/server/api/v1/custom-user-status.ts index 0212965142cd2..25ef9bad1a445 100644 --- a/apps/meteor/server/api/v1/custom-user-status.ts +++ b/apps/meteor/server/api/v1/custom-user-status.ts @@ -11,8 +11,8 @@ import type { PaginatedRequest, PaginatedResult } from '@rocket.chat/rest-typing import { escapeRegExp } from '@rocket.chat/string-helpers'; import { Meteor } from 'meteor/meteor'; -import { deleteCustomUserStatus } from '../../../app/user-status/server/methods/deleteCustomUserStatus'; -import { insertOrUpdateUserStatus } from '../../../app/user-status/server/methods/insertOrUpdateUserStatus'; +import { deleteCustomUserStatus } from '../../meteor-methods/users/deleteCustomUserStatus'; +import { insertOrUpdateUserStatus } from '../../meteor-methods/users/insertOrUpdateUserStatus'; import type { ExtractRoutesFromAPI } from '../ApiClass'; import { API } from '../api'; import { getPaginationItems } from '../lib/getPaginationItems'; diff --git a/apps/meteor/server/api/v1/e2e.ts b/apps/meteor/server/api/v1/e2e.ts index 5b7be8eeb77df..0d1d003d3be9b 100644 --- a/apps/meteor/server/api/v1/e2e.ts +++ b/apps/meteor/server/api/v1/e2e.ts @@ -10,7 +10,6 @@ import { } from '@rocket.chat/rest-typings'; import ExpiryMap from 'expiry-map'; -import { settings } from '../../../app/settings/server'; import { canAccessRoomIdAsync } from '../../lib/authorization/canAccessRoom'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { handleSuggestedGroupKey } from '../../lib/e2e/functions/handleSuggestedGroupKey'; @@ -21,6 +20,7 @@ import { requestSubscriptionKeysMethod } from '../../meteor-methods/platform/req import { setRoomKeyIDMethod } from '../../meteor-methods/platform/setRoomKeyID'; import { setUserPublicAndPrivateKeysMethod } from '../../meteor-methods/platform/setUserPublicAndPrivateKeys'; import { updateGroupKey } from '../../meteor-methods/platform/updateGroupKey'; +import { settings } from '../../settings'; import type { ExtractRoutesFromAPI } from '../ApiClass'; import { API } from '../api'; diff --git a/apps/meteor/server/api/v1/emoji-custom.ts b/apps/meteor/server/api/v1/emoji-custom.ts index 7ac4540a33793..2c1e70686e774 100644 --- a/apps/meteor/server/api/v1/emoji-custom.ts +++ b/apps/meteor/server/api/v1/emoji-custom.ts @@ -6,11 +6,11 @@ import { escapeRegExp } from '@rocket.chat/string-helpers'; import { Meteor } from 'meteor/meteor'; import type { WithId } from 'mongodb'; -import { settings } from '../../../app/settings/server'; import type { EmojiData } from '../../lib/media/emoji-custom/lib/insertOrUpdateEmoji'; import { insertOrUpdateEmoji } from '../../lib/media/emoji-custom/lib/insertOrUpdateEmoji'; import { uploadEmojiCustomWithBuffer } from '../../lib/media/emoji-custom/lib/uploadEmojiCustom'; import { deleteEmojiCustom } from '../../meteor-methods/media/deleteEmojiCustom'; +import { settings } from '../../settings'; import type { ExtractRoutesFromAPI } from '../ApiClass'; import { API } from '../api'; import { findEmojisCustom } from '../lib/emoji-custom'; diff --git a/apps/meteor/server/api/v1/groups.ts b/apps/meteor/server/api/v1/groups.ts index 882dc89146aa7..7836cd0f7ee3c 100644 --- a/apps/meteor/server/api/v1/groups.ts +++ b/apps/meteor/server/api/v1/groups.ts @@ -14,13 +14,13 @@ import { check, Match } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; import type { Filter } from 'mongodb'; -import { canAccessRoomAsync, roomAccessAttributes } from '../../../app/authorization/server'; -import { normalizeMessagesForUser } from '../../../app/utils/server/lib/normalizeMessagesForUser'; +import { canAccessRoomAsync, roomAccessAttributes } from '../../lib/authorization'; import { hasAllPermissionAsync, hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { eraseRoom } from '../../lib/eraseRoom'; import { findUsersOfRoom } from '../../lib/findUsersOfRoom'; import { mountIntegrationQueryBasedOnPermissions } from '../../lib/integrations/lib/mountQueriesBasedOnPermission'; import { openRoom } from '../../lib/openRoom'; +import { normalizeMessagesForUser } from '../../lib/utils/lib/normalizeMessagesForUser'; import { getChannelHistory } from '../../meteor-methods/messages/getChannelHistory'; import { addAllUserToRoomFn } from '../../meteor-methods/rooms/addAllUserToRoom'; import { addRoomLeader } from '../../meteor-methods/rooms/addRoomLeader'; diff --git a/apps/meteor/server/api/v1/im.ts b/apps/meteor/server/api/v1/im.ts index f0b52eba6e889..3cdbb172fe397 100644 --- a/apps/meteor/server/api/v1/im.ts +++ b/apps/meteor/server/api/v1/im.ts @@ -20,8 +20,6 @@ import { Match, check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; import type { FindOptions } from 'mongodb'; -import { settings } from '../../../app/settings/server'; -import { normalizeMessagesForUser } from '../../../app/utils/server/lib/normalizeMessagesForUser'; import { canAccessRoomIdAsync } from '../../lib/authorization/canAccessRoom'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { eraseRoom } from '../../lib/eraseRoom'; @@ -29,10 +27,12 @@ import { openRoom } from '../../lib/openRoom'; import { getRoomByNameOrIdWithOptionToJoin } from '../../lib/rooms/getRoomByNameOrIdWithOptionToJoin'; import { blockUserMethod } from '../../lib/users/blockUser'; import { unblockUserMethod } from '../../lib/users/unblockUser'; +import { normalizeMessagesForUser } from '../../lib/utils/lib/normalizeMessagesForUser'; import { createDirectMessage } from '../../meteor-methods/messages/createDirectMessage'; import { getChannelHistory } from '../../meteor-methods/messages/getChannelHistory'; import { hideRoomMethod } from '../../meteor-methods/rooms/hideRoom'; import { saveRoomSettings } from '../../meteor-methods/rooms/saveRoomSettings'; +import { settings } from '../../settings'; import type { ExtractRoutesFromAPI } from '../ApiClass'; import { API } from '../api'; import type { TypedAction } from '../definition'; diff --git a/apps/meteor/server/api/v1/invites.ts b/apps/meteor/server/api/v1/invites.ts index c7f83c85e47d6..98475ee784daa 100644 --- a/apps/meteor/server/api/v1/invites.ts +++ b/apps/meteor/server/api/v1/invites.ts @@ -9,12 +9,12 @@ import { validateUnauthorizedErrorResponse, } from '@rocket.chat/rest-typings'; -import { findOrCreateInvite } from '../../../app/invites/server/functions/findOrCreateInvite'; -import { listInvites } from '../../../app/invites/server/functions/listInvites'; -import { removeInvite } from '../../../app/invites/server/functions/removeInvite'; -import { sendInvitationEmail } from '../../../app/invites/server/functions/sendInvitationEmail'; -import { useInviteToken } from '../../../app/invites/server/functions/useInviteToken'; -import { validateInviteToken } from '../../../app/invites/server/functions/validateInviteToken'; +import { findOrCreateInvite } from '../../lib/rooms/invites/findOrCreateInvite'; +import { listInvites } from '../../lib/rooms/invites/listInvites'; +import { removeInvite } from '../../lib/rooms/invites/removeInvite'; +import { sendInvitationEmail } from '../../lib/rooms/invites/sendInvitationEmail'; +import { useInviteToken } from '../../lib/rooms/invites/useInviteToken'; +import { validateInviteToken } from '../../lib/rooms/invites/validateInviteToken'; import type { ExtractRoutesFromAPI } from '../ApiClass'; import { API } from '../api'; diff --git a/apps/meteor/server/api/v1/ldap.ts b/apps/meteor/server/api/v1/ldap.ts index bb725d16f59e2..90f85afeee7bf 100644 --- a/apps/meteor/server/api/v1/ldap.ts +++ b/apps/meteor/server/api/v1/ldap.ts @@ -1,8 +1,8 @@ import { LDAP } from '@rocket.chat/core-services'; import { ajv, isLdapTestSearch, validateUnauthorizedErrorResponse, validateForbiddenErrorResponse } from '@rocket.chat/rest-typings'; -import { settings } from '../../../app/settings/server'; import { SystemLogger } from '../../lib/logger/system'; +import { settings } from '../../settings'; import { API } from '../api'; const messageResponseSchema = { diff --git a/apps/meteor/server/api/v1/middlewares/authentication.ts b/apps/meteor/server/api/v1/middlewares/authentication.ts index 2653fcb492144..fb6ee1df460ff 100644 --- a/apps/meteor/server/api/v1/middlewares/authentication.ts +++ b/apps/meteor/server/api/v1/middlewares/authentication.ts @@ -3,7 +3,7 @@ import { Authorization } from '@rocket.chat/core-services'; import { Users } from '@rocket.chat/models'; import type { Request, Response, NextFunction } from 'express'; -import { oAuth2ServerAuth } from '../../../../app/oauth2-server-config/server/oauth/oauth2-server'; +import { oAuth2ServerAuth } from '../../../lib/auth/oauth2-server/oauth2-server'; type AuthenticationMiddlewareConfig = { rejectUnauthorized?: boolean; diff --git a/apps/meteor/server/api/v1/middlewares/authenticationHono.ts b/apps/meteor/server/api/v1/middlewares/authenticationHono.ts index 10a35fb910242..883bb23996723 100644 --- a/apps/meteor/server/api/v1/middlewares/authenticationHono.ts +++ b/apps/meteor/server/api/v1/middlewares/authenticationHono.ts @@ -3,7 +3,7 @@ import { type Logger } from '@rocket.chat/logger'; import type { MiddlewareHandler } from 'hono'; import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; import { applyBreakingChanges, type APIClass } from '../../ApiClass'; import { convertHonoContextToApiActionContext, type HonoContext } from '../../router'; diff --git a/apps/meteor/server/api/v1/middlewares/cors.spec.ts b/apps/meteor/server/api/v1/middlewares/cors.spec.ts index 83f98f4e17f39..1eb2f4ed0169c 100644 --- a/apps/meteor/server/api/v1/middlewares/cors.spec.ts +++ b/apps/meteor/server/api/v1/middlewares/cors.spec.ts @@ -4,7 +4,7 @@ import express from 'express'; import request from 'supertest'; import { cors } from './cors'; -import { CachedSettings } from '../../../../app/settings/server/CachedSettings'; +import { CachedSettings } from '../../../settings/CachedSettings'; describe('Cors middleware', () => { it('should return allow-origin header for GET if CORS enabled', async () => { diff --git a/apps/meteor/server/api/v1/middlewares/cors.ts b/apps/meteor/server/api/v1/middlewares/cors.ts index e2a77659d3c6b..c5b3c6b453377 100644 --- a/apps/meteor/server/api/v1/middlewares/cors.ts +++ b/apps/meteor/server/api/v1/middlewares/cors.ts @@ -1,6 +1,6 @@ import type { MiddlewareHandler } from 'hono'; -import type { CachedSettings } from '../../../../app/settings/server/CachedSettings'; +import type { CachedSettings } from '../../../settings/CachedSettings'; const defaultHeaders = { 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, HEAD, PATCH', diff --git a/apps/meteor/server/api/v1/middlewares/metrics.spec.ts b/apps/meteor/server/api/v1/middlewares/metrics.spec.ts index 6df8b7b722bee..87ed45e325128 100644 --- a/apps/meteor/server/api/v1/middlewares/metrics.spec.ts +++ b/apps/meteor/server/api/v1/middlewares/metrics.spec.ts @@ -4,7 +4,7 @@ import express from 'express'; import request from 'supertest'; import { metricsMiddleware } from './metrics'; -import { CachedSettings } from '../../../../app/settings/server/CachedSettings'; +import { CachedSettings } from '../../../settings/CachedSettings'; describe('Metrics middleware', () => { it('should handle metrics', async () => { diff --git a/apps/meteor/server/api/v1/middlewares/metrics.ts b/apps/meteor/server/api/v1/middlewares/metrics.ts index c83256d715e1d..22b5bb98aa76b 100644 --- a/apps/meteor/server/api/v1/middlewares/metrics.ts +++ b/apps/meteor/server/api/v1/middlewares/metrics.ts @@ -1,7 +1,7 @@ import type { MiddlewareHandler } from 'hono'; import type { Gauge, Histogram, Summary } from 'prom-client'; -import type { CachedSettings } from '../../../../app/settings/server/CachedSettings'; +import type { CachedSettings } from '../../../settings/CachedSettings'; import type { APIClass } from '../../ApiClass'; export const metricsMiddleware = diff --git a/apps/meteor/server/api/v1/misc.ts b/apps/meteor/server/api/v1/misc.ts index aee621bba252d..c71a6efdb607f 100644 --- a/apps/meteor/server/api/v1/misc.ts +++ b/apps/meteor/server/api/v1/misc.ts @@ -23,16 +23,16 @@ import { check } from 'meteor/check'; import { DDPRateLimiter } from 'meteor/ddp-rate-limiter'; import { Meteor } from 'meteor/meteor'; -import { passwordPolicy } from '../../../app/lib/server'; -import { notifyOnSettingChangedById } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; -import { getBaseUserFields } from '../../../app/utils/server/functions/getBaseUserFields'; -import { isSMTPConfigured } from '../../../app/utils/server/functions/isSMTPConfigured'; -import { getURL } from '../../../app/utils/server/getURL'; +import { passwordPolicy } from '../../lib/auth/passwordPolicy'; import { i18n } from '../../lib/i18n'; import { SystemLogger } from '../../lib/logger/system'; +import { notifyOnSettingChangedById } from '../../lib/notifyListener'; +import { getBaseUserFields } from '../../lib/utils/functions/getBaseUserFields'; +import { isSMTPConfigured } from '../../lib/utils/functions/isSMTPConfigured'; +import { getURL } from '../../lib/utils/getURL'; import { browseChannelsMethod } from '../../meteor-methods/rooms/browseChannels'; import { spotlightMethod } from '../../publications/spotlight'; +import { settings } from '../../settings'; import { resetAuditedSettingByUser, updateAuditedByUser } from '../../settings/lib/auditedSettingUpdates'; import { API } from '../api'; import { getPaginationItems } from '../lib/getPaginationItems'; diff --git a/apps/meteor/server/api/v1/oauthapps.ts b/apps/meteor/server/api/v1/oauthapps.ts index 4a320de0caeb7..cade0f7ddb5d6 100644 --- a/apps/meteor/server/api/v1/oauthapps.ts +++ b/apps/meteor/server/api/v1/oauthapps.ts @@ -8,10 +8,10 @@ import { validateForbiddenErrorResponse, } from '@rocket.chat/rest-typings'; -import { addOAuthApp } from '../../../app/oauth2-server-config/server/admin/functions/addOAuthApp'; -import { deleteOAuthApp } from '../../../app/oauth2-server-config/server/admin/methods/deleteOAuthApp'; -import { updateOAuthApp } from '../../../app/oauth2-server-config/server/admin/methods/updateOAuthApp'; +import { addOAuthApp } from '../../lib/auth/oauth2-server/addOAuthApp'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { deleteOAuthApp } from '../../meteor-methods/auth/deleteOAuthApp'; +import { updateOAuthApp } from '../../meteor-methods/auth/updateOAuthApp'; import type { ExtractRoutesFromAPI } from '../ApiClass'; import { API } from '../api'; diff --git a/apps/meteor/server/api/v1/omnichannel/agent.ts b/apps/meteor/server/api/v1/omnichannel/agent.ts index c11867a18d1d4..d6b5a43368b7e 100644 --- a/apps/meteor/server/api/v1/omnichannel/agent.ts +++ b/apps/meteor/server/api/v1/omnichannel/agent.ts @@ -13,12 +13,12 @@ import { import { API } from '../..'; import { findRoom, findGuest, findAgent, findOpenRoom } from './lib/livechat'; -import { RoutingManager } from '../../../../app/livechat/server/lib/RoutingManager'; -import { getRequiredDepartment } from '../../../../app/livechat/server/lib/departmentsLib'; -import { saveAgentInfo } from '../../../../app/livechat/server/lib/omni-users'; -import { setUserStatusLivechat, allowAgentChangeServiceStatus } from '../../../../app/livechat/server/lib/utils'; import { hasPermissionAsync } from '../../../lib/authorization/hasPermission'; import { hasRoleAsync } from '../../../lib/authorization/hasRole'; +import { RoutingManager } from '../../../lib/omnichannel/RoutingManager'; +import { getRequiredDepartment } from '../../../lib/omnichannel/departmentsLib'; +import { saveAgentInfo } from '../../../lib/omnichannel/omni-users'; +import { setUserStatusLivechat, allowAgentChangeServiceStatus } from '../../../lib/omnichannel/utils'; import type { ExtractRoutesFromAPI } from '../../ApiClass'; API.v1.addRoute('livechat/agent.info/:rid/:token', { diff --git a/apps/meteor/server/api/v1/omnichannel/appearance.ts b/apps/meteor/server/api/v1/omnichannel/appearance.ts index 4d5417d580cb3..b43f5431266ae 100644 --- a/apps/meteor/server/api/v1/omnichannel/appearance.ts +++ b/apps/meteor/server/api/v1/omnichannel/appearance.ts @@ -5,7 +5,7 @@ import { isTruthy } from '@rocket.chat/tools'; import { API } from '../..'; import { findAppearance } from './lib/appearance'; -import { notifyOnSettingChangedById } from '../../../../app/lib/server/lib/notifyListener'; +import { notifyOnSettingChangedById } from '../../../lib/notifyListener'; import { updateAuditedByUser } from '../../../settings/lib/auditedSettingUpdates'; API.v1.addRoute( diff --git a/apps/meteor/server/api/v1/omnichannel/businessHours.ts b/apps/meteor/server/api/v1/omnichannel/businessHours.ts index e0386f80d9a63..b851a24804e03 100644 --- a/apps/meteor/server/api/v1/omnichannel/businessHours.ts +++ b/apps/meteor/server/api/v1/omnichannel/businessHours.ts @@ -10,7 +10,7 @@ import { } from '@rocket.chat/rest-typings'; import { API } from '../..'; -import { businessHourManager } from '../../../../app/livechat/server/business-hour'; +import { businessHourManager } from '../../../lib/omnichannel/business-hour'; import type { ExtractRoutesFromAPI } from '../../ApiClass'; import { findLivechatBusinessHour } from './lib/businessHours'; diff --git a/apps/meteor/server/api/v1/omnichannel/config.ts b/apps/meteor/server/api/v1/omnichannel/config.ts index e1214e4b1ae59..399b1f9147ee7 100644 --- a/apps/meteor/server/api/v1/omnichannel/config.ts +++ b/apps/meteor/server/api/v1/omnichannel/config.ts @@ -3,9 +3,9 @@ import mem from 'mem'; import { API } from '../..'; import { settings, findOpenRoom, getExtraConfigInfo, findAgent, findGuestWithoutActivity } from './lib/livechat'; -import { RoutingManager } from '../../../../app/livechat/server/lib/RoutingManager'; -import { online } from '../../../../app/livechat/server/lib/service-status'; -import { settings as serverSettings } from '../../../../app/settings/server'; +import { RoutingManager } from '../../../lib/omnichannel/RoutingManager'; +import { online } from '../../../lib/omnichannel/service-status'; +import { settings as serverSettings } from '../../../settings'; import type { ExtractRoutesFromAPI } from '../../ApiClass'; const cachedSettings = mem(settings, { diff --git a/apps/meteor/server/api/v1/omnichannel/contact.ts b/apps/meteor/server/api/v1/omnichannel/contact.ts index b52d4b9c5f2b7..b4fc7d0dc1eb7 100644 --- a/apps/meteor/server/api/v1/omnichannel/contact.ts +++ b/apps/meteor/server/api/v1/omnichannel/contact.ts @@ -20,14 +20,14 @@ import { Match, check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; import { API } from '../..'; -import { createContact } from '../../../../app/livechat/server/lib/contacts/createContact'; -import { disableContactById } from '../../../../app/livechat/server/lib/contacts/disableContact'; -import { getContactChannelsGrouped } from '../../../../app/livechat/server/lib/contacts/getContactChannelsGrouped'; -import { getContactHistory } from '../../../../app/livechat/server/lib/contacts/getContactHistory'; -import { getContacts } from '../../../../app/livechat/server/lib/contacts/getContacts'; -import { registerContact } from '../../../../app/livechat/server/lib/contacts/registerContact'; -import { resolveContactConflicts } from '../../../../app/livechat/server/lib/contacts/resolveContactConflicts'; -import { updateContact } from '../../../../app/livechat/server/lib/contacts/updateContact'; +import { createContact } from '../../../lib/omnichannel/contacts/createContact'; +import { disableContactById } from '../../../lib/omnichannel/contacts/disableContact'; +import { getContactChannelsGrouped } from '../../../lib/omnichannel/contacts/getContactChannelsGrouped'; +import { getContactHistory } from '../../../lib/omnichannel/contacts/getContactHistory'; +import { getContacts } from '../../../lib/omnichannel/contacts/getContacts'; +import { registerContact } from '../../../lib/omnichannel/contacts/registerContact'; +import { resolveContactConflicts } from '../../../lib/omnichannel/contacts/resolveContactConflicts'; +import { updateContact } from '../../../lib/omnichannel/contacts/updateContact'; import type { ExtractRoutesFromAPI } from '../../ApiClass'; import { getPaginationItems } from '../../lib/getPaginationItems'; diff --git a/apps/meteor/server/api/v1/omnichannel/customField.ts b/apps/meteor/server/api/v1/omnichannel/customField.ts index c536a51ababdc..3db071f66d84d 100644 --- a/apps/meteor/server/api/v1/omnichannel/customField.ts +++ b/apps/meteor/server/api/v1/omnichannel/customField.ts @@ -13,7 +13,7 @@ import { } from '@rocket.chat/rest-typings'; import { API } from '../..'; -import { setCustomFields, setMultipleCustomFields } from '../../../../app/livechat/server/lib/custom-fields'; +import { setCustomFields, setMultipleCustomFields } from '../../../lib/omnichannel/custom-fields'; import type { ExtractRoutesFromAPI } from '../../ApiClass'; import { findLivechatCustomFields, findCustomFieldById } from './lib/customFields'; import { findGuest } from './lib/livechat'; diff --git a/apps/meteor/server/api/v1/omnichannel/dashboards.ts b/apps/meteor/server/api/v1/omnichannel/dashboards.ts index 167d6786eedb8..66a5e8d7194b1 100644 --- a/apps/meteor/server/api/v1/omnichannel/dashboards.ts +++ b/apps/meteor/server/api/v1/omnichannel/dashboards.ts @@ -20,7 +20,7 @@ import { findAllAgentsStatusAsyncCached, findAllChatMetricsByDepartmentAsyncCached, findAllResponseTimeMetricsAsyncCached, -} from '../../../../app/livechat/server/lib/analytics/dashboards'; +} from '../../../lib/omnichannel/analytics/dashboards'; import type { ExtractRoutesFromAPI } from '../../ApiClass'; API.v1.addRoute( diff --git a/apps/meteor/server/api/v1/omnichannel/departments.ts b/apps/meteor/server/api/v1/omnichannel/departments.ts index 47bc953ac7bae..d7854bc95ec92 100644 --- a/apps/meteor/server/api/v1/omnichannel/departments.ts +++ b/apps/meteor/server/api/v1/omnichannel/departments.ts @@ -17,15 +17,15 @@ import { findDepartmentAgents, findArchivedDepartments, } from './lib/departments'; +import { hasPermissionAsync } from '../../../lib/authorization/hasPermission'; import { saveDepartment, archiveDepartment, unarchiveDepartment, saveDepartmentAgents, removeDepartment, -} from '../../../../app/livechat/server/lib/departmentsLib'; -import { settings } from '../../../../app/settings/server'; -import { hasPermissionAsync } from '../../../lib/authorization/hasPermission'; +} from '../../../lib/omnichannel/departmentsLib'; +import { settings } from '../../../settings'; import { getPaginationItems } from '../../lib/getPaginationItems'; API.v1.addRoute( diff --git a/apps/meteor/server/api/v1/omnichannel/inquiries.ts b/apps/meteor/server/api/v1/omnichannel/inquiries.ts index dde8a70ce7d15..f649a67b57f52 100644 --- a/apps/meteor/server/api/v1/omnichannel/inquiries.ts +++ b/apps/meteor/server/api/v1/omnichannel/inquiries.ts @@ -15,8 +15,8 @@ import { Meteor } from 'meteor/meteor'; import { API } from '../..'; import { findInquiries, findOneInquiryByRoomId } from './lib/inquiries'; -import { returnRoomAsInquiry } from '../../../../app/livechat/server/lib/rooms'; -import { takeInquiry } from '../../../../app/livechat/server/lib/takeInquiry'; +import { returnRoomAsInquiry } from '../../../lib/omnichannel/rooms'; +import { takeInquiry } from '../../../lib/omnichannel/takeInquiry'; import type { ExtractRoutesFromAPI } from '../../ApiClass'; import { getPaginationItems } from '../../lib/getPaginationItems'; diff --git a/apps/meteor/server/api/v1/omnichannel/integration.ts b/apps/meteor/server/api/v1/omnichannel/integration.ts index b4806617f1b69..666ce24dafd5d 100644 --- a/apps/meteor/server/api/v1/omnichannel/integration.ts +++ b/apps/meteor/server/api/v1/omnichannel/integration.ts @@ -2,8 +2,8 @@ import { Settings } from '@rocket.chat/models'; import { isPOSTomnichannelIntegrations } from '@rocket.chat/rest-typings'; import { API } from '../..'; -import { notifyOnSettingChangedById } from '../../../../app/lib/server/lib/notifyListener'; import { trim } from '../../../../lib/utils/stringUtils'; +import { notifyOnSettingChangedById } from '../../../lib/notifyListener'; import { updateAuditedByUser } from '../../../settings/lib/auditedSettingUpdates'; API.v1.addRoute( diff --git a/apps/meteor/server/api/v1/omnichannel/lib/businessHours.ts b/apps/meteor/server/api/v1/omnichannel/lib/businessHours.ts index 3d092dfccd003..aea70b7106d8d 100644 --- a/apps/meteor/server/api/v1/omnichannel/lib/businessHours.ts +++ b/apps/meteor/server/api/v1/omnichannel/lib/businessHours.ts @@ -1,6 +1,6 @@ import type { ILivechatBusinessHour } from '@rocket.chat/core-typings'; -import { businessHourManager } from '../../../../../app/livechat/server/business-hour'; +import { businessHourManager } from '../../../../lib/omnichannel/business-hour'; export async function findLivechatBusinessHour(id?: string, type?: string): Promise> { return { diff --git a/apps/meteor/server/api/v1/omnichannel/lib/inquiries.ts b/apps/meteor/server/api/v1/omnichannel/lib/inquiries.ts index 4cec193c1154e..8972bc8a46c2e 100644 --- a/apps/meteor/server/api/v1/omnichannel/lib/inquiries.ts +++ b/apps/meteor/server/api/v1/omnichannel/lib/inquiries.ts @@ -5,7 +5,7 @@ import type { PaginatedResult } from '@rocket.chat/rest-typings'; import type { Filter } from 'mongodb'; import { getOmniChatSortQuery } from '../../../../../app/livechat/lib/inquiries'; -import { getInquirySortMechanismSetting } from '../../../../../app/livechat/server/lib/settings'; +import { getInquirySortMechanismSetting } from '../../../../lib/omnichannel/settings'; const agentDepartments = async (userId: IUser['_id']): Promise => { const agentDepartments = (await LivechatDepartmentAgents.findByAgentId(userId, { projection: { departmentId: 1 } }).toArray()).map( diff --git a/apps/meteor/server/api/v1/omnichannel/lib/livechat.ts b/apps/meteor/server/api/v1/omnichannel/lib/livechat.ts index bd9665f5e6aa4..6f13432f04f77 100644 --- a/apps/meteor/server/api/v1/omnichannel/lib/livechat.ts +++ b/apps/meteor/server/api/v1/omnichannel/lib/livechat.ts @@ -4,9 +4,9 @@ import { EmojiCustom, LivechatTrigger, LivechatVisitors, LivechatRooms, Livechat import { makeFunction } from '@rocket.chat/patch-injection'; import { Meteor } from 'meteor/meteor'; -import { normalizeAgent } from '../../../../../app/livechat/server/lib/Helper'; -import { getInitSettings } from '../../../../../app/livechat/server/lib/settings'; import { callbacks } from '../../../../lib/callbacks'; +import { normalizeAgent } from '../../../../lib/omnichannel/Helper'; +import { getInitSettings } from '../../../../lib/omnichannel/settings'; async function findTriggers(): Promise[]> { const triggers = await LivechatTrigger.findEnabled().toArray(); diff --git a/apps/meteor/server/api/v1/omnichannel/message.ts b/apps/meteor/server/api/v1/omnichannel/message.ts index 5b63071339aaa..8df4be9915a13 100644 --- a/apps/meteor/server/api/v1/omnichannel/message.ts +++ b/apps/meteor/server/api/v1/omnichannel/message.ts @@ -13,11 +13,11 @@ import { import { API } from '../..'; import { findGuest, findRoom, normalizeHttpHeaderData } from './lib/livechat'; -import { updateMessage, deleteMessage, sendMessage } from '../../../../app/livechat/server/lib/messages'; -import { settings } from '../../../../app/settings/server'; -import { normalizeMessageFileUpload } from '../../../../app/utils/server/functions/normalizeMessageFileUpload'; import { callbacks } from '../../../lib/callbacks'; import { loadMessageHistory } from '../../../lib/messages/loadMessageHistory'; +import { updateMessage, deleteMessage, sendMessage } from '../../../lib/omnichannel/messages'; +import { normalizeMessageFileUpload } from '../../../lib/utils/functions/normalizeMessageFileUpload'; +import { settings } from '../../../settings'; import { getPaginationItems } from '../../lib/getPaginationItems'; import { isWidget } from '../../lib/isWidget'; diff --git a/apps/meteor/server/api/v1/omnichannel/offlineMessage.ts b/apps/meteor/server/api/v1/omnichannel/offlineMessage.ts index b31de75035ec5..6de03900a4a6a 100644 --- a/apps/meteor/server/api/v1/omnichannel/offlineMessage.ts +++ b/apps/meteor/server/api/v1/omnichannel/offlineMessage.ts @@ -1,8 +1,8 @@ import { isPOSTLivechatOfflineMessageParams } from '@rocket.chat/rest-typings'; import { API } from '../..'; -import { sendOfflineMessage } from '../../../../app/livechat/server/lib/messages'; import { i18n } from '../../../lib/i18n'; +import { sendOfflineMessage } from '../../../lib/omnichannel/messages'; API.v1.addRoute( 'livechat/offline.message', diff --git a/apps/meteor/server/api/v1/omnichannel/pageVisited.ts b/apps/meteor/server/api/v1/omnichannel/pageVisited.ts index 929a4fee88a27..84296cbaf6a1e 100644 --- a/apps/meteor/server/api/v1/omnichannel/pageVisited.ts +++ b/apps/meteor/server/api/v1/omnichannel/pageVisited.ts @@ -2,7 +2,7 @@ import type { IOmnichannelSystemMessage } from '@rocket.chat/core-typings'; import { isPOSTLivechatPageVisitedParams } from '@rocket.chat/rest-typings'; import { API } from '../..'; -import { savePageHistory } from '../../../../app/livechat/server/lib/tracking'; +import { savePageHistory } from '../../../lib/omnichannel/tracking'; API.v1.addRoute( 'livechat/page.visited', diff --git a/apps/meteor/server/api/v1/omnichannel/room.ts b/apps/meteor/server/api/v1/omnichannel/room.ts index 8a7984313e003..90ad0d207fad7 100644 --- a/apps/meteor/server/api/v1/omnichannel/room.ts +++ b/apps/meteor/server/api/v1/omnichannel/room.ts @@ -32,20 +32,20 @@ import { Meteor } from 'meteor/meteor'; import { API } from '../..'; import { findGuest, findRoom, settings, findAgent, onCheckRoomParams } from './lib/livechat'; -import { canAccessRoomAsync } from '../../../../app/authorization/server'; -import { normalizeTransferredByData } from '../../../../app/livechat/server/lib/Helper'; -import { closeRoom } from '../../../../app/livechat/server/lib/closeRoom'; -import { saveGuest } from '../../../../app/livechat/server/lib/guests'; -import type { CloseRoomParams } from '../../../../app/livechat/server/lib/localTypes'; -import { livechatLogger } from '../../../../app/livechat/server/lib/logger'; -import { createRoom, removeOmnichannelRoom, saveRoomInfo } from '../../../../app/livechat/server/lib/rooms'; -import { transfer } from '../../../../app/livechat/server/lib/transfer'; -import { settings as rcSettings } from '../../../../app/settings/server'; +import { canAccessRoomAsync } from '../../../lib/authorization'; import { hasPermissionAsync } from '../../../lib/authorization/hasPermission'; import { callbacks } from '../../../lib/callbacks'; import { i18n } from '../../../lib/i18n'; +import { normalizeTransferredByData } from '../../../lib/omnichannel/Helper'; import { closeLivechatRoom } from '../../../lib/omnichannel/closeLivechatRoom'; +import { closeRoom } from '../../../lib/omnichannel/closeRoom'; +import { saveGuest } from '../../../lib/omnichannel/guests'; +import type { CloseRoomParams } from '../../../lib/omnichannel/localTypes'; +import { livechatLogger } from '../../../lib/omnichannel/logger'; +import { createRoom, removeOmnichannelRoom, saveRoomInfo } from '../../../lib/omnichannel/rooms'; +import { transfer } from '../../../lib/omnichannel/transfer'; import { addUserToRoom } from '../../../lib/rooms/addUserToRoom'; +import { settings as rcSettings } from '../../../settings'; import type { ExtractRoutesFromAPI } from '../../ApiClass'; import { isWidget } from '../../lib/isWidget'; diff --git a/apps/meteor/server/api/v1/omnichannel/sms.ts b/apps/meteor/server/api/v1/omnichannel/sms.ts index e421229ebc75a..c6a823dff4af7 100644 --- a/apps/meteor/server/api/v1/omnichannel/sms.ts +++ b/apps/meteor/server/api/v1/omnichannel/sms.ts @@ -17,12 +17,12 @@ import { Meteor } from 'meteor/meteor'; import { API } from '../..'; import { setCustomField } from './lib/customFields'; -import type { ILivechatMessage } from '../../../../app/livechat/server/lib/localTypes'; -import { sendMessage } from '../../../../app/livechat/server/lib/messages'; -import { createRoom } from '../../../../app/livechat/server/lib/rooms'; -import { settings } from '../../../../app/settings/server'; import { getFileExtension } from '../../../../lib/utils/getFileExtension'; import { FileUpload } from '../../../lib/media/file-upload'; +import type { ILivechatMessage } from '../../../lib/omnichannel/localTypes'; +import { sendMessage } from '../../../lib/omnichannel/messages'; +import { createRoom } from '../../../lib/omnichannel/rooms'; +import { settings } from '../../../settings'; const logger = new Logger('SMS'); diff --git a/apps/meteor/server/api/v1/omnichannel/statistics.ts b/apps/meteor/server/api/v1/omnichannel/statistics.ts index 7ff0751cd0bf7..cece06069173e 100644 --- a/apps/meteor/server/api/v1/omnichannel/statistics.ts +++ b/apps/meteor/server/api/v1/omnichannel/statistics.ts @@ -2,8 +2,8 @@ import { Users } from '@rocket.chat/models'; import { isLivechatAnalyticsAgentOverviewProps, isLivechatAnalyticsOverviewProps } from '@rocket.chat/rest-typings'; import { API } from '../..'; -import { getAgentOverviewDataCached, getAnalyticsOverviewDataCached } from '../../../../app/livechat/server/lib/AnalyticsTyped'; -import { settings } from '../../../../app/settings/server'; +import { getAgentOverviewDataCached, getAnalyticsOverviewDataCached } from '../../../lib/omnichannel/AnalyticsTyped'; +import { settings } from '../../../settings'; API.v1.addRoute( 'livechat/analytics/agent-overview', diff --git a/apps/meteor/server/api/v1/omnichannel/transcript.ts b/apps/meteor/server/api/v1/omnichannel/transcript.ts index 4b37faca03538..f64b9ed2fa1cc 100644 --- a/apps/meteor/server/api/v1/omnichannel/transcript.ts +++ b/apps/meteor/server/api/v1/omnichannel/transcript.ts @@ -4,8 +4,8 @@ import { LivechatRooms, Users } from '@rocket.chat/models'; import { isPOSTLivechatTranscriptParams, isPOSTLivechatTranscriptRequestParams } from '@rocket.chat/rest-typings'; import { API } from '../..'; -import { sendTranscript, requestTranscript } from '../../../../app/livechat/server/lib/sendTranscript'; import { i18n } from '../../../lib/i18n'; +import { sendTranscript, requestTranscript } from '../../../lib/omnichannel/sendTranscript'; API.v1.addRoute( 'livechat/transcript', diff --git a/apps/meteor/server/api/v1/omnichannel/upload.ts b/apps/meteor/server/api/v1/omnichannel/upload.ts index 621c9c40f78e4..f1618cb06f4d7 100644 --- a/apps/meteor/server/api/v1/omnichannel/upload.ts +++ b/apps/meteor/server/api/v1/omnichannel/upload.ts @@ -1,10 +1,10 @@ import { LivechatVisitors, LivechatRooms } from '@rocket.chat/models'; import { API } from '../..'; -import { settings } from '../../../../app/settings/server'; -import { fileUploadIsValidContentType } from '../../../../app/utils/server/restrictions'; import { FileUpload } from '../../../lib/media/file-upload'; +import { fileUploadIsValidContentType } from '../../../lib/utils/restrictions'; import { sendFileLivechatMessage } from '../../../meteor-methods/omnichannel/sendFileLivechatMessage'; +import { settings } from '../../../settings'; import { MultipartUploadHandler } from '../../lib/MultipartUploadHandler'; API.v1.addRoute('livechat/upload/:rid', { diff --git a/apps/meteor/server/api/v1/omnichannel/users.ts b/apps/meteor/server/api/v1/omnichannel/users.ts index e2e7ac0ec55cc..0290ca4b260e2 100644 --- a/apps/meteor/server/api/v1/omnichannel/users.ts +++ b/apps/meteor/server/api/v1/omnichannel/users.ts @@ -4,8 +4,8 @@ import { check } from 'meteor/check'; import { API } from '../..'; import { findAgents, findManagers } from './lib/users'; -import { addManager, addAgent, removeAgent, removeManager } from '../../../../app/livechat/server/lib/omni-users'; import { hasAtLeastOnePermissionAsync } from '../../../lib/authorization/hasPermission'; +import { addManager, addAgent, removeAgent, removeManager } from '../../../lib/omnichannel/omni-users'; import { getPaginationItems } from '../../lib/getPaginationItems'; const emptyStringArray: string[] = []; diff --git a/apps/meteor/server/api/v1/omnichannel/visitor.ts b/apps/meteor/server/api/v1/omnichannel/visitor.ts index 23e1eca6ab2de..f19c36f60a017 100644 --- a/apps/meteor/server/api/v1/omnichannel/visitor.ts +++ b/apps/meteor/server/api/v1/omnichannel/visitor.ts @@ -6,12 +6,12 @@ import { Meteor } from 'meteor/meteor'; import { API } from '../..'; import { findGuest, normalizeHttpHeaderData } from './lib/livechat'; -import { setMultipleVisitorCustomFields } from '../../../../app/livechat/server/lib/custom-fields'; -import { notifyGuestStatusChanged, removeContactsByVisitorId } from '../../../../app/livechat/server/lib/guests'; -import { livechatLogger } from '../../../../app/livechat/server/lib/logger'; -import { saveRoomInfo } from '../../../../app/livechat/server/lib/rooms'; -import { settings } from '../../../../app/settings/server'; import { callbacks } from '../../../lib/callbacks'; +import { setMultipleVisitorCustomFields } from '../../../lib/omnichannel/custom-fields'; +import { notifyGuestStatusChanged, removeContactsByVisitorId } from '../../../lib/omnichannel/guests'; +import { livechatLogger } from '../../../lib/omnichannel/logger'; +import { saveRoomInfo } from '../../../lib/omnichannel/rooms'; +import { settings } from '../../../settings'; API.v1.addRoute( 'livechat/visitor', diff --git a/apps/meteor/server/api/v1/omnichannel/visitors.ts b/apps/meteor/server/api/v1/omnichannel/visitors.ts index f85800cae826d..0ede04d92ad06 100644 --- a/apps/meteor/server/api/v1/omnichannel/visitors.ts +++ b/apps/meteor/server/api/v1/omnichannel/visitors.ts @@ -19,8 +19,8 @@ import { findVisitorsToAutocomplete, findVisitorsByEmailOrPhoneOrNameOrUsernameOrCustomField, } from './lib/visitors'; -import { canAccessRoomAsync } from '../../../../app/authorization/server'; -import { normalizeMessagesForUser } from '../../../../app/utils/server/lib/normalizeMessagesForUser'; +import { canAccessRoomAsync } from '../../../lib/authorization'; +import { normalizeMessagesForUser } from '../../../lib/utils/lib/normalizeMessagesForUser'; import { getPaginationItems } from '../../lib/getPaginationItems'; API.v1.addRoute( diff --git a/apps/meteor/server/api/v1/omnichannel/webhooks.ts b/apps/meteor/server/api/v1/omnichannel/webhooks.ts index 555bfc6ce780b..d77910ea72785 100644 --- a/apps/meteor/server/api/v1/omnichannel/webhooks.ts +++ b/apps/meteor/server/api/v1/omnichannel/webhooks.ts @@ -3,7 +3,7 @@ import type { ExtendedFetchOptions } from '@rocket.chat/server-fetch'; import { serverFetch as fetch } from '@rocket.chat/server-fetch'; import { API } from '../..'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; const logger = new Logger('WebhookTest'); diff --git a/apps/meteor/server/api/v1/permissions.ts b/apps/meteor/server/api/v1/permissions.ts index 4dd4dad5d9c10..86e6f821f216e 100644 --- a/apps/meteor/server/api/v1/permissions.ts +++ b/apps/meteor/server/api/v1/permissions.ts @@ -9,9 +9,9 @@ import { } from '@rocket.chat/rest-typings'; import { Meteor } from 'meteor/meteor'; -import { permissionsGetMethod } from '../../../app/authorization/server/streamer/permissions'; -import { notifyOnPermissionChangedById } from '../../../app/lib/server/lib/notifyListener'; import { addPermissionToRoleMethod, removeRoleFromPermissionMethod } from '../../lib/authorization/permissionRole'; +import { permissionsGetMethod } from '../../lib/authorization/streamer/permissions'; +import { notifyOnPermissionChangedById } from '../../lib/notifyListener'; import type { ExtractRoutesFromAPI } from '../ApiClass'; import { API } from '../api'; diff --git a/apps/meteor/server/api/v1/push.ts b/apps/meteor/server/api/v1/push.ts index f7eec002cc1f8..987471ac85e70 100644 --- a/apps/meteor/server/api/v1/push.ts +++ b/apps/meteor/server/api/v1/push.ts @@ -14,10 +14,10 @@ import type { JSONSchemaType } from 'ajv'; import { Accounts } from 'meteor/accounts-base'; import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../app/settings/server'; import { canAccessRoomAsync } from '../../lib/authorization/canAccessRoom'; import PushNotification from '../../lib/notifications/push-config/lib/PushNotification'; import { executePushTest } from '../../lib/pushConfig'; +import { settings } from '../../settings'; import type { ExtractRoutesFromAPI } from '../ApiClass'; import { API } from '../api'; import type { SuccessResult } from '../definition'; diff --git a/apps/meteor/server/api/v1/roles.ts b/apps/meteor/server/api/v1/roles.ts index 23b74c2db50ed..df869a08fe919 100644 --- a/apps/meteor/server/api/v1/roles.ts +++ b/apps/meteor/server/api/v1/roles.ts @@ -14,13 +14,13 @@ import { } from '@rocket.chat/rest-typings'; import { Meteor } from 'meteor/meteor'; -import { notifyOnRoleChanged } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; import { getUsersInRolePaginated } from '../../lib/authorization/getUsersInRole'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { hasRoleAsync, hasAnyRoleAsync } from '../../lib/authorization/hasRole'; +import { notifyOnRoleChanged } from '../../lib/notifyListener'; import { removeUserFromRolesAsync } from '../../lib/roles/removeUserFromRoles'; import { addUserToRole } from '../../meteor-methods/auth/addUserToRole'; +import { settings } from '../../settings'; import type { ExtractRoutesFromAPI } from '../ApiClass'; import { API } from '../api'; import { getPaginationItems } from '../lib/getPaginationItems'; diff --git a/apps/meteor/server/api/v1/rooms.ts b/apps/meteor/server/api/v1/rooms.ts index 464dbf655ae97..a41458226201e 100644 --- a/apps/meteor/server/api/v1/rooms.ts +++ b/apps/meteor/server/api/v1/rooms.ts @@ -45,19 +45,18 @@ import { import { isTruthy } from '@rocket.chat/tools'; import { Meteor } from 'meteor/meteor'; -import { stripABACManagedFieldsForAdmin } from '../../../app/authorization/server/lib/isABACManagedRoom'; -import { notifyOnSubscriptionChanged } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; import { adminFields } from '../../../lib/rooms/adminFields'; import { omit } from '../../../lib/utils/omit'; import { canAccessRoomAsync, canAccessRoomIdAsync } from '../../lib/authorization/canAccessRoom'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { stripABACManagedFieldsForAdmin } from '../../lib/authorization/isABACManagedRoom'; import { banUserFromRoomMethod } from '../../lib/banUserFromRoom'; import { applyAirGappedRestrictionsValidation } from '../../lib/cloud/license/airGappedRestrictionsWrapper'; import * as dataExport from '../../lib/dataExport'; import { eraseRoom } from '../../lib/eraseRoom'; import { findUsersOfRoomOrderedByRole } from '../../lib/findUsersOfRoomOrderedByRole'; import { FileUpload } from '../../lib/media/file-upload'; +import { notifyOnSubscriptionChanged } from '../../lib/notifyListener'; import { openRoom } from '../../lib/openRoom'; import type { RoomRoles } from '../../lib/roles/getRoomRoles'; import { syncRolePrioritiesForRoomIfRequired } from '../../lib/rooms/syncRolePrioritiesForRoomIfRequired'; @@ -77,6 +76,7 @@ import { unmuteUserInRoom } from '../../meteor-methods/rooms/unmuteUserInRoom'; import { saveNotificationSettingsMethod } from '../../meteor-methods/users/saveNotificationSettings'; import type { NotificationFieldType } from '../../meteor-methods/users/saveNotificationSettings'; import { roomsGetMethod } from '../../publications/room'; +import { settings } from '../../settings'; import type { ExtractRoutesFromAPI } from '../ApiClass'; import { API } from '../api'; import { MultipartUploadHandler } from '../lib/MultipartUploadHandler'; diff --git a/apps/meteor/server/api/v1/settings.ts b/apps/meteor/server/api/v1/settings.ts index 18196b1d6a710..95345320fe426 100644 --- a/apps/meteor/server/api/v1/settings.ts +++ b/apps/meteor/server/api/v1/settings.ts @@ -24,15 +24,15 @@ import { Meteor } from 'meteor/meteor'; import type { FindOptions } from 'mongodb'; import _ from 'underscore'; -import { saveSettingsBulk } from '../../../app/lib/server/functions/saveSettingsBulk'; -import { checkSettingValueBounds } from '../../../app/lib/server/lib/checkSettingValueBonds'; -import { notifyOnSettingChanged, notifyOnSettingChangedById } from '../../../app/lib/server/lib/notifyListener'; -import { SettingsEvents, settings } from '../../../app/settings/server'; -import { setValue } from '../../../app/settings/server/raw'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { notifyOnSettingChanged, notifyOnSettingChangedById } from '../../lib/notifyListener'; import { disableCustomScripts } from '../../lib/shared/disableCustomScripts'; import { addOAuthServiceMethod } from '../../meteor-methods/auth/addOAuthService'; +import { SettingsEvents, settings } from '../../settings'; +import { checkSettingValueBounds } from '../../settings/checkSettingValueBonds'; import { updateAuditedByUser } from '../../settings/lib/auditedSettingUpdates'; +import { saveSettingsBulk } from '../../settings/lib/saveSettingsBulk'; +import { setValue } from '../../settings/raw'; import { API } from '../api'; import { getPaginationItems } from '../lib/getPaginationItems'; diff --git a/apps/meteor/server/api/v1/teams.ts b/apps/meteor/server/api/v1/teams.ts index 8fbb73137db1a..54ce29fe8235f 100644 --- a/apps/meteor/server/api/v1/teams.ts +++ b/apps/meteor/server/api/v1/teams.ts @@ -28,11 +28,11 @@ import { } from '@rocket.chat/rest-typings'; import { escapeRegExp } from '@rocket.chat/string-helpers'; -import { canAccessRoomAsync } from '../../../app/authorization/server'; -import { settings } from '../../../app/settings/server'; +import { canAccessRoomAsync } from '../../lib/authorization'; import { hasPermissionAsync, hasAtLeastOnePermissionAsync, hasAllPermissionAsync } from '../../lib/authorization/hasPermission'; import { eraseRoom } from '../../lib/eraseRoom'; import { removeUserFromRoom } from '../../lib/rooms/removeUserFromRoom'; +import { settings } from '../../settings'; import type { ExtractRoutesFromAPI } from '../ApiClass'; import { API } from '../api'; import { eraseTeam } from '../lib/eraseTeam'; diff --git a/apps/meteor/server/api/v1/users.ts b/apps/meteor/server/api/v1/users.ts index 7024b9eed3b4b..f5f2350bac349 100644 --- a/apps/meteor/server/api/v1/users.ts +++ b/apps/meteor/server/api/v1/users.ts @@ -36,10 +36,6 @@ import { Match, check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; import type { Filter } from 'mongodb'; -import { notifyOnUserChange, notifyOnUserChangeAsync } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; -import { isSMTPConfigured } from '../../../app/utils/server/functions/isSMTPConfigured'; -import { getURL } from '../../../app/utils/server/getURL'; import { generatePersonalAccessTokenOfUser } from '../../../imports/personal-access-tokens/server/api/methods/generateToken'; import { regeneratePersonalAccessTokenOfUser } from '../../../imports/personal-access-tokens/server/api/methods/regenerateToken'; import { removePersonalAccessTokenOfUser } from '../../../imports/personal-access-tokens/server/api/methods/removeToken'; @@ -50,6 +46,7 @@ import { UserChangedAuditStore } from '../../lib/auditServerEvents/userChanged'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { i18n } from '../../lib/i18n'; import { SystemLogger } from '../../lib/logger/system'; +import { notifyOnUserChange, notifyOnUserChangeAsync } from '../../lib/notifyListener'; import { resetUserE2EEncriptionKey } from '../../lib/resetUserE2EKey'; import { validateNameChars } from '../../lib/shared/validateNameChars'; import { checkEmailAvailability } from '../../lib/users/checkEmailAvailability'; @@ -68,6 +65,8 @@ import { setUserAvatar } from '../../lib/users/setUserAvatar'; import { setUsernameWithValidation } from '../../lib/users/setUsername'; import { validateCustomFields } from '../../lib/users/validateCustomFields'; import { validateUsername } from '../../lib/users/validateUsername'; +import { isSMTPConfigured } from '../../lib/utils/functions/isSMTPConfigured'; +import { getURL } from '../../lib/utils/getURL'; import { generateAccessToken } from '../../meteor-methods/auth/createToken'; import { sendConfirmationEmail } from '../../meteor-methods/auth/sendConfirmationEmail'; import { sendForgotPasswordEmail } from '../../meteor-methods/auth/sendForgotPasswordEmail'; @@ -78,6 +77,7 @@ import { resetAvatar } from '../../meteor-methods/users/resetAvatar'; import { saveUserPreferences } from '../../meteor-methods/users/saveUserPreferences'; import { executeSaveUserProfile } from '../../meteor-methods/users/saveUserProfile'; import { executeSetUserActiveStatus } from '../../meteor-methods/users/setUserActiveStatus'; +import { settings } from '../../settings'; import type { ExtractRoutesFromAPI } from '../ApiClass'; import { API } from '../api'; import { getPaginationItems } from '../lib/getPaginationItems'; diff --git a/apps/meteor/server/api/webhooks.ts b/apps/meteor/server/api/webhooks.ts index 7d8b1827ed5ae..179fa2151826e 100644 --- a/apps/meteor/server/api/webhooks.ts +++ b/apps/meteor/server/api/webhooks.ts @@ -13,14 +13,14 @@ import type { RateLimiterOptions } from './api'; import { API, defaultRateLimiterOptions } from './api'; import type { FailureResult, GenericRouteExecutionContext, SuccessResult, UnavailableResult } from './definition'; import type { APIActionContext } from './router'; +import { isPlainObject } from '../../lib/utils/isPlainObject'; +import { hasPermissionAsync } from '../lib/authorization/hasPermission'; +import { IsolatedVMScriptEngine } from '../lib/integrations/lib/isolated-vm/isolated-vm'; import { metrics } from '../lib/metrics'; +import { settings } from '../settings'; import { loggerMiddleware } from './v1/middlewares/logger'; import { metricsMiddleware } from './v1/middlewares/metrics'; import { tracerSpanMiddleware } from './v1/middlewares/tracer'; -import { settings } from '../../app/settings/server'; -import { isPlainObject } from '../../lib/utils/isPlainObject'; -import { hasPermissionAsync } from '../lib/authorization/hasPermission'; -import { IsolatedVMScriptEngine } from '../lib/integrations/lib/isolated-vm/isolated-vm'; import { incomingLogger, integrationLogger } from '../lib/integrations/logger'; import type { WebhookResponseItem } from '../lib/messages/processWebhookMessage'; import { processWebhookMessage } from '../lib/messages/processWebhookMessage'; diff --git a/apps/meteor/server/bridges/irc/irc-bridge/index.js b/apps/meteor/server/bridges/irc/irc-bridge/index.js index 137714827afa3..056b4ddd03b7d 100644 --- a/apps/meteor/server/bridges/irc/irc-bridge/index.js +++ b/apps/meteor/server/bridges/irc/irc-bridge/index.js @@ -3,15 +3,15 @@ import { Settings } from '@rocket.chat/models'; import moment from 'moment'; import Queue from 'queue-fifo'; -import { notifyOnSettingChangedById } from '../../../../app/lib/server/lib/notifyListener'; +import * as localCommandHandlers from './localHandlers'; +import * as peerCommandHandlers from './peerHandlers'; import { withThrottling } from '../../../../lib/utils/highOrderFunctions'; import { callbacks } from '../../../lib/callbacks'; import { afterLeaveRoomCallback } from '../../../lib/callbacks/afterLeaveRoomCallback'; import { afterLogoutCleanUpCallback } from '../../../lib/callbacks/afterLogoutCleanUpCallback'; +import { notifyOnSettingChangedById } from '../../../lib/notifyListener'; import { updateAuditedBySystem } from '../../../settings/lib/auditedSettingUpdates'; import * as servers from '../servers'; -import * as localCommandHandlers from './localHandlers'; -import * as peerCommandHandlers from './peerHandlers'; const logger = new Logger('IRC Bridge'); const queueLogger = logger.section('Queue'); diff --git a/apps/meteor/server/bridges/irc/irc-bridge/peerHandlers/disconnected.js b/apps/meteor/server/bridges/irc/irc-bridge/peerHandlers/disconnected.js index 2b6b699f779bf..33844547434ed 100644 --- a/apps/meteor/server/bridges/irc/irc-bridge/peerHandlers/disconnected.js +++ b/apps/meteor/server/bridges/irc/irc-bridge/peerHandlers/disconnected.js @@ -1,6 +1,6 @@ import { Users } from '@rocket.chat/models'; -import { notifyOnUserChange } from '../../../../../app/lib/server/lib/notifyListener'; +import { notifyOnUserChange } from '../../../../lib/notifyListener'; export default async function handleQUIT(args) { const user = await Users.findOne({ diff --git a/apps/meteor/server/bridges/irc/irc-bridge/peerHandlers/nickChanged.js b/apps/meteor/server/bridges/irc/irc-bridge/peerHandlers/nickChanged.js index cad3bc5683e34..6f7883e3662d1 100644 --- a/apps/meteor/server/bridges/irc/irc-bridge/peerHandlers/nickChanged.js +++ b/apps/meteor/server/bridges/irc/irc-bridge/peerHandlers/nickChanged.js @@ -1,6 +1,6 @@ import { Users } from '@rocket.chat/models'; -import { notifyOnUserChange } from '../../../../../app/lib/server/lib/notifyListener'; +import { notifyOnUserChange } from '../../../../lib/notifyListener'; export default async function handleNickChanged(args) { const user = await Users.findOne({ diff --git a/apps/meteor/server/bridges/irc/irc-bridge/peerHandlers/userRegistered.js b/apps/meteor/server/bridges/irc/irc-bridge/peerHandlers/userRegistered.js index b3bba8da0578f..f429970dabea2 100644 --- a/apps/meteor/server/bridges/irc/irc-bridge/peerHandlers/userRegistered.js +++ b/apps/meteor/server/bridges/irc/irc-bridge/peerHandlers/userRegistered.js @@ -1,6 +1,6 @@ import { Users } from '@rocket.chat/models'; -import { notifyOnUserChange } from '../../../../../app/lib/server/lib/notifyListener'; +import { notifyOnUserChange } from '../../../../lib/notifyListener'; export default async function handleUserRegistered(args) { // Check if there is an user with the given username diff --git a/apps/meteor/server/bridges/irc/methods/resetIrcConnection.ts b/apps/meteor/server/bridges/irc/methods/resetIrcConnection.ts index da639fd8d67c1..b201f7f3fe218 100644 --- a/apps/meteor/server/bridges/irc/methods/resetIrcConnection.ts +++ b/apps/meteor/server/bridges/irc/methods/resetIrcConnection.ts @@ -2,9 +2,9 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Settings } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { notifyOnSettingChangedById } from '../../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../../app/settings/server'; import { hasPermissionAsync } from '../../../lib/authorization/hasPermission'; +import { notifyOnSettingChangedById } from '../../../lib/notifyListener'; +import { settings } from '../../../settings'; import { updateAuditedByUser } from '../../../settings/lib/auditedSettingUpdates'; import Bridge from '../irc-bridge'; diff --git a/apps/meteor/server/bridges/nextcloud/addWebdavServer.ts b/apps/meteor/server/bridges/nextcloud/addWebdavServer.ts index 671a83a73e096..d41bfb11480e6 100644 --- a/apps/meteor/server/bridges/nextcloud/addWebdavServer.ts +++ b/apps/meteor/server/bridges/nextcloud/addWebdavServer.ts @@ -1,8 +1,8 @@ import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../app/settings/server'; import { callbacks } from '../../lib/callbacks'; import { SystemLogger } from '../../lib/logger/system'; +import { settings } from '../../settings'; import { addWebdavAccountByToken } from '../webdav/methods/addWebdavAccount'; Meteor.startup(() => { diff --git a/apps/meteor/server/bridges/nextcloud/lib.ts b/apps/meteor/server/bridges/nextcloud/lib.ts index deff356908a42..fab4ec7d06280 100644 --- a/apps/meteor/server/bridges/nextcloud/lib.ts +++ b/apps/meteor/server/bridges/nextcloud/lib.ts @@ -2,9 +2,9 @@ import type { OAuthConfiguration } from '@rocket.chat/core-typings'; import { Meteor } from 'meteor/meteor'; import passport from 'passport'; -import { settings } from '../../../app/settings/server'; import { CustomOAuth } from '../../lib/auth-providers/custom-oauth/custom_oauth_server'; import { addPassportCustomOAuth } from '../../lib/oauth/addPassportCustomOAuth'; +import { settings } from '../../settings'; const NEXTCLOUD_PATHS = { serverURL: '', diff --git a/apps/meteor/app/slackbridge/README.md b/apps/meteor/server/bridges/slack/README.md similarity index 100% rename from apps/meteor/app/slackbridge/README.md rename to apps/meteor/server/bridges/slack/README.md diff --git a/apps/meteor/server/bridges/slack/RocketAdapter.ts b/apps/meteor/server/bridges/slack/RocketAdapter.ts index c035955ae811b..724213ea7273e 100644 --- a/apps/meteor/server/bridges/slack/RocketAdapter.ts +++ b/apps/meteor/server/bridges/slack/RocketAdapter.ts @@ -12,12 +12,12 @@ import { Meteor } from 'meteor/meteor'; import _ from 'underscore'; import { rocketLogger } from './logger'; -import { settings } from '../../../app/settings/server'; import { sleep } from '../../../lib/utils/sleep'; import { callbacks } from '../../lib/callbacks'; import { sendMessage } from '../../lib/messages/sendMessage'; import { createRoom } from '../../lib/rooms/createRoom'; import { setUserAvatar } from '../../lib/users/setUserAvatar'; +import { settings } from '../../settings'; export default class RocketAdapter { constructor(slackBridge) { diff --git a/apps/meteor/server/bridges/slack/SlackAdapter.ts b/apps/meteor/server/bridges/slack/SlackAdapter.ts index ddd041eb3829d..d84c9069444b1 100644 --- a/apps/meteor/server/bridges/slack/SlackAdapter.ts +++ b/apps/meteor/server/bridges/slack/SlackAdapter.ts @@ -16,9 +16,6 @@ import { Meteor } from 'meteor/meteor'; import { SlackAPI } from './SlackAPI'; import { slackLogger } from './logger'; -import { saveRoomName, saveRoomTopic } from '../../../app/channel-settings/server'; -import { settings } from '../../../app/settings/server'; -import { getUserAvatarURL } from '../../../app/utils/server/getUserAvatarURL'; import { FileUpload } from '../../lib/media/file-upload'; import { deleteMessage } from '../../lib/messages/deleteMessage'; import { sendMessage } from '../../lib/messages/sendMessage'; @@ -27,7 +24,10 @@ import { executeSetReaction } from '../../lib/messaging/reactions/setReaction'; import { addUserToRoom } from '../../lib/rooms/addUserToRoom'; import { archiveRoom } from '../../lib/rooms/archiveRoom'; import { removeUserFromRoom } from '../../lib/rooms/removeUserFromRoom'; +import { saveRoomName, saveRoomTopic } from '../../lib/rooms/settings'; import { unarchiveRoom } from '../../lib/rooms/unarchiveRoom'; +import { getUserAvatarURL } from '../../lib/utils/getUserAvatarURL'; +import { settings } from '../../settings'; export default class SlackAdapter { constructor(slackBridge) { diff --git a/apps/meteor/server/bridges/slack/removeChannelLinks.ts b/apps/meteor/server/bridges/slack/removeChannelLinks.ts index 412f5952a9e71..1351afca8c4c8 100644 --- a/apps/meteor/server/bridges/slack/removeChannelLinks.ts +++ b/apps/meteor/server/bridges/slack/removeChannelLinks.ts @@ -2,8 +2,8 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Rooms } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../app/settings/server'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/bridges/slack/slackbridge.ts b/apps/meteor/server/bridges/slack/slackbridge.ts index bf27831dcde96..baca928ca4d81 100644 --- a/apps/meteor/server/bridges/slack/slackbridge.ts +++ b/apps/meteor/server/bridges/slack/slackbridge.ts @@ -8,7 +8,7 @@ import { debounce } from 'lodash'; import RocketAdapter from './RocketAdapter'; import SlackAdapter from './SlackAdapter'; import { classLogger, connLogger } from './logger'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; /** * SlackBridge interfaces between this Rocket installation and a remote Slack installation. diff --git a/apps/meteor/server/bridges/slack/slackbridge_import.server.ts b/apps/meteor/server/bridges/slack/slackbridge_import.server.ts index 6eef73a7a8b79..8343a42e5afeb 100644 --- a/apps/meteor/server/bridges/slack/slackbridge_import.server.ts +++ b/apps/meteor/server/bridges/slack/slackbridge_import.server.ts @@ -7,9 +7,9 @@ import { Random } from '@rocket.chat/random'; import { Match } from 'meteor/check'; import { SlackBridge } from './slackbridge'; -import { msgStream } from '../../../app/lib/server'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; import { i18n } from '../../lib/i18n'; +import { msgStream } from '../../lib/messaging/msgStream'; +import { slashCommands } from '../../lib/utils/slashCommand'; async function SlackBridgeImport({ command, params, message, userId }) { if (command !== 'slackbridge-import' || !Match.test(params, String)) { diff --git a/apps/meteor/server/bridges/smarsh/functions/generateEml.ts b/apps/meteor/server/bridges/smarsh/functions/generateEml.ts index 6fdf42cb4770c..a2ddbd61cb0f2 100644 --- a/apps/meteor/server/bridges/smarsh/functions/generateEml.ts +++ b/apps/meteor/server/bridges/smarsh/functions/generateEml.ts @@ -4,8 +4,8 @@ import { Meteor } from 'meteor/meteor'; import moment from 'moment-timezone'; import { sendEmail } from './sendEmail'; -import { settings } from '../../../../app/settings/server'; import { i18n } from '../../../lib/i18n'; +import { settings } from '../../../settings'; const start = ''; diff --git a/apps/meteor/server/bridges/smarsh/functions/sendEmail.ts b/apps/meteor/server/bridges/smarsh/functions/sendEmail.ts index 99027839f3303..d21acaed023f1 100644 --- a/apps/meteor/server/bridges/smarsh/functions/sendEmail.ts +++ b/apps/meteor/server/bridges/smarsh/functions/sendEmail.ts @@ -6,8 +6,8 @@ // } import { Uploads } from '@rocket.chat/models'; -import { settings } from '../../../../app/settings/server'; import * as Mailer from '../../../lib/notifications/email/api'; +import { settings } from '../../../settings'; import { UploadFS } from '../../../ufs'; export const sendEmail = async (data: { files: string[]; subject: string; body: string }) => { diff --git a/apps/meteor/server/bridges/smarsh/startup.ts b/apps/meteor/server/bridges/smarsh/startup.ts index 57376f026dd92..778d9eacc00da 100644 --- a/apps/meteor/server/bridges/smarsh/startup.ts +++ b/apps/meteor/server/bridges/smarsh/startup.ts @@ -1,7 +1,7 @@ import { cronJobs } from '@rocket.chat/cron'; import { generateEml } from './functions/generateEml'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; import { smarshIntervalValuesToCronMap } from '../../settings/smarsh'; const smarshJobName = 'Smarsh EML Connector'; diff --git a/apps/meteor/server/bridges/webdav/methods/addWebdavAccount.ts b/apps/meteor/server/bridges/webdav/methods/addWebdavAccount.ts index 2c8beb5537cd9..ed6bec6deada4 100644 --- a/apps/meteor/server/bridges/webdav/methods/addWebdavAccount.ts +++ b/apps/meteor/server/bridges/webdav/methods/addWebdavAccount.ts @@ -5,7 +5,7 @@ import { WebdavAccounts } from '@rocket.chat/models'; import { Match, check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; import { WebdavClientAdapter } from '../lib/webdavClientAdapter'; declare module '@rocket.chat/ddp-client' { diff --git a/apps/meteor/server/bridges/webdav/methods/getFileFromWebdav.ts b/apps/meteor/server/bridges/webdav/methods/getFileFromWebdav.ts index 0d0bfe369f5cd..b1bcec7b81cc5 100644 --- a/apps/meteor/server/bridges/webdav/methods/getFileFromWebdav.ts +++ b/apps/meteor/server/bridges/webdav/methods/getFileFromWebdav.ts @@ -3,7 +3,7 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { WebdavAccounts } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; import { getWebdavCredentials } from '../lib/getWebdavCredentials'; import { WebdavClientAdapter } from '../lib/webdavClientAdapter'; diff --git a/apps/meteor/server/bridges/webdav/methods/getWebdavFileList.ts b/apps/meteor/server/bridges/webdav/methods/getWebdavFileList.ts index 4e1f503bf64da..687b0da3df2fe 100644 --- a/apps/meteor/server/bridges/webdav/methods/getWebdavFileList.ts +++ b/apps/meteor/server/bridges/webdav/methods/getWebdavFileList.ts @@ -3,7 +3,7 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { WebdavAccounts } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; import { getWebdavCredentials } from '../lib/getWebdavCredentials'; import { WebdavClientAdapter } from '../lib/webdavClientAdapter'; diff --git a/apps/meteor/server/bridges/webdav/methods/getWebdavFilePreview.ts b/apps/meteor/server/bridges/webdav/methods/getWebdavFilePreview.ts index 5cdbdd7ae0a97..181cf51b452ca 100644 --- a/apps/meteor/server/bridges/webdav/methods/getWebdavFilePreview.ts +++ b/apps/meteor/server/bridges/webdav/methods/getWebdavFilePreview.ts @@ -4,7 +4,7 @@ import { WebdavAccounts } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; import { createClient } from 'webdav'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; import { getWebdavCredentials } from '../lib/getWebdavCredentials'; declare module '@rocket.chat/ddp-client' { diff --git a/apps/meteor/server/bridges/webdav/methods/uploadFileToWebdav.ts b/apps/meteor/server/bridges/webdav/methods/uploadFileToWebdav.ts index 867a41ecc86bb..7419a75455b33 100644 --- a/apps/meteor/server/bridges/webdav/methods/uploadFileToWebdav.ts +++ b/apps/meteor/server/bridges/webdav/methods/uploadFileToWebdav.ts @@ -5,7 +5,7 @@ import { Logger } from '@rocket.chat/logger'; import type { TranslationKey } from '@rocket.chat/ui-contexts'; import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; import { uploadFileToWebdav } from '../lib/uploadFileToWebdav'; const logger = new Logger('WebDAV_Upload'); diff --git a/apps/meteor/server/configuration/cas.ts b/apps/meteor/server/configuration/cas.ts index 1aead109ebc8f..0fe75bf4cb605 100644 --- a/apps/meteor/server/configuration/cas.ts +++ b/apps/meteor/server/configuration/cas.ts @@ -3,10 +3,10 @@ import { Accounts } from 'meteor/accounts-base'; import { RoutePolicy } from 'meteor/routepolicy'; import { WebApp } from 'meteor/webapp'; -import type { ICachedSettings } from '../../app/settings/server/CachedSettings'; import { loginHandlerCAS } from '../lib/cas/loginHandler'; import { middlewareCAS } from '../lib/cas/middleware'; import { updateCasServices } from '../lib/cas/updateCasService'; +import type { ICachedSettings } from '../settings/CachedSettings'; export async function configureCAS(settings: ICachedSettings) { const _updateCasServices = debounce(updateCasServices, 2000); diff --git a/apps/meteor/server/configuration/configureAssets.ts b/apps/meteor/server/configuration/configureAssets.ts index 4e2af1855d592..f6c86c68d561d 100644 --- a/apps/meteor/server/configuration/configureAssets.ts +++ b/apps/meteor/server/configuration/configureAssets.ts @@ -1,5 +1,5 @@ -import type { ICachedSettings } from '../../app/settings/server/CachedSettings'; import { RocketChatAssets } from '../lib/media/assets'; +import type { ICachedSettings } from '../settings/CachedSettings'; export async function configureAssets(settings: ICachedSettings): Promise { settings.watchByRegex(/^Assets_/, (key, value) => RocketChatAssets.processAsset(key, value)); diff --git a/apps/meteor/server/configuration/configureBoilerplate.ts b/apps/meteor/server/configuration/configureBoilerplate.ts index f5687f5a338b0..74830e44d6210 100644 --- a/apps/meteor/server/configuration/configureBoilerplate.ts +++ b/apps/meteor/server/configuration/configureBoilerplate.ts @@ -3,7 +3,7 @@ import { createHash } from 'node:crypto'; import { Meteor } from 'meteor/meteor'; import { WebApp, WebAppInternals } from 'meteor/webapp'; -import type { ICachedSettings } from '../../app/settings/server/CachedSettings'; +import type { ICachedSettings } from '../settings/CachedSettings'; const webAppHashes: Record = {}; diff --git a/apps/meteor/server/configuration/configureCDN.ts b/apps/meteor/server/configuration/configureCDN.ts index b6d1aed4ae73a..0669083f72e6b 100644 --- a/apps/meteor/server/configuration/configureCDN.ts +++ b/apps/meteor/server/configuration/configureCDN.ts @@ -1,6 +1,6 @@ import { WebAppInternals } from 'meteor/webapp'; -import type { ICachedSettings } from '../../app/settings/server/CachedSettings'; +import type { ICachedSettings } from '../settings/CachedSettings'; export async function configureCDN(settings: ICachedSettings): Promise { settings.change('CDN_PREFIX', (value) => { diff --git a/apps/meteor/server/configuration/configureCORS.ts b/apps/meteor/server/configuration/configureCORS.ts index 360d7536468c7..f6a11fdbb26be 100644 --- a/apps/meteor/server/configuration/configureCORS.ts +++ b/apps/meteor/server/configuration/configureCORS.ts @@ -1,5 +1,5 @@ -import { setCachingVersion, setInlineScriptsAllowed } from '../../app/cors/server/cors'; -import type { ICachedSettings } from '../../app/settings/server/CachedSettings'; +import { setCachingVersion, setInlineScriptsAllowed } from '../lib/cors/cors'; +import type { ICachedSettings } from '../settings/CachedSettings'; export async function configureCORS(settings: ICachedSettings): Promise { settings.watch('Enable_CSP', async (enabled) => { diff --git a/apps/meteor/server/configuration/configureDirectReply.ts b/apps/meteor/server/configuration/configureDirectReply.ts index e7266d10df7eb..5a469f6e373d0 100644 --- a/apps/meteor/server/configuration/configureDirectReply.ts +++ b/apps/meteor/server/configuration/configureDirectReply.ts @@ -1,8 +1,8 @@ import _ from 'underscore'; -import { DirectReplyIMAPInterceptor, POP3Helper } from '../../app/lib/server/lib/interceptDirectReplyEmails.js'; -import type { ICachedSettings } from '../../app/settings/server/CachedSettings'; import { logger } from '../features/EmailInbox/logger'; +import { DirectReplyIMAPInterceptor, POP3Helper } from '../lib/notifications/interceptDirectReplyEmails'; +import type { ICachedSettings } from '../settings/CachedSettings'; export async function configureDirectReply(settings: ICachedSettings): Promise { let client: DirectReplyIMAPInterceptor | POP3Helper | undefined; diff --git a/apps/meteor/server/configuration/configureIRC.ts b/apps/meteor/server/configuration/configureIRC.ts index 5fc26de471f68..dc12fb64bf465 100644 --- a/apps/meteor/server/configuration/configureIRC.ts +++ b/apps/meteor/server/configuration/configureIRC.ts @@ -1,7 +1,7 @@ import { Meteor } from 'meteor/meteor'; -import type { ICachedSettings } from '../../app/settings/server/CachedSettings'; import Bridge from '../bridges/irc/irc-bridge'; +import type { ICachedSettings } from '../settings/CachedSettings'; export async function configureIRC(settings: ICachedSettings): Promise { if (!settings.get('IRC_Enabled')) { diff --git a/apps/meteor/server/configuration/configureLogLevel.ts b/apps/meteor/server/configuration/configureLogLevel.ts index 7f95d2e2f966d..6ff4685bbdb93 100644 --- a/apps/meteor/server/configuration/configureLogLevel.ts +++ b/apps/meteor/server/configuration/configureLogLevel.ts @@ -1,7 +1,7 @@ import { logLevel, type LogLevelSetting } from '@rocket.chat/logger'; import { Settings } from '@rocket.chat/models'; -import type { ICachedSettings } from '../../app/settings/server/CachedSettings'; +import type { ICachedSettings } from '../settings/CachedSettings'; export async function configureLogLevel(settings: ICachedSettings) { const LogLevel = await Settings.getValueById('Log_Level'); diff --git a/apps/meteor/server/configuration/configurePassport.ts b/apps/meteor/server/configuration/configurePassport.ts index b5d5a99fe5b66..1dd590591ace2 100644 --- a/apps/meteor/server/configuration/configurePassport.ts +++ b/apps/meteor/server/configuration/configurePassport.ts @@ -8,10 +8,10 @@ import { MongoInternals } from 'meteor/mongo'; import { WebApp } from 'meteor/webapp'; import passport from 'passport'; -import type { ICachedSettings } from '../../app/settings/server/CachedSettings'; import { configureOAuthServices } from '../lib/oauth/configureOAuthServices'; import { createOAuthServiceConfig } from '../lib/oauth/createOAuthServiceConfig'; import { getOAuthServices } from '../lib/oauth/getOAuthServices'; +import type { ICachedSettings } from '../settings/CachedSettings'; const oAuthPaths = ['/oauth', '/_oauth']; diff --git a/apps/meteor/server/configuration/configureSMTP.ts b/apps/meteor/server/configuration/configureSMTP.ts index 11833eb432545..dc34085790f2b 100644 --- a/apps/meteor/server/configuration/configureSMTP.ts +++ b/apps/meteor/server/configuration/configureSMTP.ts @@ -1,5 +1,5 @@ -import type { ICachedSettings } from '../../app/settings/server/CachedSettings'; import { SystemLogger } from '../lib/logger/system'; +import type { ICachedSettings } from '../settings/CachedSettings'; export function configureSMTP(settings: ICachedSettings): void { settings.watchMultiple( diff --git a/apps/meteor/server/configuration/index.ts b/apps/meteor/server/configuration/index.ts index 79f3160120ba1..dfecb7bfa024a 100644 --- a/apps/meteor/server/configuration/index.ts +++ b/apps/meteor/server/configuration/index.ts @@ -12,7 +12,7 @@ import { configureSMTP } from './configureSMTP'; import { configureLDAP } from './ldap'; import { configureOAuth } from './oauth'; import { configurePushNotifications } from './pushNotification'; -import type { ICachedSettings } from '../../app/settings/server/CachedSettings'; +import type { ICachedSettings } from '../settings/CachedSettings'; export async function configureServer(settings: ICachedSettings) { await Promise.all([ diff --git a/apps/meteor/server/configuration/ldap.ts b/apps/meteor/server/configuration/ldap.ts index 9cec49f5b4bf8..3e15a5a3ceda5 100644 --- a/apps/meteor/server/configuration/ldap.ts +++ b/apps/meteor/server/configuration/ldap.ts @@ -1,8 +1,8 @@ import { LDAP } from '@rocket.chat/core-services'; import { Accounts } from 'meteor/accounts-base'; -import type { ICachedSettings } from '../../app/settings/server/CachedSettings'; import { callbacks } from '../lib/callbacks'; +import type { ICachedSettings } from '../settings/CachedSettings'; export async function configureLDAP(settings: ICachedSettings): Promise { // Register ldap login handler diff --git a/apps/meteor/server/configuration/oauth.ts b/apps/meteor/server/configuration/oauth.ts index d384d8dc13835..5b23fd87027c7 100644 --- a/apps/meteor/server/configuration/oauth.ts +++ b/apps/meteor/server/configuration/oauth.ts @@ -1,9 +1,9 @@ import debounce from 'lodash.debounce'; -import type { ICachedSettings } from '../../app/settings/server/CachedSettings'; import { initCustomOAuthServices } from '../lib/oauth/initCustomOAuthServices'; import { removeOAuthService } from '../lib/oauth/removeOAuthService'; import { updateOAuthServices } from '../lib/oauth/updateOAuthServices'; +import type { ICachedSettings } from '../settings/CachedSettings'; export async function configureOAuth(settings: ICachedSettings): Promise { const _updateOAuthServices = debounce(updateOAuthServices, 2000); diff --git a/apps/meteor/server/configuration/pushNotification.ts b/apps/meteor/server/configuration/pushNotification.ts index 96cac02539e7e..783a9e1522e9a 100644 --- a/apps/meteor/server/configuration/pushNotification.ts +++ b/apps/meteor/server/configuration/pushNotification.ts @@ -1,6 +1,6 @@ -import type { ICachedSettings } from '../../app/settings/server/CachedSettings'; import { getWorkspaceAccessToken } from '../lib/cloud'; import { Push } from '../lib/notifications/push'; +import type { ICachedSettings } from '../settings/CachedSettings'; export async function configurePushNotifications(settings: ICachedSettings): Promise { settings.watch('Push_enable', async (enabled) => { diff --git a/apps/meteor/server/cron/nps.ts b/apps/meteor/server/cron/nps.ts index eaa098d3f2ebb..8d4e2ee2ab15e 100644 --- a/apps/meteor/server/cron/nps.ts +++ b/apps/meteor/server/cron/nps.ts @@ -1,7 +1,7 @@ import { NPS } from '@rocket.chat/core-services'; import { cronJobs } from '@rocket.chat/cron'; -import { settings } from '../../app/settings/server'; +import { settings } from '../settings'; async function runNPS(): Promise { // if NPS is disabled close any pending scheduled survey diff --git a/apps/meteor/server/cron/userDataDownloads.ts b/apps/meteor/server/cron/userDataDownloads.ts index d996d11c1cef8..2ec411bfa870c 100644 --- a/apps/meteor/server/cron/userDataDownloads.ts +++ b/apps/meteor/server/cron/userDataDownloads.ts @@ -1,8 +1,8 @@ import type { SettingValue } from '@rocket.chat/core-typings'; import { cronJobs } from '@rocket.chat/cron'; -import { settings } from '../../app/settings/server'; import * as dataExport from '../lib/dataExport'; +import { settings } from '../settings'; export const userDataDownloadsCron = (): void => { const jobName = 'UserDataDownload'; diff --git a/apps/meteor/server/email/IMAPInterceptor.ts b/apps/meteor/server/email/IMAPInterceptor.ts index 7cb31b7becf5c..1133ad36595a2 100644 --- a/apps/meteor/server/email/IMAPInterceptor.ts +++ b/apps/meteor/server/email/IMAPInterceptor.ts @@ -7,8 +7,8 @@ import IMAP from 'imap'; import type { ParsedMail } from 'mailparser'; import { simpleParser } from 'mailparser'; -import { notifyOnEmailInboxChanged } from '../../app/lib/server/lib/notifyListener'; import { logger } from '../features/EmailInbox/logger'; +import { notifyOnEmailInboxChanged } from '../lib/notifyListener'; type IMAPOptions = { deleteAfterRead: boolean; diff --git a/apps/meteor/server/features/EmailInbox/EmailInbox.ts b/apps/meteor/server/features/EmailInbox/EmailInbox.ts index eceaab4f96943..e17fc7877f047 100644 --- a/apps/meteor/server/features/EmailInbox/EmailInbox.ts +++ b/apps/meteor/server/features/EmailInbox/EmailInbox.ts @@ -6,8 +6,8 @@ import type Mail from 'nodemailer/lib/mailer'; import { onEmailReceived } from './EmailInbox_Incoming'; import { logger } from './logger'; -import { settings } from '../../../app/settings/server'; import { IMAPInterceptor } from '../../email/IMAPInterceptor'; +import { settings } from '../../settings'; export type Inbox = { imap: IMAPInterceptor; diff --git a/apps/meteor/server/features/EmailInbox/EmailInbox_Incoming.ts b/apps/meteor/server/features/EmailInbox/EmailInbox_Incoming.ts index 260ac3448ffa1..231a6db580af0 100644 --- a/apps/meteor/server/features/EmailInbox/EmailInbox_Incoming.ts +++ b/apps/meteor/server/features/EmailInbox/EmailInbox_Incoming.ts @@ -13,13 +13,13 @@ import type { ParsedMail, Attachment } from 'mailparser'; import { stripHtml } from 'string-strip-html'; import { logger } from './logger'; -import { notifyOnMessageChange } from '../../../app/lib/server/lib/notifyListener'; -import { QueueManager } from '../../../app/livechat/server/lib/QueueManager'; -import { setDepartmentForGuest } from '../../../app/livechat/server/lib/departmentsLib'; -import { sendMessage } from '../../../app/livechat/server/lib/messages'; -import { settings } from '../../../app/settings/server'; import { i18n } from '../../lib/i18n'; import { FileUpload } from '../../lib/media/file-upload'; +import { notifyOnMessageChange } from '../../lib/notifyListener'; +import { QueueManager } from '../../lib/omnichannel/QueueManager'; +import { setDepartmentForGuest } from '../../lib/omnichannel/departmentsLib'; +import { sendMessage } from '../../lib/omnichannel/messages'; +import { settings } from '../../settings'; type FileAttachment = VideoAttachmentProps & ImageAttachmentProps & AudioAttachmentProps; diff --git a/apps/meteor/server/features/EmailInbox/EmailInbox_Outgoing.ts b/apps/meteor/server/features/EmailInbox/EmailInbox_Outgoing.ts index 222130234d80b..31cfa0b895603 100644 --- a/apps/meteor/server/features/EmailInbox/EmailInbox_Outgoing.ts +++ b/apps/meteor/server/features/EmailInbox/EmailInbox_Outgoing.ts @@ -8,13 +8,13 @@ import type Mail from 'nodemailer/lib/mailer'; import { inboxes } from './EmailInbox'; import type { Inbox } from './EmailInbox'; import { logger } from './logger'; -import { notifyOnMessageChange } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; import { callbacks } from '../../lib/callbacks'; import { i18n } from '../../lib/i18n'; import { FileUpload } from '../../lib/media/file-upload'; import { sendMessage } from '../../lib/messages/sendMessage'; +import { notifyOnMessageChange } from '../../lib/notifyListener'; +import { slashCommands } from '../../lib/utils/slashCommand'; +import { settings } from '../../settings'; const livechatQuoteRegExp = /^\[\s\]\(https?:\/\/.+\/live\/.+\?msg=(?.+?)\)\s(?.+)/s; diff --git a/apps/meteor/app/lib/server/lib/afterUserActions.ts b/apps/meteor/server/hooks/afterUserActions.ts similarity index 77% rename from apps/meteor/app/lib/server/lib/afterUserActions.ts rename to apps/meteor/server/hooks/afterUserActions.ts index 63288391b847a..7e629707722de 100644 --- a/apps/meteor/app/lib/server/lib/afterUserActions.ts +++ b/apps/meteor/server/hooks/afterUserActions.ts @@ -1,9 +1,9 @@ import type { IUser } from '@rocket.chat/core-typings'; import { Subscriptions } from '@rocket.chat/models'; -import { notifyOnSubscriptionChangedByUserId } from './notifyListener'; -import { callbacks } from '../../../../server/lib/callbacks'; -import { unarchiveUserSubscriptions } from '../../../../server/lib/users/unarchiveUserSubscriptions'; +import { callbacks } from '../lib/callbacks'; +import { notifyOnSubscriptionChangedByUserId } from '../lib/notifyListener'; +import { unarchiveUserSubscriptions } from '../lib/users/unarchiveUserSubscriptions'; const handleDeactivateUser = async (user: IUser): Promise => { const { modifiedCount } = await Subscriptions.setArchivedByUserId(user._id, true); diff --git a/apps/meteor/server/hooks/auth/login.ts b/apps/meteor/server/hooks/auth/login.ts index e99ca5f2b8c06..6b9c0e412fe71 100644 --- a/apps/meteor/server/hooks/auth/login.ts +++ b/apps/meteor/server/hooks/auth/login.ts @@ -1,10 +1,10 @@ import { Accounts } from 'meteor/accounts-base'; -import { settings } from '../../../app/settings/server'; import type { ILoginAttempt } from '../../lib/auth/ILoginAttempt'; import { logFailedLoginAttempts } from '../../lib/auth/logLoginAttempts'; import { saveFailedLoginAttempts, saveSuccessfulLogin } from '../../lib/auth/restrictLoginAttempts'; import { callbacks } from '../../lib/callbacks'; +import { settings } from '../../settings'; const ignoredErrorTypes = ['totp-required', 'error-login-blocked-for-user']; diff --git a/apps/meteor/app/lib/server/startup/mentionUserNotInChannel.ts b/apps/meteor/server/hooks/messages/mentionUserNotInChannel.ts similarity index 94% rename from apps/meteor/app/lib/server/startup/mentionUserNotInChannel.ts rename to apps/meteor/server/hooks/messages/mentionUserNotInChannel.ts index afa2c451497f4..74a0923f5451c 100644 --- a/apps/meteor/app/lib/server/startup/mentionUserNotInChannel.ts +++ b/apps/meteor/server/hooks/messages/mentionUserNotInChannel.ts @@ -6,10 +6,10 @@ import { isTruthy } from '@rocket.chat/tools'; import type { ActionsBlock } from '@rocket.chat/ui-kit'; import moment from 'moment'; -import { hasPermissionAsync } from '../../../../server/lib/authorization/hasPermission'; -import { callbacks } from '../../../../server/lib/callbacks'; -import { i18n } from '../../../../server/lib/i18n'; -import { settings } from '../../../settings/server'; +import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { callbacks } from '../../lib/callbacks'; +import { i18n } from '../../lib/i18n'; +import { settings } from '../../settings'; const APP_ID = 'mention-core'; const getBlocks = (mentions: IMessage['mentions'], messageId: string, lng: string | undefined) => { diff --git a/apps/meteor/server/hooks/messages/notifyUsersOnMessage.ts b/apps/meteor/server/hooks/messages/notifyUsersOnMessage.ts index 56211d5e679c9..5191e51d860d0 100644 --- a/apps/meteor/server/hooks/messages/notifyUsersOnMessage.ts +++ b/apps/meteor/server/hooks/messages/notifyUsersOnMessage.ts @@ -4,14 +4,14 @@ import type { Updater } from '@rocket.chat/models'; import { Subscriptions, Rooms } from '@rocket.chat/models'; import moment from 'moment'; -import { messageContainsHighlight } from '../../../app/lib/server/functions/notifications/messageContainsHighlight'; +import { callbacks } from '../../lib/callbacks'; +import { messageContainsHighlight } from '../../lib/notifications/message/messageContainsHighlight'; import { notifyOnSubscriptionChanged, notifyOnSubscriptionChangedByRoomIdAndUserId, notifyOnSubscriptionChangedByRoomIdAndUserIds, -} from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; -import { callbacks } from '../../lib/callbacks'; +} from '../../lib/notifyListener'; +import { settings } from '../../settings'; export async function getMentions(message: IMessage): Promise<{ toAll: boolean; toHere: boolean; mentionIds: string[] }> { const { diff --git a/apps/meteor/server/hooks/messages/processThreads.ts b/apps/meteor/server/hooks/messages/processThreads.ts index bea122acf450d..b54fff09254f1 100644 --- a/apps/meteor/server/hooks/messages/processThreads.ts +++ b/apps/meteor/server/hooks/messages/processThreads.ts @@ -5,11 +5,11 @@ import { Meteor } from 'meteor/meteor'; import { updateThreadUsersSubscriptions, getMentions } from './notifyUsersOnMessage'; import { sendMessageNotifications } from './sendNotificationsOnMessage'; -import { notifyOnMessageChange } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; import { callbacks } from '../../lib/callbacks'; import type { SendMessageOptions } from '../../lib/messages/sendMessage'; import { reply } from '../../lib/messaging/threads/functions'; +import { notifyOnMessageChange } from '../../lib/notifyListener'; +import { settings } from '../../settings'; async function notifyUsersOnReply(message: IMessage, replies: IUser['_id'][]) { // skips this callback if the message was edited diff --git a/apps/meteor/server/hooks/messages/propagateDiscussionMetadata.ts b/apps/meteor/server/hooks/messages/propagateDiscussionMetadata.ts index 5e123fe8c1ca8..897e86cdd698d 100644 --- a/apps/meteor/server/hooks/messages/propagateDiscussionMetadata.ts +++ b/apps/meteor/server/hooks/messages/propagateDiscussionMetadata.ts @@ -1,8 +1,8 @@ import type { IRoom } from '@rocket.chat/core-typings'; import { Messages, Rooms, VideoConference } from '@rocket.chat/models'; -import { notifyOnMessageChange } from '../../../app/lib/server/lib/notifyListener'; import { callbacks } from '../../lib/callbacks'; +import { notifyOnMessageChange } from '../../lib/notifyListener'; import { deleteRoom } from '../../lib/rooms/deleteRoom'; const updateAndNotifyParentRoomWithParentMessage = async (room: IRoom): Promise => { diff --git a/apps/meteor/server/hooks/messages/sendNotificationsOnMessage.ts b/apps/meteor/server/hooks/messages/sendNotificationsOnMessage.ts index ebf901dca8d62..32d3c1141d30d 100644 --- a/apps/meteor/server/hooks/messages/sendNotificationsOnMessage.ts +++ b/apps/meteor/server/hooks/messages/sendNotificationsOnMessage.ts @@ -13,16 +13,16 @@ import type { RootFilterOperators } from 'mongodb'; import { getMentions } from './notifyUsersOnMessage'; import { shortnameToUnicode } from '../../../app/emoji-native/lib/shortnameToUnicode'; -import { parseMessageTextPerUser, replaceMentionedUsernamesWithFullNames } from '../../../app/lib/server/functions/notifications'; -import { notifyDesktopUser, shouldNotifyDesktop } from '../../../app/lib/server/functions/notifications/desktop'; -import { getEmailData, shouldNotifyEmail } from '../../../app/lib/server/functions/notifications/email'; -import { messageContainsHighlight } from '../../../app/lib/server/functions/notifications/messageContainsHighlight'; -import { getPushData, shouldNotifyMobile } from '../../../app/lib/server/functions/notifications/mobile'; -import { settings } from '../../../app/settings/server'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { callbacks } from '../../lib/callbacks'; +import { parseMessageTextPerUser, replaceMentionedUsernamesWithFullNames } from '../../lib/notifications/message'; +import { notifyDesktopUser, shouldNotifyDesktop } from '../../lib/notifications/message/desktop'; +import { getEmailData, shouldNotifyEmail } from '../../lib/notifications/message/email'; +import { messageContainsHighlight } from '../../lib/notifications/message/messageContainsHighlight'; +import { getPushData, shouldNotifyMobile } from '../../lib/notifications/message/mobile'; import { Notification } from '../../lib/notifications/queue/NotificationQueue'; import { roomCoordinator } from '../../lib/rooms/roomCoordinator'; +import { settings } from '../../settings'; type SubscriptionAggregation = { receiver: [Pick | null]; diff --git a/apps/meteor/server/hooks/omnichannel/afterAgentRemoved.ts b/apps/meteor/server/hooks/omnichannel/afterAgentRemoved.ts index 873d044c2a536..81dd9b54b7281 100644 --- a/apps/meteor/server/hooks/omnichannel/afterAgentRemoved.ts +++ b/apps/meteor/server/hooks/omnichannel/afterAgentRemoved.ts @@ -1,7 +1,7 @@ import { LivechatDepartment, Users, LivechatDepartmentAgents, LivechatVisitors } from '@rocket.chat/models'; -import { notifyOnLivechatDepartmentAgentChanged, notifyOnUserChange } from '../../../app/lib/server/lib/notifyListener'; import { callbacks } from '../../lib/callbacks'; +import { notifyOnLivechatDepartmentAgentChanged, notifyOnUserChange } from '../../lib/notifyListener'; callbacks.add('livechat.afterAgentRemoved', async ({ agent }) => { const departments = await LivechatDepartmentAgents.findByAgentId(agent._id).toArray(); diff --git a/apps/meteor/server/hooks/omnichannel/afterUserActions.ts b/apps/meteor/server/hooks/omnichannel/afterUserActions.ts index e4ca70ddb42b2..32f49ddcee007 100644 --- a/apps/meteor/server/hooks/omnichannel/afterUserActions.ts +++ b/apps/meteor/server/hooks/omnichannel/afterUserActions.ts @@ -1,8 +1,8 @@ import type { IUser } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; -import { afterAgentUserActivated, afterAgentAdded, afterRemoveAgent } from '../../../app/livechat/server/lib/hooks'; import { callbacks } from '../../lib/callbacks'; +import { afterAgentUserActivated, afterAgentAdded, afterRemoveAgent } from '../../lib/omnichannel/hooks'; type IAfterSaveUserProps = { user: IUser; diff --git a/apps/meteor/server/hooks/omnichannel/leadCapture.ts b/apps/meteor/server/hooks/omnichannel/leadCapture.ts index 189d750d36cba..34da1366102d6 100644 --- a/apps/meteor/server/hooks/omnichannel/leadCapture.ts +++ b/apps/meteor/server/hooks/omnichannel/leadCapture.ts @@ -3,8 +3,8 @@ import { isEditedMessage } from '@rocket.chat/core-typings'; import { LivechatVisitors } from '@rocket.chat/models'; import { isTruthy } from '@rocket.chat/tools'; -import { settings } from '../../../app/settings/server'; import { callbacks } from '../../lib/callbacks'; +import { settings } from '../../settings'; function validateMessage(message: IMessage, room: IOmnichannelRoom) { // skips this callback if the message was edited diff --git a/apps/meteor/server/hooks/omnichannel/markRoomResponded.ts b/apps/meteor/server/hooks/omnichannel/markRoomResponded.ts index b42f6dfe68a92..492e3450dc545 100644 --- a/apps/meteor/server/hooks/omnichannel/markRoomResponded.ts +++ b/apps/meteor/server/hooks/omnichannel/markRoomResponded.ts @@ -4,10 +4,10 @@ import type { Updater } from '@rocket.chat/models'; import { LivechatRooms, LivechatContacts, LivechatInquiry } from '@rocket.chat/models'; import moment from 'moment'; -import { notifyOnLivechatInquiryChanged } from '../../../app/lib/server/lib/notifyListener'; -import { isMessageFromBot } from '../../../app/livechat/server/lib/isMessageFromBot'; -import { settings } from '../../../app/settings/server'; import { callbacks } from '../../lib/callbacks'; +import { notifyOnLivechatInquiryChanged } from '../../lib/notifyListener'; +import { isMessageFromBot } from '../../lib/omnichannel/isMessageFromBot'; +import { settings } from '../../settings'; export async function markRoomResponded( message: IMessage, diff --git a/apps/meteor/server/hooks/omnichannel/offlineMessage.ts b/apps/meteor/server/hooks/omnichannel/offlineMessage.ts index d09df28446fb4..3642661f73063 100644 --- a/apps/meteor/server/hooks/omnichannel/offlineMessage.ts +++ b/apps/meteor/server/hooks/omnichannel/offlineMessage.ts @@ -1,6 +1,6 @@ -import { sendRequest } from '../../../app/livechat/server/lib/webhooks'; -import { settings } from '../../../app/settings/server'; import { callbacks } from '../../lib/callbacks'; +import { sendRequest } from '../../lib/omnichannel/webhooks'; +import { settings } from '../../settings'; callbacks.add( 'livechat.offlineMessage', diff --git a/apps/meteor/server/hooks/omnichannel/offlineMessageToChannel.ts b/apps/meteor/server/hooks/omnichannel/offlineMessageToChannel.ts index 14e42b46724cf..50bf0103a516a 100644 --- a/apps/meteor/server/hooks/omnichannel/offlineMessageToChannel.ts +++ b/apps/meteor/server/hooks/omnichannel/offlineMessageToChannel.ts @@ -2,10 +2,10 @@ import type { ILivechatDepartment } from '@rocket.chat/core-typings'; import { isOmnichannelRoom } from '@rocket.chat/core-typings'; import { LivechatDepartment, Users, Rooms } from '@rocket.chat/models'; -import { settings } from '../../../app/settings/server'; import { callbacks } from '../../lib/callbacks'; import { i18n } from '../../lib/i18n'; import { sendMessage } from '../../lib/messages/sendMessage'; +import { settings } from '../../settings'; callbacks.add( 'livechat.offlineMessage', diff --git a/apps/meteor/server/hooks/omnichannel/processRoomAbandonment.ts b/apps/meteor/server/hooks/omnichannel/processRoomAbandonment.ts index 23b8e7e949d6d..4c21b9078b23a 100644 --- a/apps/meteor/server/hooks/omnichannel/processRoomAbandonment.ts +++ b/apps/meteor/server/hooks/omnichannel/processRoomAbandonment.ts @@ -3,10 +3,10 @@ import { isOmnichannelRoom } from '@rocket.chat/core-typings'; import { LivechatBusinessHours, LivechatDepartment, Messages, LivechatRooms } from '@rocket.chat/models'; import moment from 'moment'; -import { businessHourManager } from '../../../app/livechat/server/business-hour'; -import type { CloseRoomParams } from '../../../app/livechat/server/lib/localTypes'; -import { settings } from '../../../app/settings/server'; import { callbacks } from '../../lib/callbacks'; +import { businessHourManager } from '../../lib/omnichannel/business-hour'; +import type { CloseRoomParams } from '../../lib/omnichannel/localTypes'; +import { settings } from '../../settings'; export const getSecondsWhenOfficeHoursIsDisabled = (room: IOmnichannelRoom, agentLastMessage: IMessage) => moment(new Date(room.closedAt || new Date())).diff(moment(new Date(agentLastMessage.ts)), 'seconds'); diff --git a/apps/meteor/server/hooks/omnichannel/saveAnalyticsData.ts b/apps/meteor/server/hooks/omnichannel/saveAnalyticsData.ts index bdc87aaf4deb0..8cbff98767889 100644 --- a/apps/meteor/server/hooks/omnichannel/saveAnalyticsData.ts +++ b/apps/meteor/server/hooks/omnichannel/saveAnalyticsData.ts @@ -2,10 +2,10 @@ import { isEditedMessage, isMessageFromVisitor, isSystemMessage } from '@rocket. import type { IOmnichannelRoom } from '@rocket.chat/core-typings'; import { LivechatRooms } from '@rocket.chat/models'; -import { isMessageFromBot } from '../../../app/livechat/server/lib/isMessageFromBot'; -import { settings } from '../../../app/settings/server'; -import { normalizeMessageFileUpload } from '../../../app/utils/server/functions/normalizeMessageFileUpload'; import { callbacks } from '../../lib/callbacks'; +import { isMessageFromBot } from '../../lib/omnichannel/isMessageFromBot'; +import { normalizeMessageFileUpload } from '../../lib/utils/functions/normalizeMessageFileUpload'; +import { settings } from '../../settings'; const getMetricValue = (metric: T | undefined, defaultValue: T): T => metric ?? defaultValue; const calculateTimeDifference = (startTime: T, now: Date): number => diff --git a/apps/meteor/server/hooks/omnichannel/saveLastMessageToInquiry.ts b/apps/meteor/server/hooks/omnichannel/saveLastMessageToInquiry.ts index 9f5f61e033d7b..be986922d7e29 100644 --- a/apps/meteor/server/hooks/omnichannel/saveLastMessageToInquiry.ts +++ b/apps/meteor/server/hooks/omnichannel/saveLastMessageToInquiry.ts @@ -1,10 +1,10 @@ import { isEditedMessage } from '@rocket.chat/core-typings'; import { LivechatInquiry } from '@rocket.chat/models'; -import { notifyOnLivechatInquiryChanged } from '../../../app/lib/server/lib/notifyListener'; -import { RoutingManager } from '../../../app/livechat/server/lib/RoutingManager'; -import { settings } from '../../../app/settings/server'; import { callbacks } from '../../lib/callbacks'; +import { notifyOnLivechatInquiryChanged } from '../../lib/notifyListener'; +import { RoutingManager } from '../../lib/omnichannel/RoutingManager'; +import { settings } from '../../settings'; callbacks.add( 'afterOmnichannelSaveMessage', diff --git a/apps/meteor/server/hooks/omnichannel/sendEmailTranscriptOnClose.ts b/apps/meteor/server/hooks/omnichannel/sendEmailTranscriptOnClose.ts index 9dd569c7952c4..0dfe9c7f7b896 100644 --- a/apps/meteor/server/hooks/omnichannel/sendEmailTranscriptOnClose.ts +++ b/apps/meteor/server/hooks/omnichannel/sendEmailTranscriptOnClose.ts @@ -2,9 +2,9 @@ import type { IOmnichannelRoom } from '@rocket.chat/core-typings'; import { isOmnichannelRoom } from '@rocket.chat/core-typings'; import { LivechatRooms } from '@rocket.chat/models'; -import type { CloseRoomParams } from '../../../app/livechat/server/lib/localTypes'; -import { sendTranscript } from '../../../app/livechat/server/lib/sendTranscript'; import { callbacks } from '../../lib/callbacks'; +import type { CloseRoomParams } from '../../lib/omnichannel/localTypes'; +import { sendTranscript } from '../../lib/omnichannel/sendTranscript'; type LivechatCloseCallbackParams = { room: IOmnichannelRoom; diff --git a/apps/meteor/server/hooks/omnichannel/sendToCRM.ts b/apps/meteor/server/hooks/omnichannel/sendToCRM.ts index 90d60be860c05..b579fbb0c9bd3 100644 --- a/apps/meteor/server/hooks/omnichannel/sendToCRM.ts +++ b/apps/meteor/server/hooks/omnichannel/sendToCRM.ts @@ -3,11 +3,11 @@ import { isEditedMessage, isOmnichannelRoom } from '@rocket.chat/core-typings'; import { LivechatRooms, Messages } from '@rocket.chat/models'; import type { Response } from '@rocket.chat/server-fetch'; -import { getLivechatRoomGuestInfo } from '../../../app/livechat/server/lib/guests'; -import { sendRequest } from '../../../app/livechat/server/lib/webhooks'; -import { settings } from '../../../app/settings/server'; -import { normalizeMessageFileUpload } from '../../../app/utils/server/functions/normalizeMessageFileUpload'; import { callbacks } from '../../lib/callbacks'; +import { getLivechatRoomGuestInfo } from '../../lib/omnichannel/guests'; +import { sendRequest } from '../../lib/omnichannel/webhooks'; +import { normalizeMessageFileUpload } from '../../lib/utils/functions/normalizeMessageFileUpload'; +import { settings } from '../../settings'; type AdditionalFields = | Record diff --git a/apps/meteor/server/importPackages.ts b/apps/meteor/server/importPackages.ts index faafa042d2f41..94796dd9c37ba 100644 --- a/apps/meteor/server/importPackages.ts +++ b/apps/meteor/server/importPackages.ts @@ -1,4 +1,4 @@ -import '../app/cors/server'; +import './lib/cors'; import './lib/2fa/MethodInvocationOverride'; import './lib/2fa/loginHandler'; import './api'; @@ -6,10 +6,10 @@ import './lib/auth-providers/apple/appleOauthRegisterService'; import './lib/auth-providers/apple/loginHandler'; import './lib/auth-providers/apple/applePassportOAuth'; import './lib/media/assets'; -import '../app/authorization/server'; +import './lib/authorization'; import './lib/autotranslate'; import './lib/bot-helpers'; -import '../app/channel-settings/server'; +import './lib/rooms/settings'; import './lib/cloud'; import './lib/auth-providers/crowd/crowd'; import './lib/auth-providers/custom-oauth/custom_oauth_server'; @@ -20,7 +20,7 @@ import './lib/messaging/emoji'; import './lib/media/emoji-custom/startup/emoji-custom'; import './lib/media/emoji-native/lib'; import './lib/media/emoji-native/callbacks'; -import '../app/error-handler/server'; +import './lib/error-handler'; import './lib/media/file'; import './lib/media/file-upload'; import './lib/auth-providers/github-enterprise'; @@ -41,7 +41,18 @@ import './lib/integrations/lib/triggerHandler'; import './lib/integrations/triggers'; import './lib/integrations/startup'; import './bridges/irc'; -import '../app/lib/server'; +import '../app/lib/lib/MessageTypes'; +import './lib/bugsnag'; +import './lib/debug'; +import './lib/auth/loginErrorMessageOverride'; +import './lib/auth-providers/oauth/oauth'; +import './lib/auth-providers/oauth/facebook'; +import './lib/auth-providers/oauth/google'; +import './lib/auth-providers/oauth/proxy'; +import './lib/auth-providers/oauth/twitter'; +import './hooks/messages/mentionUserNotInChannel'; +import './hooks/afterUserActions'; +import './hooks/messages/notifyUsersOnMessage'; import './lib/auth-providers/meteor-developer'; import './lib/auth-providers/linkedin'; import './lib/auth/token-login'; @@ -52,9 +63,9 @@ import './lib/messaging/unread/unreadMessages'; import './lib/messaging/pins/pinMessage'; import './lib/messaging/stars/starMessage'; import './bridges/nextcloud'; -import '../app/oauth2-server-config/server'; +import './lib/auth/oauth2-server'; import './lib/notifications/push-config'; -import '../app/retention-policy/server'; +import './lib/rooms/retention'; import './bridges/slack'; import './slashcommands/archiveroom'; import './slashcommands/asciiarts'; @@ -74,9 +85,9 @@ import './slashcommands/status'; import './slashcommands/topic'; import './slashcommands/unarchiveroom'; import './bridges/smarsh'; -import '../app/theme/server'; +import './settings/theme'; import './hooks/messages/processThreads'; -import '../app/ui-master/server'; +import './lib/ui-master'; import './bridges/webdav'; import './lib/auth-providers/wordpress'; import './lib/saml/startup'; @@ -92,12 +103,10 @@ import './lib/search/startup'; import './lib/search/service'; import './lib/messaging/discussions/permissions'; import './hooks/messages/propagateDiscussionMetadata'; -import '../app/user-status/server'; import './lib/metrics'; import './lib/notifications/core'; -import '../app/ui-utils/server'; import './lib/messaging/reactions/setReaction'; -import '../app/livechat/server'; +import './lib/omnichannel'; import './hooks/auth/login'; import './lib/auth/startup'; import './lib/auth-providers/github'; diff --git a/apps/meteor/server/lib/2fa/code/EmailCheck.spec.ts b/apps/meteor/server/lib/2fa/code/EmailCheck.spec.ts index e89ab1db75a45..fd56eef8b189d 100644 --- a/apps/meteor/server/lib/2fa/code/EmailCheck.spec.ts +++ b/apps/meteor/server/lib/2fa/code/EmailCheck.spec.ts @@ -22,7 +22,7 @@ const { EmailCheck } = proxyquire.noCallThru().load('./EmailCheck', { '../../notifications/email/api': { send: () => undefined, }, - '../../../../app/settings/server': { + '../../../settings': { settings: { get: settingsMock, }, diff --git a/apps/meteor/server/lib/2fa/code/EmailCheck.ts b/apps/meteor/server/lib/2fa/code/EmailCheck.ts index 1713bf3b706e4..fa00fafc0a7d2 100644 --- a/apps/meteor/server/lib/2fa/code/EmailCheck.ts +++ b/apps/meteor/server/lib/2fa/code/EmailCheck.ts @@ -5,7 +5,7 @@ import bcrypt from 'bcrypt'; import { Accounts } from 'meteor/accounts-base'; import type { ICodeCheck, IProcessInvalidCodeResult } from './ICodeCheck'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; import { i18n } from '../../i18n'; import * as Mailer from '../../notifications/email/api'; diff --git a/apps/meteor/server/lib/2fa/code/PasswordCheckFallback.ts b/apps/meteor/server/lib/2fa/code/PasswordCheckFallback.ts index fa2bbb8feac9d..d99e6a8788456 100644 --- a/apps/meteor/server/lib/2fa/code/PasswordCheckFallback.ts +++ b/apps/meteor/server/lib/2fa/code/PasswordCheckFallback.ts @@ -3,7 +3,7 @@ import { Accounts } from 'meteor/accounts-base'; import type { Meteor } from 'meteor/meteor'; import type { ICodeCheck, IProcessInvalidCodeResult } from './ICodeCheck'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; export class PasswordCheckFallback implements ICodeCheck { public readonly name = 'password'; diff --git a/apps/meteor/server/lib/2fa/code/TOTPCheck.ts b/apps/meteor/server/lib/2fa/code/TOTPCheck.ts index fe6f6366f51fd..4624bdef4082b 100644 --- a/apps/meteor/server/lib/2fa/code/TOTPCheck.ts +++ b/apps/meteor/server/lib/2fa/code/TOTPCheck.ts @@ -1,7 +1,7 @@ import type { IUser } from '@rocket.chat/core-typings'; import type { ICodeCheck, IProcessInvalidCodeResult } from './ICodeCheck'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; import { TOTP } from '../lib/totp'; export class TOTPCheck implements ICodeCheck { diff --git a/apps/meteor/server/lib/2fa/code/checkCodeForUser.spec.ts b/apps/meteor/server/lib/2fa/code/checkCodeForUser.spec.ts index fe46863149fd8..864ed27605617 100644 --- a/apps/meteor/server/lib/2fa/code/checkCodeForUser.spec.ts +++ b/apps/meteor/server/lib/2fa/code/checkCodeForUser.spec.ts @@ -80,7 +80,7 @@ const { checkCodeForUser, getFingerprintFromConnection } = proxyquire.noCallThru '../../shared/getModifiedHttpHeaders': { normalizeHeaders: (headers: unknown) => headers, }, - '../../../../app/settings/server': { + '../../../settings': { settings: { get: settingsGet }, }, }); diff --git a/apps/meteor/server/lib/2fa/code/index.spec.ts b/apps/meteor/server/lib/2fa/code/index.spec.ts index 455c5f9689b1f..80baf62aa2e42 100644 --- a/apps/meteor/server/lib/2fa/code/index.spec.ts +++ b/apps/meteor/server/lib/2fa/code/index.spec.ts @@ -51,7 +51,7 @@ const { checkCodeForUser } = proxyquire.noCallThru().load('./index', { './EmailCheck': { EmailCheck: DisabledCheckMock }, './PasswordCheckFallback': { PasswordCheckFallback: class extends DisabledCheckMock {} }, '../../shared/getModifiedHttpHeaders': { normalizeHeaders: (headers: unknown) => headers }, - '../../../../app/settings/server': { settings: { get: settingsMock } }, + '../../../settings': { settings: { get: settingsMock } }, '@rocket.chat/models': { Users: { findOneById: async () => null, diff --git a/apps/meteor/server/lib/2fa/code/index.ts b/apps/meteor/server/lib/2fa/code/index.ts index 2544142ada820..e86a77b3178cb 100644 --- a/apps/meteor/server/lib/2fa/code/index.ts +++ b/apps/meteor/server/lib/2fa/code/index.ts @@ -9,7 +9,7 @@ import { EmailCheck } from './EmailCheck'; import type { ICodeCheck } from './ICodeCheck'; import { PasswordCheckFallback } from './PasswordCheckFallback'; import { TOTPCheck } from './TOTPCheck'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; import { normalizeHeaders } from '../../shared/getModifiedHttpHeaders'; export interface ITwoFactorOptions { diff --git a/apps/meteor/server/lib/2fa/functions/resetTOTP.ts b/apps/meteor/server/lib/2fa/functions/resetTOTP.ts index 76b48c5550c72..b9a21e14fed98 100644 --- a/apps/meteor/server/lib/2fa/functions/resetTOTP.ts +++ b/apps/meteor/server/lib/2fa/functions/resetTOTP.ts @@ -2,11 +2,11 @@ import type { IUser } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { notifyOnUserChange } from '../../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; import { i18n } from '../../i18n'; import { isUserIdFederated } from '../../isUserIdFederated'; import * as Mailer from '../../notifications/email/api'; +import { notifyOnUserChange } from '../../notifyListener'; const sendResetNotification = async function (uid: string): Promise { const user = await Users.findOneById>(uid, { diff --git a/apps/meteor/server/lib/2fa/lib/totp.ts b/apps/meteor/server/lib/2fa/lib/totp.ts index d4cd2a9ab0b36..8ea7cb2edac6d 100644 --- a/apps/meteor/server/lib/2fa/lib/totp.ts +++ b/apps/meteor/server/lib/2fa/lib/totp.ts @@ -3,7 +3,7 @@ import { Random } from '@rocket.chat/random'; import { SHA256 } from '@rocket.chat/sha256'; import speakeasy from 'speakeasy'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; export const TOTP = { generateSecret(): speakeasy.GeneratedSecret { diff --git a/apps/meteor/app/lib/server/lib/RateLimiter.js b/apps/meteor/server/lib/RateLimiter.js similarity index 100% rename from apps/meteor/app/lib/server/lib/RateLimiter.js rename to apps/meteor/server/lib/RateLimiter.js diff --git a/apps/meteor/server/lib/auth-providers/apple/AppleCustomOAuth.ts b/apps/meteor/server/lib/auth-providers/apple/AppleCustomOAuth.ts index 2ea47ca7544be..c2730d8ea7fab 100644 --- a/apps/meteor/server/lib/auth-providers/apple/AppleCustomOAuth.ts +++ b/apps/meteor/server/lib/auth-providers/apple/AppleCustomOAuth.ts @@ -1,8 +1,8 @@ import { MeteorError } from '@rocket.chat/core-services'; import { Accounts } from 'meteor/accounts-base'; -import { handleIdentityToken } from '../../../../app/apple/lib/handleIdentityToken'; -import { settings } from '../../../../app/settings/server'; +import { handleIdentityToken } from './handleIdentityToken'; +import { settings } from '../../../settings'; import { CustomOAuth } from '../custom-oauth/custom_oauth_server'; export class AppleCustomOAuth extends CustomOAuth { diff --git a/apps/meteor/server/lib/auth-providers/apple/appleOauthRegisterService.ts b/apps/meteor/server/lib/auth-providers/apple/appleOauthRegisterService.ts index 026aa1f4556f0..fbe27d16c64f5 100644 --- a/apps/meteor/server/lib/auth-providers/apple/appleOauthRegisterService.ts +++ b/apps/meteor/server/lib/auth-providers/apple/appleOauthRegisterService.ts @@ -4,7 +4,7 @@ import { ServiceConfiguration } from 'meteor/service-configuration'; import { AppleCustomOAuth } from './AppleCustomOAuth'; import { config } from '../../../../app/apple/lib/config'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; new AppleCustomOAuth('apple', config); diff --git a/apps/meteor/server/lib/auth-providers/apple/applePassportOAuth.ts b/apps/meteor/server/lib/auth-providers/apple/applePassportOAuth.ts index f8a4cce3386da..958a4fbee744d 100644 --- a/apps/meteor/server/lib/auth-providers/apple/applePassportOAuth.ts +++ b/apps/meteor/server/lib/auth-providers/apple/applePassportOAuth.ts @@ -8,10 +8,10 @@ import { Strategy as AppleStrategy } from 'passport-apple'; import type { Profile } from 'passport-apple'; import { AppleCustomOAuth } from './AppleCustomOAuth'; +import { handleIdentityToken } from './handleIdentityToken'; import { config } from '../../../../app/apple/lib/config'; -import { handleIdentityToken } from '../../../../app/apple/lib/handleIdentityToken'; -import { settings } from '../../../../app/settings/server'; import { oAuthRouter } from '../../../configuration/configurePassport'; +import { settings } from '../../../settings'; import { allowPassportOAuthMiddleware } from '../../oauth/allowPassportOAuthMiddleware'; import { passportOAuthCallback } from '../../oauth/passportOAuthCallback'; diff --git a/apps/meteor/app/apple/lib/handleIdentityToken.spec.ts b/apps/meteor/server/lib/auth-providers/apple/handleIdentityToken.spec.ts similarity index 100% rename from apps/meteor/app/apple/lib/handleIdentityToken.spec.ts rename to apps/meteor/server/lib/auth-providers/apple/handleIdentityToken.spec.ts diff --git a/apps/meteor/app/apple/lib/handleIdentityToken.ts b/apps/meteor/server/lib/auth-providers/apple/handleIdentityToken.ts similarity index 100% rename from apps/meteor/app/apple/lib/handleIdentityToken.ts rename to apps/meteor/server/lib/auth-providers/apple/handleIdentityToken.ts diff --git a/apps/meteor/server/lib/auth-providers/apple/loginHandler.spec.ts b/apps/meteor/server/lib/auth-providers/apple/loginHandler.spec.ts index 1f5f507ecf3f0..0e9de43034367 100644 --- a/apps/meteor/server/lib/auth-providers/apple/loginHandler.spec.ts +++ b/apps/meteor/server/lib/auth-providers/apple/loginHandler.spec.ts @@ -1,7 +1,7 @@ import { Accounts } from 'meteor/accounts-base'; -import { handleIdentityToken } from '../../../../app/apple/lib/handleIdentityToken'; -import { settings } from '../../../../app/settings/server'; +import { handleIdentityToken } from './handleIdentityToken'; +import { settings } from '../../../settings'; jest.mock( 'meteor/accounts-base', @@ -32,13 +32,13 @@ jest.mock( { virtual: true }, ); -jest.mock('../../../../app/settings/server', () => ({ +jest.mock('../../../settings', () => ({ settings: { get: jest.fn(), }, })); -jest.mock('../../../../app/apple/lib/handleIdentityToken', () => ({ +jest.mock('./handleIdentityToken', () => ({ handleIdentityToken: jest.fn(), })); diff --git a/apps/meteor/server/lib/auth-providers/apple/loginHandler.ts b/apps/meteor/server/lib/auth-providers/apple/loginHandler.ts index 0a370b4be814a..8e1aa5b3850a7 100644 --- a/apps/meteor/server/lib/auth-providers/apple/loginHandler.ts +++ b/apps/meteor/server/lib/auth-providers/apple/loginHandler.ts @@ -1,8 +1,8 @@ import { Accounts } from 'meteor/accounts-base'; import { Meteor } from 'meteor/meteor'; -import { handleIdentityToken } from '../../../../app/apple/lib/handleIdentityToken'; -import { settings } from '../../../../app/settings/server'; +import { handleIdentityToken } from './handleIdentityToken'; +import { settings } from '../../../settings'; Accounts.registerLoginHandler('apple', async (loginRequest) => { if (!loginRequest.identityToken) { diff --git a/apps/meteor/server/lib/auth-providers/crowd/crowd.ts b/apps/meteor/server/lib/auth-providers/crowd/crowd.ts index 0b6d6c340a86e..c92ee345d8ce2 100644 --- a/apps/meteor/server/lib/auth-providers/crowd/crowd.ts +++ b/apps/meteor/server/lib/auth-providers/crowd/crowd.ts @@ -7,9 +7,9 @@ import { Accounts } from 'meteor/accounts-base'; import { Meteor } from 'meteor/meteor'; import { logger } from './logger'; -import { notifyOnUserChange, notifyOnUserChangeById, notifyOnUserChangeAsync } from '../../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; import { crowdIntervalValuesToCronMap } from '../../../settings/crowd'; +import { notifyOnUserChange, notifyOnUserChangeById, notifyOnUserChangeAsync } from '../../notifyListener'; import { deleteUser } from '../../users/deleteUser'; import { setRealName } from '../../users/setRealName'; import { setUserActiveStatus } from '../../users/setUserActiveStatus'; diff --git a/apps/meteor/app/custom-oauth/README.md b/apps/meteor/server/lib/auth-providers/custom-oauth/README.md similarity index 100% rename from apps/meteor/app/custom-oauth/README.md rename to apps/meteor/server/lib/auth-providers/custom-oauth/README.md diff --git a/apps/meteor/server/lib/auth-providers/custom-oauth/customOAuth.ts b/apps/meteor/server/lib/auth-providers/custom-oauth/customOAuth.ts index f540de50a0c49..6862037cf6b90 100644 --- a/apps/meteor/server/lib/auth-providers/custom-oauth/customOAuth.ts +++ b/apps/meteor/server/lib/auth-providers/custom-oauth/customOAuth.ts @@ -10,10 +10,10 @@ import type { VerifyFunction, StrategyOptions } from 'passport-oauth2'; import { Strategy } from 'passport-oauth2'; import { normalizers, fromTemplate, renameInvalidProperties } from './transform_helpers'; -import { notifyOnUserChange } from '../../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../../app/settings/server/cached'; import { client } from '../../../database/utils'; +import { settings } from '../../../settings/cached'; import { callbacks } from '../../callbacks'; +import { notifyOnUserChange } from '../../notifyListener'; import { saveUserIdentity } from '../../users/saveUserIdentity'; const logger = new Logger('CustomOAuth'); diff --git a/apps/meteor/server/lib/auth-providers/custom-oauth/custom_oauth_server.js b/apps/meteor/server/lib/auth-providers/custom-oauth/custom_oauth_server.js index 12d7a85e32486..34362a4176186 100644 --- a/apps/meteor/server/lib/auth-providers/custom-oauth/custom_oauth_server.js +++ b/apps/meteor/server/lib/auth-providers/custom-oauth/custom_oauth_server.js @@ -11,10 +11,10 @@ import { ServiceConfiguration } from 'meteor/service-configuration'; import _ from 'underscore'; import { normalizers, fromTemplate, renameInvalidProperties } from './transform_helpers'; -import { notifyOnUserChange } from '../../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../../app/settings/server'; import { client } from '../../../database/utils'; +import { settings } from '../../../settings'; import { callbacks } from '../../callbacks'; +import { notifyOnUserChange } from '../../notifyListener'; import { saveUserIdentity } from '../../users/saveUserIdentity'; import { registerAccessTokenService } from '../oauth/oauth'; diff --git a/apps/meteor/server/lib/auth-providers/dolphin.ts b/apps/meteor/server/lib/auth-providers/dolphin.ts index 8b3d41168daf0..ba89bbd61e3fe 100644 --- a/apps/meteor/server/lib/auth-providers/dolphin.ts +++ b/apps/meteor/server/lib/auth-providers/dolphin.ts @@ -8,7 +8,7 @@ import { callbacks } from '../callbacks'; import { beforeCreateUserCallback } from '../callbacks/beforeCreateUserCallback'; import { addPassportCustomOAuth } from '../oauth/addPassportCustomOAuth'; import { CustomOAuth } from './custom-oauth/custom_oauth_server'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; const config: Partial = { serverURL: '', diff --git a/apps/meteor/app/drupal/README.md b/apps/meteor/server/lib/auth-providers/drupal.README.md similarity index 100% rename from apps/meteor/app/drupal/README.md rename to apps/meteor/server/lib/auth-providers/drupal.README.md diff --git a/apps/meteor/server/lib/auth-providers/drupal.ts b/apps/meteor/server/lib/auth-providers/drupal.ts index f781fbe7b9d0a..35a5072a2a61b 100644 --- a/apps/meteor/server/lib/auth-providers/drupal.ts +++ b/apps/meteor/server/lib/auth-providers/drupal.ts @@ -5,7 +5,7 @@ import _ from 'underscore'; import { addPassportCustomOAuth } from '../oauth/addPassportCustomOAuth'; import { CustomOAuth } from './custom-oauth/custom_oauth_server'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; const config: Partial = { serverURL: '', diff --git a/apps/meteor/server/lib/auth-providers/github-enterprise.ts b/apps/meteor/server/lib/auth-providers/github-enterprise.ts index 9a0c4db27bfb2..3edd8cb7e8a26 100644 --- a/apps/meteor/server/lib/auth-providers/github-enterprise.ts +++ b/apps/meteor/server/lib/auth-providers/github-enterprise.ts @@ -2,7 +2,7 @@ import type { OauthConfig } from '@rocket.chat/core-typings'; import { Meteor } from 'meteor/meteor'; import { CustomOAuth } from './custom-oauth/custom_oauth_server'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; // GitHub Enterprise Server CallBack URL needs to be http(s)://{rocketchat.server}[:port]/_oauth/github_enterprise // In RocketChat -> Administration the URL needs to be http(s)://{github.enterprise.server}/ diff --git a/apps/meteor/server/lib/auth-providers/gitlab.ts b/apps/meteor/server/lib/auth-providers/gitlab.ts index ba6189e6d37c6..044528301ba00 100644 --- a/apps/meteor/server/lib/auth-providers/gitlab.ts +++ b/apps/meteor/server/lib/auth-providers/gitlab.ts @@ -5,7 +5,7 @@ import _ from 'underscore'; import { addPassportCustomOAuth } from '../oauth/addPassportCustomOAuth'; import { CustomOAuth } from './custom-oauth/custom_oauth_server'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; const config: Partial = { serverURL: 'https://gitlab.com', diff --git a/apps/meteor/server/lib/auth-providers/linkedin.ts b/apps/meteor/server/lib/auth-providers/linkedin.ts index 46dadddb46e7d..8357a7416ec0d 100644 --- a/apps/meteor/server/lib/auth-providers/linkedin.ts +++ b/apps/meteor/server/lib/auth-providers/linkedin.ts @@ -2,7 +2,7 @@ import type { OAuthConfiguration } from '@rocket.chat/core-typings'; import { Meteor } from 'meteor/meteor'; import passport from 'passport'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; import { addPassportCustomOAuth } from '../oauth/addPassportCustomOAuth'; const config: Partial = { diff --git a/apps/meteor/server/lib/auth-providers/meteor-developer.ts b/apps/meteor/server/lib/auth-providers/meteor-developer.ts index beb56362743d9..154c1820d82dd 100644 --- a/apps/meteor/server/lib/auth-providers/meteor-developer.ts +++ b/apps/meteor/server/lib/auth-providers/meteor-developer.ts @@ -2,7 +2,7 @@ import type { OAuthConfiguration } from '@rocket.chat/core-typings'; import { Meteor } from 'meteor/meteor'; import passport from 'passport'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; import { addPassportCustomOAuth } from '../oauth/addPassportCustomOAuth'; const config: Partial = { diff --git a/apps/meteor/server/lib/auth-providers/oauth/proxy.js b/apps/meteor/server/lib/auth-providers/oauth/proxy.js index 6d91766fe21e9..e7fa300defb45 100644 --- a/apps/meteor/server/lib/auth-providers/oauth/proxy.js +++ b/apps/meteor/server/lib/auth-providers/oauth/proxy.js @@ -1,7 +1,7 @@ import { OAuth } from 'meteor/oauth'; import _ from 'underscore'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; OAuth._redirectUri = _.wrap(OAuth._redirectUri, (func, serviceName, ...args) => { const proxy = settings.get('Accounts_OAuth_Proxy_services').replace(/\s/g, '').split(','); diff --git a/apps/meteor/server/lib/auth-providers/wordpress.ts b/apps/meteor/server/lib/auth-providers/wordpress.ts index 136f4632fdc19..5c3169d973f69 100644 --- a/apps/meteor/server/lib/auth-providers/wordpress.ts +++ b/apps/meteor/server/lib/auth-providers/wordpress.ts @@ -6,7 +6,7 @@ import _ from 'underscore'; import { addPassportCustomOAuth } from '../oauth/addPassportCustomOAuth'; import { CustomOAuth } from './custom-oauth/custom_oauth_server'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; const config: Partial = { serverURL: '', diff --git a/apps/meteor/app/lib/server/lib/generatePassword.ts b/apps/meteor/server/lib/auth/generatePassword.ts similarity index 100% rename from apps/meteor/app/lib/server/lib/generatePassword.ts rename to apps/meteor/server/lib/auth/generatePassword.ts diff --git a/apps/meteor/server/lib/auth/logLoginAttempts.ts b/apps/meteor/server/lib/auth/logLoginAttempts.ts index 93807e1c83357..00dd179c175e9 100644 --- a/apps/meteor/server/lib/auth/logLoginAttempts.ts +++ b/apps/meteor/server/lib/auth/logLoginAttempts.ts @@ -1,5 +1,5 @@ import type { ILoginAttempt } from './ILoginAttempt'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; import { SystemLogger } from '../logger/system'; export const logFailedLoginAttempts = (login: ILoginAttempt): void => { diff --git a/apps/meteor/app/lib/server/lib/loginErrorMessageOverride.ts b/apps/meteor/server/lib/auth/loginErrorMessageOverride.ts similarity index 100% rename from apps/meteor/app/lib/server/lib/loginErrorMessageOverride.ts rename to apps/meteor/server/lib/auth/loginErrorMessageOverride.ts diff --git a/apps/meteor/app/oauth2-server-config/server/admin/functions/addOAuthApp.ts b/apps/meteor/server/lib/auth/oauth2-server/addOAuthApp.ts similarity index 92% rename from apps/meteor/app/oauth2-server-config/server/admin/functions/addOAuthApp.ts rename to apps/meteor/server/lib/auth/oauth2-server/addOAuthApp.ts index d1cf04d2c99d9..2add2e8adc931 100644 --- a/apps/meteor/app/oauth2-server-config/server/admin/functions/addOAuthApp.ts +++ b/apps/meteor/server/lib/auth/oauth2-server/addOAuthApp.ts @@ -4,8 +4,8 @@ import { Random } from '@rocket.chat/random'; import { Meteor } from 'meteor/meteor'; import { parseUriList } from './parseUriList'; -import type { OauthAppsAddParams } from '../../../../../server/api/v1/oauthapps'; -import { hasPermissionAsync } from '../../../../../server/lib/authorization/hasPermission'; +import type { OauthAppsAddParams } from '../../../api/v1/oauthapps'; +import { hasPermissionAsync } from '../../authorization/hasPermission'; export async function addOAuthApp(applicationParams: OauthAppsAddParams, uid: IUser['_id'] | undefined): Promise { if (!uid) { diff --git a/apps/meteor/server/lib/auth/oauth2-server/index.ts b/apps/meteor/server/lib/auth/oauth2-server/index.ts new file mode 100644 index 0000000000000..159416ce39e80 --- /dev/null +++ b/apps/meteor/server/lib/auth/oauth2-server/index.ts @@ -0,0 +1,4 @@ +import './oauth2-server'; +import './addOAuthApp'; +import '../../../meteor-methods/auth/updateOAuthApp'; +import '../../../meteor-methods/auth/deleteOAuthApp'; diff --git a/apps/meteor/app/oauth2-server-config/server/oauth/oauth2-server.ts b/apps/meteor/server/lib/auth/oauth2-server/oauth2-server.ts similarity index 96% rename from apps/meteor/app/oauth2-server-config/server/oauth/oauth2-server.ts rename to apps/meteor/server/lib/auth/oauth2-server/oauth2-server.ts index 98256dccfe13f..a69e5c595c0d3 100644 --- a/apps/meteor/app/oauth2-server-config/server/oauth/oauth2-server.ts +++ b/apps/meteor/server/lib/auth/oauth2-server/oauth2-server.ts @@ -6,8 +6,8 @@ import { Meteor } from 'meteor/meteor'; import { WebApp } from 'meteor/webapp'; import { isPlainObject } from '../../../../lib/utils/isPlainObject'; -import { API } from '../../../../server/api'; -import { OAuth2Server } from '../../../../server/oauth2-server/oauth'; +import { API } from '../../../api'; +import { OAuth2Server } from '../../../oauth2-server/oauth'; const oauth2server = new OAuth2Server({ // If you're developing something related to oauth servers, you should change this to true diff --git a/apps/meteor/app/oauth2-server-config/server/admin/functions/parseUriList.ts b/apps/meteor/server/lib/auth/oauth2-server/parseUriList.ts similarity index 100% rename from apps/meteor/app/oauth2-server-config/server/admin/functions/parseUriList.ts rename to apps/meteor/server/lib/auth/oauth2-server/parseUriList.ts diff --git a/apps/meteor/app/lib/server/lib/passwordPolicy.ts b/apps/meteor/server/lib/auth/passwordPolicy.ts similarity index 97% rename from apps/meteor/app/lib/server/lib/passwordPolicy.ts rename to apps/meteor/server/lib/auth/passwordPolicy.ts index b40447ca56abd..9556f74abdd5c 100644 --- a/apps/meteor/app/lib/server/lib/passwordPolicy.ts +++ b/apps/meteor/server/lib/auth/passwordPolicy.ts @@ -1,6 +1,6 @@ import { PasswordPolicy } from '@rocket.chat/password-policies'; -import { settings } from '../../../settings/server'; +import { settings } from '../../settings'; const enabled = false; const minLength = -1; diff --git a/apps/meteor/server/lib/auth/restrictLoginAttempts.ts b/apps/meteor/server/lib/auth/restrictLoginAttempts.ts index 58c3a4d42698f..809c67bede1ea 100644 --- a/apps/meteor/server/lib/auth/restrictLoginAttempts.ts +++ b/apps/meteor/server/lib/auth/restrictLoginAttempts.ts @@ -3,8 +3,8 @@ import { ServerEventType } from '@rocket.chat/core-typings'; import { Logger } from '@rocket.chat/logger'; import { Rooms, ServerEvents, Users } from '@rocket.chat/models'; -import { settings } from '../../../app/settings/server'; import { addMinutesToADate } from '../../../lib/utils/addMinutesToADate'; +import { settings } from '../../settings'; import { getClientAddress } from '../getClientAddress'; import type { ILoginAttempt } from './ILoginAttempt'; import { sendMessage } from '../messages/sendMessage'; diff --git a/apps/meteor/server/lib/auth/startup.js b/apps/meteor/server/lib/auth/startup.js index 3bb94ad43763c..3c61e0709fedc 100644 --- a/apps/meteor/server/lib/auth/startup.js +++ b/apps/meteor/server/lib/auth/startup.js @@ -9,22 +9,22 @@ import { Meteor } from 'meteor/meteor'; import _ from 'underscore'; import { isValidAttemptByUser, isValidLoginAttemptByIp } from './restrictLoginAttempts'; -import { notifyOnSettingChangedById } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; -import { getBaseUserFields } from '../../../app/utils/server/functions/getBaseUserFields'; import { parseCSV } from '../../../lib/utils/parseCSV'; import { safeHtmlDots } from '../../../lib/utils/safeHtmlDots'; import { getNewUserRoles } from '../../services/user/lib/getNewUserRoles'; +import { settings } from '../../settings'; import { callbacks } from '../callbacks'; import { beforeCreateUserCallback } from '../callbacks/beforeCreateUserCallback'; import { getClientAddress } from '../getClientAddress'; import { getMaxLoginTokens } from '../getMaxLoginTokens'; import { i18n } from '../i18n'; import * as Mailer from '../notifications/email/api'; +import { notifyOnSettingChangedById } from '../notifyListener'; import { addUserRolesAsync } from '../roles/addUserRoles'; import { joinDefaultChannels } from '../rooms/joinDefaultChannels'; import { getAvatarSuggestionForUser } from '../users/getAvatarSuggestionForUser'; import { setAvatarFromServiceWithValidation } from '../users/setUserAvatar'; +import { getBaseUserFields } from '../utils/functions/getBaseUserFields'; Accounts.config({ forbidClientAccountCreation: true, diff --git a/apps/meteor/app/authorization/README.md b/apps/meteor/server/lib/authorization/README.md similarity index 100% rename from apps/meteor/app/authorization/README.md rename to apps/meteor/server/lib/authorization/README.md diff --git a/apps/meteor/server/lib/authorization/canDeleteMessage.ts b/apps/meteor/server/lib/authorization/canDeleteMessage.ts index b959b59f61ec1..b5c5151b2533a 100644 --- a/apps/meteor/server/lib/authorization/canDeleteMessage.ts +++ b/apps/meteor/server/lib/authorization/canDeleteMessage.ts @@ -3,7 +3,7 @@ import { Rooms } from '@rocket.chat/models'; import { canAccessRoomAsync } from './canAccessRoom'; import { hasPermissionAsync } from './hasPermission'; -import { getValue } from '../../../app/settings/server/raw'; +import { getValue } from '../../settings/raw'; const elapsedTime = (ts: Date): number => { const dif = Date.now() - ts.getTime(); diff --git a/apps/meteor/app/authorization/server/constant/permissions.ts b/apps/meteor/server/lib/authorization/constant/permissions.ts similarity index 100% rename from apps/meteor/app/authorization/server/constant/permissions.ts rename to apps/meteor/server/lib/authorization/constant/permissions.ts diff --git a/apps/meteor/server/lib/authorization/index.ts b/apps/meteor/server/lib/authorization/index.ts new file mode 100644 index 0000000000000..85684bb5de81d --- /dev/null +++ b/apps/meteor/server/lib/authorization/index.ts @@ -0,0 +1,7 @@ +import { roomAccessAttributes, canAccessRoomAsync } from './canAccessRoom'; +import { getRoles } from './getRoles'; +import { getUsersInRole } from './getUsersInRole'; +import { subscriptionHasRole } from './hasRole'; +import './streamer/permissions'; + +export { getRoles, getUsersInRole, subscriptionHasRole, canAccessRoomAsync, roomAccessAttributes }; diff --git a/apps/meteor/app/authorization/server/lib/isABACManagedRoom.ts b/apps/meteor/server/lib/authorization/isABACManagedRoom.ts similarity index 91% rename from apps/meteor/app/authorization/server/lib/isABACManagedRoom.ts rename to apps/meteor/server/lib/authorization/isABACManagedRoom.ts index 70a5b61f0a375..3c0365ad8deeb 100644 --- a/apps/meteor/app/authorization/server/lib/isABACManagedRoom.ts +++ b/apps/meteor/server/lib/authorization/isABACManagedRoom.ts @@ -1,6 +1,6 @@ import type { IRoom } from '@rocket.chat/core-typings'; -import { settings } from '../../../settings/server'; +import { settings } from '../../settings'; export const isABACManagedRoom = (room: Pick): boolean => room.t === 'p' && settings.get('ABAC_Enabled') && Array.isArray(room.abacAttributes) && room.abacAttributes.length > 0; diff --git a/apps/meteor/server/lib/authorization/permissionRole.ts b/apps/meteor/server/lib/authorization/permissionRole.ts index 5ec543c8b0776..de04600f6409c 100644 --- a/apps/meteor/server/lib/authorization/permissionRole.ts +++ b/apps/meteor/server/lib/authorization/permissionRole.ts @@ -4,7 +4,7 @@ import { Meteor } from 'meteor/meteor'; import { hasPermissionAsync } from './hasPermission'; import { CONSTANTS, AuthorizationUtils } from '../../../app/authorization/lib'; -import { notifyOnPermissionChangedById } from '../../../app/lib/server/lib/notifyListener'; +import { notifyOnPermissionChangedById } from '../notifyListener'; export const addPermissionToRoleMethod = async (uid: string, permissionId: string, role: string): Promise => { if (role === 'guest' && !AuthorizationUtils.hasRestrictionsToRole(role) && (await License.hasValidLicense())) { diff --git a/apps/meteor/app/authorization/server/streamer/permissions/index.ts b/apps/meteor/server/lib/authorization/streamer/permissions/index.ts similarity index 100% rename from apps/meteor/app/authorization/server/streamer/permissions/index.ts rename to apps/meteor/server/lib/authorization/streamer/permissions/index.ts diff --git a/apps/meteor/server/lib/authorization/upsertPermissions.ts b/apps/meteor/server/lib/authorization/upsertPermissions.ts index 231715b7e010c..1c4ca5f8c66a1 100644 --- a/apps/meteor/server/lib/authorization/upsertPermissions.ts +++ b/apps/meteor/server/lib/authorization/upsertPermissions.ts @@ -2,9 +2,9 @@ import type { IPermission, ISetting } from '@rocket.chat/core-typings'; import { Permissions, Settings } from '@rocket.chat/models'; +import { permissions } from './constant/permissions'; import { getSettingPermissionId, CONSTANTS } from '../../../app/authorization/lib'; -import { permissions } from '../../../app/authorization/server/constant/permissions'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; import { createOrUpdateProtectedRoleAsync } from '../roles/createOrUpdateProtectedRole'; export const upsertPermissions = async (): Promise => { diff --git a/apps/meteor/app/autotranslate/README.md b/apps/meteor/server/lib/autotranslate/README.md similarity index 100% rename from apps/meteor/app/autotranslate/README.md rename to apps/meteor/server/lib/autotranslate/README.md diff --git a/apps/meteor/server/lib/autotranslate/autotranslate.ts b/apps/meteor/server/lib/autotranslate/autotranslate.ts index 8a9c8493dbb49..4439d5dfb2b8b 100644 --- a/apps/meteor/server/lib/autotranslate/autotranslate.ts +++ b/apps/meteor/server/lib/autotranslate/autotranslate.ts @@ -13,10 +13,10 @@ import { isTruthy } from '@rocket.chat/tools'; import { Meteor } from 'meteor/meteor'; import _ from 'underscore'; -import { notifyOnMessageChange } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; import { callbacks } from '../callbacks'; import { Markdown } from '../messaging/markdown'; +import { notifyOnMessageChange } from '../notifyListener'; const translationLogger = new Logger('AutoTranslate'); diff --git a/apps/meteor/server/lib/autotranslate/deeplTranslate.ts b/apps/meteor/server/lib/autotranslate/deeplTranslate.ts index 0ad7314538750..792bbf04b2e9f 100644 --- a/apps/meteor/server/lib/autotranslate/deeplTranslate.ts +++ b/apps/meteor/server/lib/autotranslate/deeplTranslate.ts @@ -7,7 +7,7 @@ import { serverFetch as fetch } from '@rocket.chat/server-fetch'; import _ from 'underscore'; import { TranslationProviderRegistry, AutoTranslate } from './autotranslate'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; import { i18n } from '../i18n'; import { SystemLogger } from '../logger/system'; diff --git a/apps/meteor/server/lib/autotranslate/functions/getSupportedLanguages.ts b/apps/meteor/server/lib/autotranslate/functions/getSupportedLanguages.ts index b5b99e32f5839..5a78001ac23d4 100644 --- a/apps/meteor/server/lib/autotranslate/functions/getSupportedLanguages.ts +++ b/apps/meteor/server/lib/autotranslate/functions/getSupportedLanguages.ts @@ -1,6 +1,6 @@ import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; import { hasPermissionAsync } from '../../authorization/hasPermission'; import { TranslationProviderRegistry } from '../index'; diff --git a/apps/meteor/server/lib/autotranslate/functions/saveSettings.ts b/apps/meteor/server/lib/autotranslate/functions/saveSettings.ts index 453de45a737d7..7346996debdf5 100644 --- a/apps/meteor/server/lib/autotranslate/functions/saveSettings.ts +++ b/apps/meteor/server/lib/autotranslate/functions/saveSettings.ts @@ -2,8 +2,8 @@ import { Subscriptions, Rooms } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { notifyOnSubscriptionChangedById } from '../../../../app/lib/server/lib/notifyListener'; import { hasPermissionAsync } from '../../authorization/hasPermission'; +import { notifyOnSubscriptionChangedById } from '../../notifyListener'; export const saveAutoTranslateSettings = async ( userId: string, diff --git a/apps/meteor/server/lib/autotranslate/googleTranslate.ts b/apps/meteor/server/lib/autotranslate/googleTranslate.ts index 4c78579acbe41..d4d76c40bb9bc 100644 --- a/apps/meteor/server/lib/autotranslate/googleTranslate.ts +++ b/apps/meteor/server/lib/autotranslate/googleTranslate.ts @@ -7,7 +7,7 @@ import { serverFetch as fetch } from '@rocket.chat/server-fetch'; import _ from 'underscore'; import { AutoTranslate, TranslationProviderRegistry } from './autotranslate'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; import { i18n } from '../i18n'; import { SystemLogger } from '../logger/system'; diff --git a/apps/meteor/server/lib/autotranslate/libreTranslate.ts b/apps/meteor/server/lib/autotranslate/libreTranslate.ts index dce4a0383303b..6ea0aafd2a46f 100644 --- a/apps/meteor/server/lib/autotranslate/libreTranslate.ts +++ b/apps/meteor/server/lib/autotranslate/libreTranslate.ts @@ -3,7 +3,7 @@ import { serverFetch as fetch } from '@rocket.chat/server-fetch'; import { TranslationProviderRegistry, AutoTranslate } from './autotranslate'; import { libreLogger } from './logger'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; import { i18n } from '../i18n'; interface ILibreTranslateLanguage { diff --git a/apps/meteor/server/lib/autotranslate/msTranslate.ts b/apps/meteor/server/lib/autotranslate/msTranslate.ts index 9c8a4a54c9ce9..3f68089f93c41 100644 --- a/apps/meteor/server/lib/autotranslate/msTranslate.ts +++ b/apps/meteor/server/lib/autotranslate/msTranslate.ts @@ -8,7 +8,7 @@ import _ from 'underscore'; import { TranslationProviderRegistry, AutoTranslate } from './autotranslate'; import { msLogger } from './logger'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; import { i18n } from '../i18n'; /** diff --git a/apps/meteor/server/lib/banUserFromRoom.ts b/apps/meteor/server/lib/banUserFromRoom.ts index f463f51a01611..1bd8dfd79bce3 100644 --- a/apps/meteor/server/lib/banUserFromRoom.ts +++ b/apps/meteor/server/lib/banUserFromRoom.ts @@ -1,11 +1,11 @@ import { isBannedSubscription } from '@rocket.chat/core-typings'; import { Rooms, Subscriptions, Users, Roles } from '@rocket.chat/models'; +import { canAccessRoomAsync } from './authorization'; import { hasPermissionAsync } from './authorization/hasPermission'; import { hasRoleAsync } from './authorization/hasRole'; import { banUserFromRoom } from './rooms/banUserFromRoom'; import { roomCoordinator } from './rooms/roomCoordinator'; -import { canAccessRoomAsync } from '../../app/authorization/server'; import { RoomMemberActions } from '../../definition/IRoomTypeConfig'; export const banUserFromRoomMethod = async (fromId: string, data: { rid: string; username: string }): Promise => { diff --git a/apps/meteor/server/lib/bot-helpers/index.ts b/apps/meteor/server/lib/bot-helpers/index.ts index 07ddd08145f75..4040bef37ccb4 100644 --- a/apps/meteor/server/lib/bot-helpers/index.ts +++ b/apps/meteor/server/lib/bot-helpers/index.ts @@ -5,11 +5,11 @@ import { Rooms, Users } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; import type { Filter, FindCursor } from 'mongodb'; -import { settings } from '../../../app/settings/server'; import { addUserToRole } from '../../meteor-methods/auth/addUserToRole'; import { removeUserFromRole } from '../../meteor-methods/auth/removeUserFromRole'; import { addUsersToRoomMethod } from '../../meteor-methods/rooms/addUsersToRoom'; import { removeUserFromRoomMethod } from '../../meteor-methods/rooms/removeUserFromRoom'; +import { settings } from '../../settings'; import { hasRoleAsync } from '../authorization/hasRole'; /** diff --git a/apps/meteor/app/lib/server/lib/bugsnag.ts b/apps/meteor/server/lib/bugsnag.ts similarity index 88% rename from apps/meteor/app/lib/server/lib/bugsnag.ts rename to apps/meteor/server/lib/bugsnag.ts index 25dbfe0fdc0e9..98fea2036d509 100644 --- a/apps/meteor/app/lib/server/lib/bugsnag.ts +++ b/apps/meteor/server/lib/bugsnag.ts @@ -2,8 +2,8 @@ import Bugsnag from '@bugsnag/js'; import { Logger } from '@rocket.chat/logger'; import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../settings/server'; -import { Info } from '../../../utils/rocketchat.info'; +import { Info } from '../../app/utils/rocketchat.info'; +import { settings } from '../settings'; const logger = new Logger('bugsnag'); diff --git a/apps/meteor/server/lib/callbacks.ts b/apps/meteor/server/lib/callbacks.ts index c04590bb3214a..d847a7bd21c7f 100644 --- a/apps/meteor/server/lib/callbacks.ts +++ b/apps/meteor/server/lib/callbacks.ts @@ -25,8 +25,8 @@ import type { FilterOperators } from 'mongodb'; import type { ILoginAttempt } from './auth/ILoginAttempt'; import { Callbacks } from './callbacks/callbacksBase'; import type { SendMessageOptions } from './messages/sendMessage'; -import type { IBusinessHourBehavior } from '../../app/livechat/server/business-hour/AbstractBusinessHour'; -import type { CloseRoomParams } from '../../app/livechat/server/lib/localTypes'; +import type { IBusinessHourBehavior } from './omnichannel/business-hour/AbstractBusinessHour'; +import type { CloseRoomParams } from './omnichannel/localTypes'; /** * Callbacks returning void, like event listeners. diff --git a/apps/meteor/server/lib/cas/findExistingCASUser.ts b/apps/meteor/server/lib/cas/findExistingCASUser.ts index 9d6354b81cf77..9a041ad46f7c5 100644 --- a/apps/meteor/server/lib/cas/findExistingCASUser.ts +++ b/apps/meteor/server/lib/cas/findExistingCASUser.ts @@ -1,7 +1,7 @@ import type { IUser } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; export const findExistingCASUser = async (username: string): Promise => { const casUser = await Users.findOne({ 'services.cas.external_id': username }); diff --git a/apps/meteor/server/lib/cas/loginHandler.spec.ts b/apps/meteor/server/lib/cas/loginHandler.spec.ts index 948d5ee00d253..c5c415421cb7b 100644 --- a/apps/meteor/server/lib/cas/loginHandler.spec.ts +++ b/apps/meteor/server/lib/cas/loginHandler.spec.ts @@ -24,7 +24,7 @@ const { loginHandlerCAS: handler } = proxyquire.noCallThru().load('./loginHandle './findExistingCASUser': { findExistingCASUser }, './logger': { logger: { debug: sinon.stub(), error: sinon.stub() } }, '../users/setRealName': { setRealName: sinon.stub().resolves() }, - '../../../app/settings/server': { settings: { get: settingsGet } }, + '../../settings': { settings: { get: settingsGet } }, }); describe('loginHandlerCAS', () => { diff --git a/apps/meteor/server/lib/cas/loginHandler.ts b/apps/meteor/server/lib/cas/loginHandler.ts index dd29ef40d8dc7..12fb9135a72f8 100644 --- a/apps/meteor/server/lib/cas/loginHandler.ts +++ b/apps/meteor/server/lib/cas/loginHandler.ts @@ -6,7 +6,7 @@ import { Meteor } from 'meteor/meteor'; import { createNewUser } from './createNewUser'; import { findExistingCASUser } from './findExistingCASUser'; import { logger } from './logger'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; import { setRealName } from '../users/setRealName'; export const loginHandlerCAS = async (options: any): Promise => { diff --git a/apps/meteor/server/lib/cas/middleware.ts b/apps/meteor/server/lib/cas/middleware.ts index 2026d51f67e0e..13e9454dd874a 100644 --- a/apps/meteor/server/lib/cas/middleware.ts +++ b/apps/meteor/server/lib/cas/middleware.ts @@ -8,7 +8,7 @@ import { Meteor } from 'meteor/meteor'; import _ from 'underscore'; import { logger } from './logger'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; const closePopup = function (res: ServerResponse): void { res.writeHead(200, { 'Content-Type': 'text/html' }); diff --git a/apps/meteor/server/lib/cas/updateCasService.ts b/apps/meteor/server/lib/cas/updateCasService.ts index cd7b702577211..8cf8d83a72b37 100644 --- a/apps/meteor/server/lib/cas/updateCasService.ts +++ b/apps/meteor/server/lib/cas/updateCasService.ts @@ -2,7 +2,7 @@ import type { LoginServiceConfiguration } from '@rocket.chat/core-typings'; import { ServiceConfiguration } from 'meteor/service-configuration'; import { logger } from './logger'; -import { settings } from '../../../app/settings/server/cached'; +import { settings } from '../../settings/cached'; export async function updateCasServices(): Promise { const data: Partial = { diff --git a/apps/meteor/server/lib/cloud/buildRegistrationData.ts b/apps/meteor/server/lib/cloud/buildRegistrationData.ts index 63c2fe3471b2c..90f076116f11b 100644 --- a/apps/meteor/server/lib/cloud/buildRegistrationData.ts +++ b/apps/meteor/server/lib/cloud/buildRegistrationData.ts @@ -2,8 +2,8 @@ import { LivechatContacts, Statistics, Users } from '@rocket.chat/models'; import moment from 'moment'; import { LICENSE_VERSION } from './license'; -import { settings } from '../../../app/settings/server'; import { Info } from '../../../app/utils/rocketchat.info'; +import { settings } from '../../settings'; import { statistics } from '../statistics'; export type WorkspaceRegistrationData = { diff --git a/apps/meteor/server/lib/cloud/connectWorkspace.ts b/apps/meteor/server/lib/cloud/connectWorkspace.ts index d9b3e2320acbb..a3f283a90af52 100644 --- a/apps/meteor/server/lib/cloud/connectWorkspace.ts +++ b/apps/meteor/server/lib/cloud/connectWorkspace.ts @@ -2,8 +2,8 @@ import { serverFetch as fetch } from '@rocket.chat/server-fetch'; import { getRedirectUri } from './getRedirectUri'; import { saveRegistrationData } from './saveRegistrationData'; -import { settings } from '../../../app/settings/server'; import { CloudWorkspaceConnectionError } from '../../../lib/errors/CloudWorkspaceConnectionError'; +import { settings } from '../../settings'; import { SystemLogger } from '../logger/system'; const fetchRegistrationDataPayload = async ({ diff --git a/apps/meteor/server/lib/cloud/finishOAuthAuthorization.ts b/apps/meteor/server/lib/cloud/finishOAuthAuthorization.ts index 784e827ba2f6a..60078b1d2eaa2 100644 --- a/apps/meteor/server/lib/cloud/finishOAuthAuthorization.ts +++ b/apps/meteor/server/lib/cloud/finishOAuthAuthorization.ts @@ -4,7 +4,7 @@ import { Meteor } from 'meteor/meteor'; import { getRedirectUri } from './getRedirectUri'; import { userScopes } from './oauthScopes'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; import { SystemLogger } from '../logger/system'; export async function finishOAuthAuthorization(code: string, state: string) { diff --git a/apps/meteor/server/lib/cloud/getCheckoutUrl.ts b/apps/meteor/server/lib/cloud/getCheckoutUrl.ts index 8b85203db3164..6f1d3b1b48fd8 100644 --- a/apps/meteor/server/lib/cloud/getCheckoutUrl.ts +++ b/apps/meteor/server/lib/cloud/getCheckoutUrl.ts @@ -2,9 +2,9 @@ import { serverFetch as fetch } from '@rocket.chat/server-fetch'; import { getWorkspaceAccessTokenOrThrow } from './getWorkspaceAccessToken'; import { syncWorkspace } from './syncWorkspace'; -import { settings } from '../../../app/settings/server'; -import { getURL } from '../../../app/utils/server/getURL'; +import { settings } from '../../settings'; import { SystemLogger } from '../logger/system'; +import { getURL } from '../utils/getURL'; export const fallback = 'https://go.rocket.chat/i/contact-sales'; diff --git a/apps/meteor/server/lib/cloud/getConfirmationPoll.ts b/apps/meteor/server/lib/cloud/getConfirmationPoll.ts index 9cc05d3fbc22d..b03e263d2ef1f 100644 --- a/apps/meteor/server/lib/cloud/getConfirmationPoll.ts +++ b/apps/meteor/server/lib/cloud/getConfirmationPoll.ts @@ -1,7 +1,7 @@ import type { CloudConfirmationPollData } from '@rocket.chat/core-typings'; import { serverFetch as fetch } from '@rocket.chat/server-fetch'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; import { SystemLogger } from '../logger/system'; export async function getConfirmationPoll(deviceCode: string): Promise { diff --git a/apps/meteor/server/lib/cloud/getOAuthAuthorizationUrl.ts b/apps/meteor/server/lib/cloud/getOAuthAuthorizationUrl.ts index 5618a2b9cd51b..cb60238175061 100644 --- a/apps/meteor/server/lib/cloud/getOAuthAuthorizationUrl.ts +++ b/apps/meteor/server/lib/cloud/getOAuthAuthorizationUrl.ts @@ -3,9 +3,9 @@ import { Random } from '@rocket.chat/random'; import { getRedirectUri } from './getRedirectUri'; import { userScopes } from './oauthScopes'; -import { notifyOnSettingChangedById } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; import { updateAuditedBySystem } from '../../settings/lib/auditedSettingUpdates'; +import { notifyOnSettingChangedById } from '../notifyListener'; export async function getOAuthAuthorizationUrl() { const state = Random.id(); diff --git a/apps/meteor/server/lib/cloud/getRedirectUri.ts b/apps/meteor/server/lib/cloud/getRedirectUri.ts index 8893718e78671..5465960b66596 100644 --- a/apps/meteor/server/lib/cloud/getRedirectUri.ts +++ b/apps/meteor/server/lib/cloud/getRedirectUri.ts @@ -1,4 +1,4 @@ -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; export function getRedirectUri() { return `${settings.get('Site_Url')}/admin/cloud/oauth-callback`.replace(/\/\/admin+/g, '/admin'); diff --git a/apps/meteor/server/lib/cloud/getWorkspaceAccessTokenWithScope.ts b/apps/meteor/server/lib/cloud/getWorkspaceAccessTokenWithScope.ts index 7c55f125db4ea..40f9bdd760b31 100644 --- a/apps/meteor/server/lib/cloud/getWorkspaceAccessTokenWithScope.ts +++ b/apps/meteor/server/lib/cloud/getWorkspaceAccessTokenWithScope.ts @@ -5,7 +5,7 @@ import { CloudWorkspaceAccessTokenError } from './getWorkspaceAccessToken'; import { workspaceScopes } from './oauthScopes'; import { removeWorkspaceRegistrationInfo } from './removeWorkspaceRegistrationInfo'; import { retrieveRegistrationStatus } from './retrieveRegistrationStatus'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; import { SystemLogger } from '../logger/system'; type WorkspaceAccessTokenWithScope = { diff --git a/apps/meteor/server/lib/cloud/getWorkspaceKey.ts b/apps/meteor/server/lib/cloud/getWorkspaceKey.ts index b95a59beb91c7..f3876684ab2d1 100644 --- a/apps/meteor/server/lib/cloud/getWorkspaceKey.ts +++ b/apps/meteor/server/lib/cloud/getWorkspaceKey.ts @@ -1,5 +1,5 @@ import { retrieveRegistrationStatus } from './retrieveRegistrationStatus'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; export async function getWorkspaceKey() { const { workspaceRegistered } = await retrieveRegistrationStatus(); diff --git a/apps/meteor/server/lib/cloud/getWorkspaceLicense.ts b/apps/meteor/server/lib/cloud/getWorkspaceLicense.ts index ec9b2b49bb7c5..e793c9e42c437 100644 --- a/apps/meteor/server/lib/cloud/getWorkspaceLicense.ts +++ b/apps/meteor/server/lib/cloud/getWorkspaceLicense.ts @@ -5,9 +5,9 @@ import * as z from 'zod'; import { getWorkspaceAccessToken } from './getWorkspaceAccessToken'; import { LICENSE_VERSION } from './license'; -import { settings } from '../../../app/settings/server'; import { CloudWorkspaceConnectionError } from '../../../lib/errors/CloudWorkspaceConnectionError'; import { CloudWorkspaceLicenseError } from '../../../lib/errors/CloudWorkspaceLicenseError'; +import { settings } from '../../settings'; import { callbacks } from '../callbacks'; import { SystemLogger } from '../logger/system'; diff --git a/apps/meteor/server/lib/cloud/registerPreIntentWorkspaceWizard.ts b/apps/meteor/server/lib/cloud/registerPreIntentWorkspaceWizard.ts index 70188ba83adee..9e1ded06da825 100644 --- a/apps/meteor/server/lib/cloud/registerPreIntentWorkspaceWizard.ts +++ b/apps/meteor/server/lib/cloud/registerPreIntentWorkspaceWizard.ts @@ -3,7 +3,7 @@ import { Users } from '@rocket.chat/models'; import { serverFetch as fetch } from '@rocket.chat/server-fetch'; import { buildWorkspaceRegistrationData } from './buildRegistrationData'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; import { SystemLogger } from '../logger/system'; export async function registerPreIntentWorkspaceWizard(): Promise { diff --git a/apps/meteor/server/lib/cloud/removeLicense.ts b/apps/meteor/server/lib/cloud/removeLicense.ts index 9114b058b66d5..97888098c81a9 100644 --- a/apps/meteor/server/lib/cloud/removeLicense.ts +++ b/apps/meteor/server/lib/cloud/removeLicense.ts @@ -3,9 +3,9 @@ import { serverFetch as fetch } from '@rocket.chat/server-fetch'; import { CloudWorkspaceAccessTokenEmptyError, getWorkspaceAccessToken } from './getWorkspaceAccessToken'; import { retrieveRegistrationStatus } from './retrieveRegistrationStatus'; import { syncWorkspace } from './syncWorkspace'; -import { settings } from '../../../app/settings/server'; import { CloudWorkspaceConnectionError } from '../../../lib/errors/CloudWorkspaceConnectionError'; import { CloudWorkspaceRegistrationError } from '../../../lib/errors/CloudWorkspaceRegistrationError'; +import { settings } from '../../settings'; import { callbacks } from '../callbacks'; export async function removeLicense() { diff --git a/apps/meteor/server/lib/cloud/removeWorkspaceRegistrationInfo.ts b/apps/meteor/server/lib/cloud/removeWorkspaceRegistrationInfo.ts index 425bc076813b9..22f8218fbe503 100644 --- a/apps/meteor/server/lib/cloud/removeWorkspaceRegistrationInfo.ts +++ b/apps/meteor/server/lib/cloud/removeWorkspaceRegistrationInfo.ts @@ -1,8 +1,8 @@ import { Settings, WorkspaceCredentials } from '@rocket.chat/models'; import { retrieveRegistrationStatus } from './retrieveRegistrationStatus'; -import { notifyOnSettingChangedById } from '../../../app/lib/server/lib/notifyListener'; import { updateAuditedBySystem } from '../../settings/lib/auditedSettingUpdates'; +import { notifyOnSettingChangedById } from '../notifyListener'; export async function removeWorkspaceRegistrationInfo() { const { workspaceRegistered } = await retrieveRegistrationStatus(); diff --git a/apps/meteor/server/lib/cloud/retrieveRegistrationStatus.ts b/apps/meteor/server/lib/cloud/retrieveRegistrationStatus.ts index 4357baa0b0034..408fc1fed41e9 100644 --- a/apps/meteor/server/lib/cloud/retrieveRegistrationStatus.ts +++ b/apps/meteor/server/lib/cloud/retrieveRegistrationStatus.ts @@ -1,6 +1,6 @@ import { Users } from '@rocket.chat/models'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; export async function retrieveRegistrationStatus(): Promise<{ workspaceRegistered: boolean; diff --git a/apps/meteor/server/lib/cloud/saveRegistrationData.ts b/apps/meteor/server/lib/cloud/saveRegistrationData.ts index 9f2522a3f8ba6..590d81047ca84 100644 --- a/apps/meteor/server/lib/cloud/saveRegistrationData.ts +++ b/apps/meteor/server/lib/cloud/saveRegistrationData.ts @@ -1,10 +1,10 @@ import { applyLicense } from '@rocket.chat/license'; import { Settings } from '@rocket.chat/models'; +import { settings } from '../../settings'; import { syncCloudData } from './syncWorkspace/syncCloudData'; -import { notifyOnSettingChangedById } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; import { updateAuditedBySystem } from '../../settings/lib/auditedSettingUpdates'; +import { notifyOnSettingChangedById } from '../notifyListener'; type SaveRegistrationDataDTO = { workspaceId: string; diff --git a/apps/meteor/server/lib/cloud/startRegisterWorkspace.ts b/apps/meteor/server/lib/cloud/startRegisterWorkspace.ts index cc94325123620..09713b271e9b1 100644 --- a/apps/meteor/server/lib/cloud/startRegisterWorkspace.ts +++ b/apps/meteor/server/lib/cloud/startRegisterWorkspace.ts @@ -4,10 +4,10 @@ import { serverFetch as fetch } from '@rocket.chat/server-fetch'; import { buildWorkspaceRegistrationData } from './buildRegistrationData'; import { retrieveRegistrationStatus } from './retrieveRegistrationStatus'; import { syncWorkspace } from './syncWorkspace'; -import { notifyOnSettingChangedById } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; import { updateAuditedBySystem } from '../../settings/lib/auditedSettingUpdates'; import { SystemLogger } from '../logger/system'; +import { notifyOnSettingChangedById } from '../notifyListener'; export async function startRegisterWorkspace(resend = false) { const { workspaceRegistered } = await retrieveRegistrationStatus(); diff --git a/apps/meteor/server/lib/cloud/startRegisterWorkspaceSetupWizard.ts b/apps/meteor/server/lib/cloud/startRegisterWorkspaceSetupWizard.ts index acf6a82f8d8c3..1eb0c906c3e71 100644 --- a/apps/meteor/server/lib/cloud/startRegisterWorkspaceSetupWizard.ts +++ b/apps/meteor/server/lib/cloud/startRegisterWorkspaceSetupWizard.ts @@ -2,7 +2,7 @@ import type { CloudRegistrationIntentData } from '@rocket.chat/core-typings'; import { serverFetch as fetch } from '@rocket.chat/server-fetch'; import { buildWorkspaceRegistrationData } from './buildRegistrationData'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; import { SystemLogger } from '../logger/system'; export async function startRegisterWorkspaceSetupWizard(resend = false, email: string): Promise { diff --git a/apps/meteor/server/lib/cloud/supportedVersionsToken/supportedVersionsToken.ts b/apps/meteor/server/lib/cloud/supportedVersionsToken/supportedVersionsToken.ts index 76386ea79e828..db0ae510fbe72 100644 --- a/apps/meteor/server/lib/cloud/supportedVersionsToken/supportedVersionsToken.ts +++ b/apps/meteor/server/lib/cloud/supportedVersionsToken/supportedVersionsToken.ts @@ -6,11 +6,11 @@ import type { Response } from '@rocket.chat/server-fetch'; import { serverFetch as fetch } from '@rocket.chat/server-fetch'; import { supportedVersionsChooseLatest } from './supportedVersionsChooseLatest'; -import { notifyOnSettingChangedById } from '../../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../../app/settings/server'; import { supportedVersions as supportedVersionsFromBuild } from '../../../../app/utils/rocketchat-supported-versions.info'; +import { settings } from '../../../settings'; import { updateAuditedBySystem } from '../../../settings/lib/auditedSettingUpdates'; import { SystemLogger } from '../../logger/system'; +import { notifyOnSettingChangedById } from '../../notifyListener'; import { generateWorkspaceBearerHttpHeader } from '../getWorkspaceAccessToken'; import { buildVersionUpdateMessage } from '../version-check/functions/buildVersionUpdateMessage'; diff --git a/apps/meteor/server/lib/cloud/syncWorkspace/announcementSync.ts b/apps/meteor/server/lib/cloud/syncWorkspace/announcementSync.ts index d0d1677e2cea5..c9d7221708776 100644 --- a/apps/meteor/server/lib/cloud/syncWorkspace/announcementSync.ts +++ b/apps/meteor/server/lib/cloud/syncWorkspace/announcementSync.ts @@ -2,14 +2,14 @@ import { Cloud } from '@rocket.chat/core-typings'; import { serverFetch as fetch } from '@rocket.chat/server-fetch'; import * as z from 'zod'; -import { settings } from '../../../../app/settings/server'; +import { handleAnnouncementsOnWorkspaceSync, handleNpsOnWorkspaceSync } from './handleCommsSync'; import { CloudWorkspaceConnectionError } from '../../../../lib/errors/CloudWorkspaceConnectionError'; import { CloudWorkspaceRegistrationError } from '../../../../lib/errors/CloudWorkspaceRegistrationError'; +import { settings } from '../../../settings'; import { SystemLogger } from '../../logger/system'; import { buildWorkspaceRegistrationData } from '../buildRegistrationData'; import { CloudWorkspaceAccessTokenEmptyError, getWorkspaceAccessToken } from '../getWorkspaceAccessToken'; import { retrieveRegistrationStatus } from '../retrieveRegistrationStatus'; -import { handleAnnouncementsOnWorkspaceSync, handleNpsOnWorkspaceSync } from './handleCommsSync'; const fetchCloudAnnouncementsSync = async ({ token, diff --git a/apps/meteor/server/lib/cloud/syncWorkspace/fetchWorkspaceSyncPayload.ts b/apps/meteor/server/lib/cloud/syncWorkspace/fetchWorkspaceSyncPayload.ts index 98ca40af714bd..e7be1cdedcbf7 100644 --- a/apps/meteor/server/lib/cloud/syncWorkspace/fetchWorkspaceSyncPayload.ts +++ b/apps/meteor/server/lib/cloud/syncWorkspace/fetchWorkspaceSyncPayload.ts @@ -2,8 +2,8 @@ import { Cloud } from '@rocket.chat/core-typings'; import { serverFetch as fetch } from '@rocket.chat/server-fetch'; import * as z from 'zod'; -import { settings } from '../../../../app/settings/server'; import { CloudWorkspaceConnectionError } from '../../../../lib/errors/CloudWorkspaceConnectionError'; +import { settings } from '../../../settings'; export async function fetchWorkspaceSyncPayload({ token, diff --git a/apps/meteor/server/lib/cloud/syncWorkspace/legacySyncWorkspace.ts b/apps/meteor/server/lib/cloud/syncWorkspace/legacySyncWorkspace.ts index d67fc55b6b9b0..239cb34c13feb 100644 --- a/apps/meteor/server/lib/cloud/syncWorkspace/legacySyncWorkspace.ts +++ b/apps/meteor/server/lib/cloud/syncWorkspace/legacySyncWorkspace.ts @@ -3,10 +3,10 @@ import { Settings } from '@rocket.chat/models'; import { serverFetch as fetch } from '@rocket.chat/server-fetch'; import * as z from 'zod'; -import { notifyOnSettingChangedById } from '../../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../../app/settings/server'; import { CloudWorkspaceConnectionError } from '../../../../lib/errors/CloudWorkspaceConnectionError'; import { CloudWorkspaceRegistrationError } from '../../../../lib/errors/CloudWorkspaceRegistrationError'; +import { settings } from '../../../settings'; +import { notifyOnSettingChangedById } from '../../notifyListener'; import type { WorkspaceRegistrationData } from '../buildRegistrationData'; import { buildWorkspaceRegistrationData } from '../buildRegistrationData'; import { CloudWorkspaceAccessTokenEmptyError, getWorkspaceAccessToken } from '../getWorkspaceAccessToken'; diff --git a/apps/meteor/server/lib/cloud/userLogout.ts b/apps/meteor/server/lib/cloud/userLogout.ts index 1d0927d64d87f..cf3e8124621d2 100644 --- a/apps/meteor/server/lib/cloud/userLogout.ts +++ b/apps/meteor/server/lib/cloud/userLogout.ts @@ -3,7 +3,7 @@ import { serverFetch as fetch } from '@rocket.chat/server-fetch'; import { retrieveRegistrationStatus } from './retrieveRegistrationStatus'; import { userLoggedOut } from './userLoggedOut'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; import { SystemLogger } from '../logger/system'; export async function userLogout(userId: string): Promise { diff --git a/apps/meteor/server/lib/cloud/version-check/functions/buildVersionUpdateMessage.spec.ts b/apps/meteor/server/lib/cloud/version-check/functions/buildVersionUpdateMessage.spec.ts index d51b1c8310c61..5e611ba0e5fb6 100644 --- a/apps/meteor/server/lib/cloud/version-check/functions/buildVersionUpdateMessage.spec.ts +++ b/apps/meteor/server/lib/cloud/version-check/functions/buildVersionUpdateMessage.spec.ts @@ -28,7 +28,7 @@ jest.mock('@rocket.chat/models', () => ({ const mockSettingsGet = jest.fn(); -jest.mock('../../../../../app/settings/server', () => ({ +jest.mock('../../../../settings', () => ({ settings: { get: (key: string) => mockSettingsGet(key), }, @@ -48,7 +48,7 @@ jest.mock('../../../../settings/lib/auditedSettingUpdates', () => ({ updateAuditedBySystem: jest.fn(() => () => Promise.resolve({ modifiedCount: 0 })), })); -jest.mock('../../../../../app/lib/server/lib/notifyListener', () => ({ +jest.mock('../../../notifyListener', () => ({ notifyOnSettingChangedById: jest.fn(), })); diff --git a/apps/meteor/server/lib/cloud/version-check/functions/buildVersionUpdateMessage.ts b/apps/meteor/server/lib/cloud/version-check/functions/buildVersionUpdateMessage.ts index 1667812570e24..a95af5f54f2f1 100644 --- a/apps/meteor/server/lib/cloud/version-check/functions/buildVersionUpdateMessage.ts +++ b/apps/meteor/server/lib/cloud/version-check/functions/buildVersionUpdateMessage.ts @@ -2,11 +2,11 @@ import type { IUser } from '@rocket.chat/core-typings'; import { Settings, Users } from '@rocket.chat/models'; import semver from 'semver'; -import { notifyOnSettingChangedById } from '../../../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../../../app/settings/server'; import { Info } from '../../../../../app/utils/rocketchat.info'; +import { settings } from '../../../../settings'; import { updateAuditedBySystem } from '../../../../settings/lib/auditedSettingUpdates'; import { i18n } from '../../../i18n'; +import { notifyOnSettingChangedById } from '../../../notifyListener'; import { sendMessagesToAdmins } from '../../../sendMessagesToAdmins'; const cleanupOutdatedVersionUpdateBanners = async (): Promise => { diff --git a/apps/meteor/server/lib/cloud/version-check/index.ts b/apps/meteor/server/lib/cloud/version-check/index.ts index 7c838230355f1..8415a5a46057c 100644 --- a/apps/meteor/server/lib/cloud/version-check/index.ts +++ b/apps/meteor/server/lib/cloud/version-check/index.ts @@ -2,7 +2,7 @@ import { cronJobs } from '@rocket.chat/cron'; import { Meteor } from 'meteor/meteor'; import { checkVersionUpdate } from './functions/checkVersionUpdate'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; const jobName = 'version_check'; diff --git a/apps/meteor/server/lib/compareUserPasswordHistory.ts b/apps/meteor/server/lib/compareUserPasswordHistory.ts index eda527ded1e81..fb30ed4f9199a 100644 --- a/apps/meteor/server/lib/compareUserPasswordHistory.ts +++ b/apps/meteor/server/lib/compareUserPasswordHistory.ts @@ -2,7 +2,7 @@ import type { IUser, IPassword } from '@rocket.chat/core-typings'; import { Accounts } from 'meteor/accounts-base'; import type { Meteor } from 'meteor/meteor'; -import { settings } from '../../app/settings/server'; +import { settings } from '../settings'; /** * Check if a given password is the one user by given user or if the user doesn't have a password diff --git a/apps/meteor/app/cors/server/cors.ts b/apps/meteor/server/lib/cors/cors.ts similarity index 97% rename from apps/meteor/app/cors/server/cors.ts rename to apps/meteor/server/lib/cors/cors.ts index 9464762d57d04..a727d658c79b0 100644 --- a/apps/meteor/app/cors/server/cors.ts +++ b/apps/meteor/server/lib/cors/cors.ts @@ -7,8 +7,8 @@ import { Meteor } from 'meteor/meteor'; import type { StaticFiles } from 'meteor/webapp'; import { WebApp, WebAppInternals } from 'meteor/webapp'; -import { getWebAppHash } from '../../../server/configuration/configureBoilerplate'; -import { settings } from '../../settings/server'; +import { getWebAppHash } from '../../configuration/configureBoilerplate'; +import { settings } from '../../settings'; // Taken from 'connect' types type NextFunction = (err?: any) => void; diff --git a/apps/meteor/app/cors/server/index.ts b/apps/meteor/server/lib/cors/index.ts similarity index 80% rename from apps/meteor/app/cors/server/index.ts rename to apps/meteor/server/lib/cors/index.ts index e91bda0591a52..9b07878842f3a 100644 --- a/apps/meteor/app/cors/server/index.ts +++ b/apps/meteor/server/lib/cors/index.ts @@ -1,7 +1,7 @@ import './cors'; import { Meteor } from 'meteor/meteor'; -import { settings } from '../../settings/server'; +import { settings } from '../../settings'; Meteor.startup(() => { settings.watch('Force_SSL', (value) => { diff --git a/apps/meteor/server/lib/dataExport/exportRoomMessagesToFile.ts b/apps/meteor/server/lib/dataExport/exportRoomMessagesToFile.ts index 5ae8f45411c26..fb936e5fcb8cc 100644 --- a/apps/meteor/server/lib/dataExport/exportRoomMessagesToFile.ts +++ b/apps/meteor/server/lib/dataExport/exportRoomMessagesToFile.ts @@ -4,8 +4,8 @@ import type { IMessage, IRoom, IUser, MessageAttachment, FileProp, RoomType, IEx import { Messages } from '@rocket.chat/models'; import { escapeHTML } from '@rocket.chat/string-helpers'; -import { settings } from '../../../app/settings/server'; import { readSecondaryPreferred } from '../../database/readSecondaryPreferred'; +import { settings } from '../../settings'; import { joinPath } from '../fileUtils'; import { i18n } from '../i18n'; diff --git a/apps/meteor/server/lib/dataExport/processDataDownloads.spec.ts b/apps/meteor/server/lib/dataExport/processDataDownloads.spec.ts index a802003990154..a2bd4dcbe8e49 100644 --- a/apps/meteor/server/lib/dataExport/processDataDownloads.spec.ts +++ b/apps/meteor/server/lib/dataExport/processDataDownloads.spec.ts @@ -107,7 +107,7 @@ const modelsMock = { const { exportRoomMessagesToFile } = proxyquire.noCallThru().load('./exportRoomMessagesToFile.ts', { '@rocket.chat/models': modelsMock, - '../../../app/settings/server': { + '../../settings': { settings: { get: (_key: string) => { return undefined; @@ -123,7 +123,7 @@ const { exportRoomMessagesToFile } = proxyquire.noCallThru().load('./exportRoomM const { requestDataDownload } = proxyquire.noCallThru().load('../../meteor-methods/platform/requestDataDownload.ts', { '@rocket.chat/models': modelsMock, - '../../../app/settings/server': { + '../../settings': { settings: { get: (_key: string) => { return undefined; @@ -156,14 +156,14 @@ const { processDataDownloads } = proxyquire.noCallThru().load('./processDataDown }, }, }, - '../../../app/settings/server': { + '../../settings': { settings: { get: (_key: string) => { return undefined; }, }, }, - '../../../app/utils/server/getURL': { + '../utils/getURL': { getURL: (path: string) => `https://example.com${path}`, }, '../i18n': { diff --git a/apps/meteor/server/lib/dataExport/processDataDownloads.ts b/apps/meteor/server/lib/dataExport/processDataDownloads.ts index e45e85e48e0ae..f9f31d1864e61 100644 --- a/apps/meteor/server/lib/dataExport/processDataDownloads.ts +++ b/apps/meteor/server/lib/dataExport/processDataDownloads.ts @@ -7,8 +7,7 @@ import { Avatars, ExportOperations, UserDataFiles, Subscriptions } from '@rocket import { escapeHTML } from '@rocket.chat/string-helpers'; import moment from 'moment'; -import { settings } from '../../../app/settings/server'; -import { getURL } from '../../../app/utils/server/getURL'; +import { settings } from '../../settings'; import { joinPath } from '../fileUtils'; import { i18n } from '../i18n'; import { copyFileUpload } from './copyFileUpload'; @@ -19,6 +18,7 @@ import { makeZipFile } from './makeZipFile'; import { sendEmail } from './sendEmail'; import { uploadZipFile } from './uploadZipFile'; import { FileUpload } from '../media/file-upload'; +import { getURL } from '../utils/getURL'; const loadUserSubscriptions = async (_exportOperation: IExportOperation, fileType: 'json' | 'html', userId: IUser['_id']) => { const roomList: ( diff --git a/apps/meteor/server/lib/dataExport/sendEmail.ts b/apps/meteor/server/lib/dataExport/sendEmail.ts index 7182ea323cd5a..123e8d6494f78 100644 --- a/apps/meteor/server/lib/dataExport/sendEmail.ts +++ b/apps/meteor/server/lib/dataExport/sendEmail.ts @@ -1,7 +1,7 @@ import type { IUser } from '@rocket.chat/core-typings'; -import { settings } from '../../../app/settings/server'; import { getUserEmailAddress } from '../../../lib/getUserEmailAddress'; +import { settings } from '../../settings'; import * as Mailer from '../notifications/email/api'; export const sendEmail = async (userData: Pick, subject: string, body: string): Promise => { diff --git a/apps/meteor/server/lib/dataExport/sendFile.ts b/apps/meteor/server/lib/dataExport/sendFile.ts index 6ae72e74cba29..ac100c2cbf83a 100644 --- a/apps/meteor/server/lib/dataExport/sendFile.ts +++ b/apps/meteor/server/lib/dataExport/sendFile.ts @@ -4,7 +4,6 @@ import path, { join } from 'node:path'; import type { IUser } from '@rocket.chat/core-typings'; -import { getURL } from '../../../app/utils/server/getURL'; import { i18n } from '../i18n'; import { copyFileUpload } from './copyFileUpload'; import { exportRoomMessagesToFile } from './exportRoomMessagesToFile'; @@ -13,6 +12,7 @@ import { getRoomData } from './getRoomData'; import { makeZipFile } from './makeZipFile'; import { sendEmail } from './sendEmail'; import { uploadZipFile } from './uploadZipFile'; +import { getURL } from '../utils/getURL'; type ExportFile = { rid: string; diff --git a/apps/meteor/server/lib/dataExport/sendViaEmail.ts b/apps/meteor/server/lib/dataExport/sendViaEmail.ts index 88b95ee5f5b82..275886634ee6e 100644 --- a/apps/meteor/server/lib/dataExport/sendViaEmail.ts +++ b/apps/meteor/server/lib/dataExport/sendViaEmail.ts @@ -3,9 +3,9 @@ import { Messages, Users } from '@rocket.chat/models'; import { escapeHTML } from '@rocket.chat/string-helpers'; import moment from 'moment'; -import { settings } from '../../../app/settings/server'; -import { Message } from '../../../app/ui-utils/server'; +import { settings } from '../../settings'; import { getMomentLocale } from '../getMomentLocale'; +import { Message } from '../messaging/Message'; import * as Mailer from '../notifications/email/api'; export async function sendViaEmail( diff --git a/apps/meteor/app/lib/server/lib/debug.js b/apps/meteor/server/lib/debug.js similarity index 92% rename from apps/meteor/app/lib/server/lib/debug.js rename to apps/meteor/server/lib/debug.js index 4977ea0dd731e..068b9e18de489 100644 --- a/apps/meteor/app/lib/server/lib/debug.js +++ b/apps/meteor/server/lib/debug.js @@ -5,10 +5,10 @@ import { Meteor } from 'meteor/meteor'; import { WebApp } from 'meteor/webapp'; import _ from 'underscore'; -import { getMethodArgs } from '../../../../server/lib/logger/logPayloads'; -import { metrics } from '../../../../server/lib/metrics'; -import { getModifiedHttpHeaders } from '../../../../server/lib/shared/getModifiedHttpHeaders'; -import { settings } from '../../../settings/server'; +import { getMethodArgs } from './logger/logPayloads'; +import { metrics } from './metrics'; +import { settings } from '../settings'; +import { getModifiedHttpHeaders } from './shared/getModifiedHttpHeaders'; const logger = new Logger('Meteor'); diff --git a/apps/meteor/app/lib/server/lib/defaultBlockedDomainsList.ts b/apps/meteor/server/lib/defaultBlockedDomainsList.ts similarity index 100% rename from apps/meteor/app/lib/server/lib/defaultBlockedDomainsList.ts rename to apps/meteor/server/lib/defaultBlockedDomainsList.ts diff --git a/apps/meteor/app/lib/server/lib/deprecationWarningLogger.ts b/apps/meteor/server/lib/deprecationWarningLogger.ts similarity index 98% rename from apps/meteor/app/lib/server/lib/deprecationWarningLogger.ts rename to apps/meteor/server/lib/deprecationWarningLogger.ts index 940bc9b2523c3..b1b512be93500 100644 --- a/apps/meteor/app/lib/server/lib/deprecationWarningLogger.ts +++ b/apps/meteor/server/lib/deprecationWarningLogger.ts @@ -2,7 +2,7 @@ import { Logger } from '@rocket.chat/logger'; import type { PathPattern } from '@rocket.chat/rest-typings'; import semver from 'semver'; -import { metrics } from '../../../../server/lib/metrics/lib/metrics'; +import { metrics } from './metrics/lib/metrics'; const deprecationLogger = new Logger('DeprecationWarning'); diff --git a/apps/meteor/server/lib/e2e/beforeCreateRoom.ts b/apps/meteor/server/lib/e2e/beforeCreateRoom.ts index c643ba3f0c69d..828ec468318a7 100644 --- a/apps/meteor/server/lib/e2e/beforeCreateRoom.ts +++ b/apps/meteor/server/lib/e2e/beforeCreateRoom.ts @@ -1,4 +1,4 @@ -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; import { prepareCreateRoomCallback } from '../callbacks/beforeCreateRoomCallback'; prepareCreateRoomCallback.add(({ type, extraData }) => { diff --git a/apps/meteor/server/lib/e2e/functions/handleSuggestedGroupKey.ts b/apps/meteor/server/lib/e2e/functions/handleSuggestedGroupKey.ts index f54fde4c130c3..3e8c7210af727 100644 --- a/apps/meteor/server/lib/e2e/functions/handleSuggestedGroupKey.ts +++ b/apps/meteor/server/lib/e2e/functions/handleSuggestedGroupKey.ts @@ -1,7 +1,7 @@ import { Rooms, Subscriptions } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { notifyOnSubscriptionChangedById, notifyOnRoomChangedById } from '../../../../app/lib/server/lib/notifyListener'; +import { notifyOnSubscriptionChangedById, notifyOnRoomChangedById } from '../../notifyListener'; export async function handleSuggestedGroupKey( handle: 'accept' | 'reject', diff --git a/apps/meteor/server/lib/e2e/functions/provideUsersSuggestedGroupKeys.ts b/apps/meteor/server/lib/e2e/functions/provideUsersSuggestedGroupKeys.ts index 5d1ac38a25ff5..cdaf18b0942bb 100644 --- a/apps/meteor/server/lib/e2e/functions/provideUsersSuggestedGroupKeys.ts +++ b/apps/meteor/server/lib/e2e/functions/provideUsersSuggestedGroupKeys.ts @@ -1,8 +1,8 @@ import type { IRoom, IUser, ISubscription } from '@rocket.chat/core-typings'; import { Rooms, Subscriptions } from '@rocket.chat/models'; -import { notifyOnSubscriptionChanged, notifyOnRoomChangedById } from '../../../../app/lib/server/lib/notifyListener'; import { canAccessRoomIdAsync } from '../../authorization/canAccessRoom'; +import { notifyOnSubscriptionChanged, notifyOnRoomChangedById } from '../../notifyListener'; export const provideUsersSuggestedGroupKeys = async ( userId: IUser['_id'], diff --git a/apps/meteor/server/lib/e2e/functions/resetRoomKey.ts b/apps/meteor/server/lib/e2e/functions/resetRoomKey.ts index 6786f2ca993e6..2f8397ee8e496 100644 --- a/apps/meteor/server/lib/e2e/functions/resetRoomKey.ts +++ b/apps/meteor/server/lib/e2e/functions/resetRoomKey.ts @@ -2,7 +2,7 @@ import type { ISubscription, IUser, IRoom } from '@rocket.chat/core-typings'; import { Rooms, Subscriptions, Users } from '@rocket.chat/models'; import type { AnyBulkWriteOperation } from 'mongodb'; -import { notifyOnRoomChanged, notifyOnSubscriptionChanged } from '../../../../app/lib/server/lib/notifyListener'; +import { notifyOnRoomChanged, notifyOnSubscriptionChanged } from '../../notifyListener'; export async function resetRoomKey(roomId: string, userId: string, newRoomKey: string, newRoomKeyId: string) { const user = await Users.findOneById>(userId, { projection: { e2e: 1 } }); diff --git a/apps/meteor/app/error-handler/server/lib/RocketChat.ErrorHandler.ts b/apps/meteor/server/lib/error-handler/RocketChat.ErrorHandler.ts similarity index 95% rename from apps/meteor/app/error-handler/server/lib/RocketChat.ErrorHandler.ts rename to apps/meteor/server/lib/error-handler/RocketChat.ErrorHandler.ts index 5128dd7b62a4b..828f173b43806 100644 --- a/apps/meteor/app/error-handler/server/lib/RocketChat.ErrorHandler.ts +++ b/apps/meteor/server/lib/error-handler/RocketChat.ErrorHandler.ts @@ -1,9 +1,9 @@ import { Settings, Users, Rooms } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { throttledCounter } from '../../../../lib/utils/throttledCounter'; -import { sendMessage } from '../../../../server/lib/messages/sendMessage'; -import { settings } from '../../../settings/server'; +import { throttledCounter } from '../../../lib/utils/throttledCounter'; +import { settings } from '../../settings'; +import { sendMessage } from '../messages/sendMessage'; const incException = throttledCounter((counter) => { Settings.incrementValueById('Uncaught_Exceptions_Count', counter, { returnDocument: 'after' }) diff --git a/apps/meteor/server/lib/error-handler/index.ts b/apps/meteor/server/lib/error-handler/index.ts new file mode 100644 index 0000000000000..12b31964039b9 --- /dev/null +++ b/apps/meteor/server/lib/error-handler/index.ts @@ -0,0 +1 @@ +import './RocketChat.ErrorHandler'; diff --git a/apps/meteor/server/lib/findUsersOfRoom.ts b/apps/meteor/server/lib/findUsersOfRoom.ts index 25c0a34f0198a..eb2942fa3e803 100644 --- a/apps/meteor/server/lib/findUsersOfRoom.ts +++ b/apps/meteor/server/lib/findUsersOfRoom.ts @@ -3,7 +3,7 @@ import type { FindPaginated } from '@rocket.chat/model-typings'; import { Users } from '@rocket.chat/models'; import type { FindCursor, FindOptions, Filter } from 'mongodb'; -import { settings } from '../../app/settings/server'; +import { settings } from '../settings'; type FindUsersParam = { rid: string; diff --git a/apps/meteor/server/lib/findUsersOfRoomOrderedByRole.ts b/apps/meteor/server/lib/findUsersOfRoomOrderedByRole.ts index e03544d3a5a03..fb1eca8830f2d 100644 --- a/apps/meteor/server/lib/findUsersOfRoomOrderedByRole.ts +++ b/apps/meteor/server/lib/findUsersOfRoomOrderedByRole.ts @@ -3,7 +3,7 @@ import { Subscriptions, Users } from '@rocket.chat/models'; import { escapeRegExp } from '@rocket.chat/string-helpers'; import type { Document, FilterOperators } from 'mongodb'; -import { settings } from '../../app/settings/server'; +import { settings } from '../settings'; type FindUsersParam = { rid: string; diff --git a/apps/meteor/server/lib/getSubscriptionAutotranslateDefaultConfig.ts b/apps/meteor/server/lib/getSubscriptionAutotranslateDefaultConfig.ts index 92e76d8c2ec13..82e74c1fc6954 100644 --- a/apps/meteor/server/lib/getSubscriptionAutotranslateDefaultConfig.ts +++ b/apps/meteor/server/lib/getSubscriptionAutotranslateDefaultConfig.ts @@ -1,6 +1,6 @@ import type { AtLeast, IUser } from '@rocket.chat/core-typings'; -import { settings } from '../../app/settings/server'; +import { settings } from '../settings'; export function getSubscriptionAutotranslateDefaultConfig(user: AtLeast): | { diff --git a/apps/meteor/server/lib/import/classes/Importer.ts b/apps/meteor/server/lib/import/classes/Importer.ts index ce58482c9790d..517f7a23a40aa 100644 --- a/apps/meteor/server/lib/import/classes/Importer.ts +++ b/apps/meteor/server/lib/import/classes/Importer.ts @@ -18,8 +18,8 @@ import type { ConverterOptions } from './ImportDataConverter'; import { ImporterProgress } from './ImporterProgress'; import { ImporterWebsocket } from './ImporterWebsocket'; import { ProgressStep, ImportPreparingStartedStates } from '../../../../app/importer/lib/ImporterProgressStep'; -import { notifyOnSettingChanged, notifyOnSettingChangedById } from '../../../../app/lib/server/lib/notifyListener'; import { t } from '../../../../app/utils/lib/i18n'; +import { notifyOnSettingChanged, notifyOnSettingChangedById } from '../../notifyListener'; import type { ImporterInfo } from '../definitions/ImporterInfo'; import { Selection, SelectionChannel, SelectionUser } from '../index'; diff --git a/apps/meteor/server/lib/import/classes/converters/ContactConverter.ts b/apps/meteor/server/lib/import/classes/converters/ContactConverter.ts index 21d97829be5ae..d8abe4d1c9c0a 100644 --- a/apps/meteor/server/lib/import/classes/converters/ContactConverter.ts +++ b/apps/meteor/server/lib/import/classes/converters/ContactConverter.ts @@ -2,9 +2,9 @@ import type { IImportContact, IImportContactRecord } from '@rocket.chat/core-typ import { LivechatVisitors } from '@rocket.chat/models'; import { RecordConverter } from './RecordConverter'; -import { createContact } from '../../../../../app/livechat/server/lib/contacts/createContact'; -import { getAllowedCustomFields } from '../../../../../app/livechat/server/lib/contacts/getAllowedCustomFields'; -import { validateCustomFields } from '../../../../../app/livechat/server/lib/contacts/validateCustomFields'; +import { createContact } from '../../../omnichannel/contacts/createContact'; +import { getAllowedCustomFields } from '../../../omnichannel/contacts/getAllowedCustomFields'; +import { validateCustomFields } from '../../../omnichannel/contacts/validateCustomFields'; export class ContactConverter extends RecordConverter { protected async convertCustomFields(customFields: IImportContact['customFields']): Promise { diff --git a/apps/meteor/server/lib/import/classes/converters/RoomConverter.ts b/apps/meteor/server/lib/import/classes/converters/RoomConverter.ts index 248db83b44667..90d41b99237be 100644 --- a/apps/meteor/server/lib/import/classes/converters/RoomConverter.ts +++ b/apps/meteor/server/lib/import/classes/converters/RoomConverter.ts @@ -4,11 +4,11 @@ import { removeEmpty } from '@rocket.chat/tools'; import limax from 'limax'; import { RecordConverter } from './RecordConverter'; -import { notifyOnSubscriptionChangedByRoomId } from '../../../../../app/lib/server/lib/notifyListener'; import { createDirectMessage } from '../../../../meteor-methods/messages/createDirectMessage'; import { createChannelMethod } from '../../../../meteor-methods/rooms/createChannel'; import { createPrivateGroupMethod } from '../../../../meteor-methods/rooms/createPrivateGroup'; import { saveRoomSettings } from '../../../../meteor-methods/rooms/saveRoomSettings'; +import { notifyOnSubscriptionChangedByRoomId } from '../../../notifyListener'; import type { IConversionCallbacks } from '../../definitions/IConversionCallbacks'; export class RoomConverter extends RecordConverter { diff --git a/apps/meteor/server/lib/import/classes/converters/UserConverter.ts b/apps/meteor/server/lib/import/classes/converters/UserConverter.ts index 7d7757b523a83..b4ce447b48f7f 100644 --- a/apps/meteor/server/lib/import/classes/converters/UserConverter.ts +++ b/apps/meteor/server/lib/import/classes/converters/UserConverter.ts @@ -7,8 +7,8 @@ import { Accounts } from 'meteor/accounts-base'; import { RecordConverter, type RecordConverterOptions } from './RecordConverter'; import { generateTempPassword } from './generateTempPassword'; -import { notifyOnUserChange } from '../../../../../app/lib/server/lib/notifyListener'; import { callbacks as systemCallbacks } from '../../../callbacks'; +import { notifyOnUserChange } from '../../../notifyListener'; import { addUserToDefaultChannels } from '../../../rooms/addUserToDefaultChannels'; import { generateUsernameSuggestion } from '../../../users/getUsernameSuggestion'; import { saveUserIdentity } from '../../../users/saveUserIdentity'; diff --git a/apps/meteor/server/lib/import/csv/CsvImporter.ts b/apps/meteor/server/lib/import/csv/CsvImporter.ts index c2894a21d68a1..6deb5be5da732 100644 --- a/apps/meteor/server/lib/import/csv/CsvImporter.ts +++ b/apps/meteor/server/lib/import/csv/CsvImporter.ts @@ -4,7 +4,7 @@ import { Random } from '@rocket.chat/random'; import { parse } from 'csv-parse/lib/sync'; import { Importer, ProgressStep, ImporterWebsocket } from '..'; -import { notifyOnSettingChanged } from '../../../../app/lib/server/lib/notifyListener'; +import { notifyOnSettingChanged } from '../../notifyListener'; import type { ConverterOptions } from '../classes/ImportDataConverter'; import type { ImporterProgress } from '../classes/ImporterProgress'; import type { ImporterInfo } from '../definitions/ImporterInfo'; diff --git a/apps/meteor/server/lib/import/slack-users/SlackUsersImporter.ts b/apps/meteor/server/lib/import/slack-users/SlackUsersImporter.ts index 8edf4fe211cb4..9ac45f7f4352d 100644 --- a/apps/meteor/server/lib/import/slack-users/SlackUsersImporter.ts +++ b/apps/meteor/server/lib/import/slack-users/SlackUsersImporter.ts @@ -5,8 +5,8 @@ import { Settings } from '@rocket.chat/models'; import { parse } from 'csv-parse/lib/sync'; import { Importer, ProgressStep } from '..'; -import { notifyOnSettingChanged } from '../../../../app/lib/server/lib/notifyListener'; import { RocketChatFile } from '../../media/file'; +import { notifyOnSettingChanged } from '../../notifyListener'; import type { ConverterOptions } from '../classes/ImportDataConverter'; import type { ImporterProgress } from '../classes/ImporterProgress'; import type { ImporterInfo } from '../definitions/ImporterInfo'; diff --git a/apps/meteor/server/lib/import/slack/SlackImporter.ts b/apps/meteor/server/lib/import/slack/SlackImporter.ts index 90156da12e52c..ca765883875e1 100644 --- a/apps/meteor/server/lib/import/slack/SlackImporter.ts +++ b/apps/meteor/server/lib/import/slack/SlackImporter.ts @@ -3,10 +3,10 @@ import { Messages, Settings, ImportData } from '@rocket.chat/models'; import type { IZipEntry } from 'adm-zip'; import { Importer, ProgressStep, ImporterWebsocket } from '..'; -import { notifyOnSettingChanged } from '../../../../app/lib/server/lib/notifyListener'; import { MentionsParser } from '../../../../app/mentions/lib/MentionsParser'; -import { settings } from '../../../../app/settings/server'; -import { getUserAvatarURL } from '../../../../app/utils/server/getUserAvatarURL'; +import { settings } from '../../../settings'; +import { notifyOnSettingChanged } from '../../notifyListener'; +import { getUserAvatarURL } from '../../utils/getUserAvatarURL'; import type { ImporterProgress } from '../classes/ImporterProgress'; type SlackChannel = { diff --git a/apps/meteor/server/lib/import/startup/store.js b/apps/meteor/server/lib/import/startup/store.js index 522fe37221da8..ec6ec667eab09 100644 --- a/apps/meteor/server/lib/import/startup/store.js +++ b/apps/meteor/server/lib/import/startup/store.js @@ -1,6 +1,6 @@ import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; import { RocketChatFile } from '../../media/file'; export let RocketChatImportFileInstance; diff --git a/apps/meteor/server/lib/integrations/lib/triggerHandler.ts b/apps/meteor/server/lib/integrations/lib/triggerHandler.ts index 2100c4f28be61..4fbdc4501ad1b 100644 --- a/apps/meteor/server/lib/integrations/lib/triggerHandler.ts +++ b/apps/meteor/server/lib/integrations/lib/triggerHandler.ts @@ -18,9 +18,9 @@ import type { OutgoingRequestData } from './ScriptEngine'; import { IsolatedVMScriptEngine } from './isolated-vm/isolated-vm'; import { updateHistory } from './updateHistory'; import { outgoingEvents } from '../../../../app/integrations/lib/outgoingEvents'; -import { notifyOnIntegrationChangedById } from '../../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; import { processWebhookMessage } from '../../messages/processWebhookMessage'; +import { notifyOnIntegrationChangedById } from '../../notifyListener'; import { getRoomByNameOrIdWithOptionToJoin } from '../../rooms/getRoomByNameOrIdWithOptionToJoin'; import { outgoingLogger } from '../logger'; diff --git a/apps/meteor/server/lib/integrations/lib/updateHistory.ts b/apps/meteor/server/lib/integrations/lib/updateHistory.ts index c8d07ba1d667c..cf52bebe5abf6 100644 --- a/apps/meteor/server/lib/integrations/lib/updateHistory.ts +++ b/apps/meteor/server/lib/integrations/lib/updateHistory.ts @@ -1,8 +1,8 @@ import type { IIntegrationHistory, OutgoingIntegrationEvent, IIntegration, IMessage, AtLeast } from '@rocket.chat/core-typings'; import { IntegrationHistory } from '@rocket.chat/models'; -import { notifyOnIntegrationHistoryChangedById, notifyOnIntegrationHistoryChanged } from '../../../../app/lib/server/lib/notifyListener'; import { omit } from '../../../../lib/utils/omit'; +import { notifyOnIntegrationHistoryChangedById, notifyOnIntegrationHistoryChanged } from '../../notifyListener'; export const updateHistory = async ({ historyId, diff --git a/apps/meteor/server/lib/ldap/Connection.ts b/apps/meteor/server/lib/ldap/Connection.ts index 1c3aba67ef5cd..316ef294425c7 100644 --- a/apps/meteor/server/lib/ldap/Connection.ts +++ b/apps/meteor/server/lib/ldap/Connection.ts @@ -12,8 +12,8 @@ import ldapjs from 'ldapjs'; import { logger, connLogger, searchLogger, authLogger, bindLogger, mapLogger } from './Logger'; import { getLDAPConditionalSetting } from './getLDAPConditionalSetting'; import { processLdapVariables, type LDAPVariableMap } from './processLdapVariables'; -import { settings } from '../../../app/settings/server'; import { ensureArray } from '../../../lib/utils/arrayUtils'; +import { settings } from '../../settings'; interface ILDAPEntryCallback { (entry: ldapjs.SearchEntry): T | undefined; diff --git a/apps/meteor/server/lib/ldap/Manager.ts b/apps/meteor/server/lib/ldap/Manager.ts index 87930505933dd..0c3951d376c9c 100644 --- a/apps/meteor/server/lib/ldap/Manager.ts +++ b/apps/meteor/server/lib/ldap/Manager.ts @@ -15,8 +15,8 @@ import { getLDAPConditionalSetting } from './getLDAPConditionalSetting'; import { getLdapDynamicValue } from './getLdapDynamicValue'; import { getLdapString } from './getLdapString'; import { ldapKeyExists } from './ldapKeyExists'; -import { settings } from '../../../app/settings/server'; import { omit } from '../../../lib/utils/omit'; +import { settings } from '../../settings'; import { callbacks } from '../callbacks'; import type { UserConverterOptions } from '../import/classes/converters/UserConverter'; import { setUserAvatar } from '../users/setUserAvatar'; diff --git a/apps/meteor/server/lib/ldap/UserConverter.ts b/apps/meteor/server/lib/ldap/UserConverter.ts index 1905ba2294f51..5ce9fda84c5b2 100644 --- a/apps/meteor/server/lib/ldap/UserConverter.ts +++ b/apps/meteor/server/lib/ldap/UserConverter.ts @@ -4,7 +4,7 @@ import type { Logger } from '@rocket.chat/logger'; import { Users } from '@rocket.chat/models'; import { logger } from './Logger'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; import type { ConverterCache } from '../import/classes/converters/ConverterCache'; import type { RecordConverterOptions } from '../import/classes/converters/RecordConverter'; import { UserConverter, type UserConverterOptions } from '../import/classes/converters/UserConverter'; diff --git a/apps/meteor/server/lib/ldap/getLDAPConditionalSetting.ts b/apps/meteor/server/lib/ldap/getLDAPConditionalSetting.ts index 4b48e232bef56..243f85ae3aefc 100644 --- a/apps/meteor/server/lib/ldap/getLDAPConditionalSetting.ts +++ b/apps/meteor/server/lib/ldap/getLDAPConditionalSetting.ts @@ -1,6 +1,6 @@ import type { SettingValue } from '@rocket.chat/core-typings'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; export function getLDAPConditionalSetting(settingName: string): T | undefined { const isActiveDirectory = settings.get('LDAP_Server_Type') === 'ad'; diff --git a/apps/meteor/server/lib/media/assets/assets.ts b/apps/meteor/server/lib/media/assets/assets.ts index 0c3819f2bbb6a..933e0b74f68e8 100644 --- a/apps/meteor/server/lib/media/assets/assets.ts +++ b/apps/meteor/server/lib/media/assets/assets.ts @@ -9,11 +9,11 @@ import { Meteor } from 'meteor/meteor'; import { WebApp, WebAppInternals } from 'meteor/webapp'; import sharp from 'sharp'; -import { notifyOnSettingChangedById } from '../../../../app/lib/server/lib/notifyListener'; -import { settings, settingsRegistry } from '../../../../app/settings/server'; import { getExtension } from '../../../../app/utils/lib/mimeTypes'; -import { getURL } from '../../../../app/utils/server/getURL'; +import { settings, settingsRegistry } from '../../../settings'; import { hasPermissionAsync } from '../../authorization/hasPermission'; +import { notifyOnSettingChangedById } from '../../notifyListener'; +import { getURL } from '../../utils/getURL'; import { RocketChatFile } from '../file'; const RocketChatAssetsInstance = new RocketChatFile.GridFS({ diff --git a/apps/meteor/server/lib/media/custom-sounds/startup/custom-sounds.js b/apps/meteor/server/lib/media/custom-sounds/startup/custom-sounds.js index 54631ea89ef57..e1f68ed7650e3 100644 --- a/apps/meteor/server/lib/media/custom-sounds/startup/custom-sounds.js +++ b/apps/meteor/server/lib/media/custom-sounds/startup/custom-sounds.js @@ -2,7 +2,7 @@ import { CustomSounds } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; import { WebApp } from 'meteor/webapp'; -import { settings } from '../../../../../app/settings/server'; +import { settings } from '../../../../settings'; import { SystemLogger } from '../../../logger/system'; import { RocketChatFile } from '../../file'; diff --git a/apps/meteor/server/lib/media/emoji-custom/startup/emoji-custom.js b/apps/meteor/server/lib/media/emoji-custom/startup/emoji-custom.js index 25c2b07bb02f0..394fee33395e4 100644 --- a/apps/meteor/server/lib/media/emoji-custom/startup/emoji-custom.js +++ b/apps/meteor/server/lib/media/emoji-custom/startup/emoji-custom.js @@ -3,7 +3,7 @@ import { Meteor } from 'meteor/meteor'; import { WebApp } from 'meteor/webapp'; import _ from 'underscore'; -import { settings } from '../../../../../app/settings/server'; +import { settings } from '../../../../settings'; import { SystemLogger } from '../../../logger/system'; import { RocketChatFile } from '../../file'; diff --git a/apps/meteor/server/lib/media/file-upload/config/AmazonS3.ts b/apps/meteor/server/lib/media/file-upload/config/AmazonS3.ts index 5831a71139e63..19ed48d2a39ac 100644 --- a/apps/meteor/server/lib/media/file-upload/config/AmazonS3.ts +++ b/apps/meteor/server/lib/media/file-upload/config/AmazonS3.ts @@ -4,7 +4,7 @@ import https from 'node:https'; import _ from 'underscore'; import { forceDownload } from './helper'; -import { settings } from '../../../../../app/settings/server'; +import { settings } from '../../../../settings'; import { SystemLogger } from '../../../logger/system'; import { FileUploadClass, FileUpload } from '../lib/FileUpload'; import type { S3Options } from '../ufs/AmazonS3/server'; diff --git a/apps/meteor/server/lib/media/file-upload/config/FileSystem.ts b/apps/meteor/server/lib/media/file-upload/config/FileSystem.ts index 6d1c33153af62..a5129b6a3f7e7 100644 --- a/apps/meteor/server/lib/media/file-upload/config/FileSystem.ts +++ b/apps/meteor/server/lib/media/file-upload/config/FileSystem.ts @@ -1,7 +1,7 @@ import fsp from 'node:fs/promises'; import { getContentDisposition } from './helper'; -import { settings } from '../../../../../app/settings/server'; +import { settings } from '../../../../settings'; import { UploadFS } from '../../../../ufs'; import { FileUploadClass, FileUpload } from '../lib/FileUpload'; import { getFileRange, setRangeHeaders } from '../lib/ranges'; diff --git a/apps/meteor/server/lib/media/file-upload/config/GoogleStorage.ts b/apps/meteor/server/lib/media/file-upload/config/GoogleStorage.ts index 4a1286acc3974..3095190c7ac23 100644 --- a/apps/meteor/server/lib/media/file-upload/config/GoogleStorage.ts +++ b/apps/meteor/server/lib/media/file-upload/config/GoogleStorage.ts @@ -4,7 +4,7 @@ import https from 'node:https'; import _ from 'underscore'; import { forceDownload } from './helper'; -import { settings } from '../../../../../app/settings/server'; +import { settings } from '../../../../settings'; import { FileUploadClass, FileUpload } from '../lib/FileUpload'; import '../ufs/GoogleStorage/server'; diff --git a/apps/meteor/server/lib/media/file-upload/config/Webdav.ts b/apps/meteor/server/lib/media/file-upload/config/Webdav.ts index 2d17e9322d8ef..8f3af1f9a35d4 100644 --- a/apps/meteor/server/lib/media/file-upload/config/Webdav.ts +++ b/apps/meteor/server/lib/media/file-upload/config/Webdav.ts @@ -1,6 +1,6 @@ import _ from 'underscore'; -import { settings } from '../../../../../app/settings/server'; +import { settings } from '../../../../settings'; import { SystemLogger } from '../../../logger/system'; import { FileUploadClass, FileUpload } from '../lib/FileUpload'; import '../ufs/Webdav/server'; diff --git a/apps/meteor/server/lib/media/file-upload/config/_configUploadStorage.ts b/apps/meteor/server/lib/media/file-upload/config/_configUploadStorage.ts index cd15603bbee97..fcaec0b35962c 100644 --- a/apps/meteor/server/lib/media/file-upload/config/_configUploadStorage.ts +++ b/apps/meteor/server/lib/media/file-upload/config/_configUploadStorage.ts @@ -1,6 +1,6 @@ import _ from 'underscore'; -import { settings } from '../../../../../app/settings/server'; +import { settings } from '../../../../settings'; import { UploadFS } from '../../../../ufs'; import { SystemLogger } from '../../../logger/system'; import './AmazonS3'; diff --git a/apps/meteor/server/lib/media/file-upload/index.ts b/apps/meteor/server/lib/media/file-upload/index.ts index 8b9db00b8dc79..d7213314077ea 100644 --- a/apps/meteor/server/lib/media/file-upload/index.ts +++ b/apps/meteor/server/lib/media/file-upload/index.ts @@ -1,4 +1,4 @@ -import '../../../../app/file-upload/lib/FileUploadBase'; +import './lib/FileUploadBase'; import { FileUpload } from './lib/FileUpload'; import './lib/requests'; import './config/_configUploadStorage'; diff --git a/apps/meteor/server/lib/media/file-upload/lib/FileUpload.spec.ts b/apps/meteor/server/lib/media/file-upload/lib/FileUpload.spec.ts index 2320e1c982be7..0f8b599c6f199 100644 --- a/apps/meteor/server/lib/media/file-upload/lib/FileUpload.spec.ts +++ b/apps/meteor/server/lib/media/file-upload/lib/FileUpload.spec.ts @@ -42,13 +42,13 @@ const { FileUpload, FileUploadClass } = proxyquire.noCallThru().load('./FileUplo '../../../rooms/roomCoordinator': { roomCoordinator: roomCoordinatorStub }, '../../../../ufs': sinon.stub(), '../../../../ufs/ufs-methods': sinon.stub(), - '../../../../../app/settings/server': { settings: settingsStub }, + '../../../../settings': { settings: settingsStub }, '../../../../../app/utils/lib/mimeTypes': sinon.stub(), - '../../../../../app/utils/server/lib/JWTHelper': { + '../../../utils/lib/JWTHelper': { validateAndDecodeJWT: validateAndDecodeJWTStub, generateJWT: sinon.stub(), }, - '../../../../../app/utils/server/restrictions': sinon.stub(), + '../../../utils/restrictions': sinon.stub(), '../../../../api/lib/MultipartUploadHandler': sinon.stub(), '@rocket.chat/account-utils': { hashLoginToken: sinon.stub().callsFake((token) => `hashed_${token}`) }, }); diff --git a/apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts b/apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts index 5910ee28433a0..52c0592b6fc87 100644 --- a/apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts +++ b/apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts @@ -25,12 +25,10 @@ import sharp from 'sharp'; import type { WritableStreamBuffer } from 'stream-buffers'; import streamBuffers from 'stream-buffers'; -import { settings } from '../../../../../app/settings/server'; import { mime } from '../../../../../app/utils/lib/mimeTypes'; -import { validateAndDecodeJWT, generateJWT } from '../../../../../app/utils/server/lib/JWTHelper'; -import { fileUploadIsValidContentType } from '../../../../../app/utils/server/restrictions'; import { isRenderableImageType } from '../../../../../lib/renderableImageTypes'; import { MultipartUploadHandler } from '../../../../api/lib/MultipartUploadHandler'; +import { settings } from '../../../../settings'; import { UploadFS } from '../../../../ufs'; import { ufsComplete } from '../../../../ufs/ufs-methods'; import type { Store, StoreOptions } from '../../../../ufs/ufs-store'; @@ -38,6 +36,8 @@ import { canAccessRoomAsync, canAccessRoomIdAsync } from '../../../authorization import { i18n } from '../../../i18n'; import { SystemLogger } from '../../../logger/system'; import { roomCoordinator } from '../../../rooms/roomCoordinator'; +import { validateAndDecodeJWT, generateJWT } from '../../../utils/lib/JWTHelper'; +import { fileUploadIsValidContentType } from '../../../utils/restrictions'; const cookie = new Cookies(); let maxFileSize = 0; diff --git a/apps/meteor/app/file-upload/lib/FileUploadBase.ts b/apps/meteor/server/lib/media/file-upload/lib/FileUploadBase.ts similarity index 81% rename from apps/meteor/app/file-upload/lib/FileUploadBase.ts rename to apps/meteor/server/lib/media/file-upload/lib/FileUploadBase.ts index a9dc82ef46e57..976c85f0f1aa0 100644 --- a/apps/meteor/app/file-upload/lib/FileUploadBase.ts +++ b/apps/meteor/server/lib/media/file-upload/lib/FileUploadBase.ts @@ -1,6 +1,6 @@ import path from 'node:path'; -import { UploadFS } from '../../../server/ufs'; +import { UploadFS } from '../../../../ufs'; // set ufs temp dir to $TMPDIR/ufs instead of /tmp/ufs if the variable is set if ('TMPDIR' in process.env) { diff --git a/apps/meteor/server/lib/messages/attachMessage.ts b/apps/meteor/server/lib/messages/attachMessage.ts index 86e94d28e6587..a48fa85e87e05 100644 --- a/apps/meteor/server/lib/messages/attachMessage.ts +++ b/apps/meteor/server/lib/messages/attachMessage.ts @@ -1,9 +1,9 @@ import { getUserDisplayName } from '@rocket.chat/core-typings'; import type { IMessage, IRoom, MessageAttachment } from '@rocket.chat/core-typings'; -import { settings } from '../../../app/settings/server/cached'; -import { getUserAvatarURL } from '../../../app/utils/server/getUserAvatarURL'; +import { settings } from '../../settings/cached'; import { roomCoordinator } from '../rooms/roomCoordinator'; +import { getUserAvatarURL } from '../utils/getUserAvatarURL'; export const attachMessage = function ( message: IMessage, diff --git a/apps/meteor/server/lib/messages/deleteMessage.ts b/apps/meteor/server/lib/messages/deleteMessage.ts index a05b70ecf252a..3331a32eced1d 100644 --- a/apps/meteor/server/lib/messages/deleteMessage.ts +++ b/apps/meteor/server/lib/messages/deleteMessage.ts @@ -4,15 +4,11 @@ import { isThreadMessage, type AtLeast, type IMessage, type IRoom, type IThreadM import { Messages, Rooms, Uploads, Users, ReadReceipts, ReadReceiptsArchive, Subscriptions } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { - notifyOnRoomChangedById, - notifyOnMessageChange, - notifyOnSubscriptionChangedByRoomIdAndUserIds, -} from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; import { canDeleteMessageAsync } from '../authorization/canDeleteMessage'; import { callbacks } from '../callbacks'; import { FileUpload } from '../media/file-upload'; +import { notifyOnRoomChangedById, notifyOnMessageChange, notifyOnSubscriptionChangedByRoomIdAndUserIds } from '../notifyListener'; export const deleteMessageValidatingPermission = async (message: AtLeast, userId: IUser['_id']): Promise => { if (!message?._id) { diff --git a/apps/meteor/server/lib/messages/isTheLastMessage.ts b/apps/meteor/server/lib/messages/isTheLastMessage.ts index eba5736c68f59..93d8aa587f9ee 100644 --- a/apps/meteor/server/lib/messages/isTheLastMessage.ts +++ b/apps/meteor/server/lib/messages/isTheLastMessage.ts @@ -1,6 +1,6 @@ import type { IMessage, IRoom, AtLeast } from '@rocket.chat/core-typings'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; // eslint-disable-next-line @typescript-eslint/explicit-function-return-type export const isTheLastMessage = (room: AtLeast, message: Pick) => diff --git a/apps/meteor/server/lib/messages/loadMessageHistory.ts b/apps/meteor/server/lib/messages/loadMessageHistory.ts index e96d2d20e77a3..a93b1dbaebf16 100644 --- a/apps/meteor/server/lib/messages/loadMessageHistory.ts +++ b/apps/meteor/server/lib/messages/loadMessageHistory.ts @@ -2,9 +2,9 @@ import type { IMessage, IRoom, MessageTypesValues } from '@rocket.chat/core-typi import { Messages, Rooms } from '@rocket.chat/models'; import type { FindOptions } from 'mongodb'; -import { getHiddenSystemMessages } from '../../../app/lib/server/lib/getHiddenSystemMessages'; -import { settings } from '../../../app/settings/server/cached'; -import { normalizeMessagesForUser } from '../../../app/utils/server/lib/normalizeMessagesForUser'; +import { settings } from '../../settings/cached'; +import { getHiddenSystemMessages } from '../messaging/getHiddenSystemMessages'; +import { normalizeMessagesForUser } from '../utils/lib/normalizeMessagesForUser'; export async function loadMessageHistory({ userId, diff --git a/apps/meteor/server/lib/messages/parseUrlsInMessage.ts b/apps/meteor/server/lib/messages/parseUrlsInMessage.ts index d5439ba113dad..631c3652f9ec0 100644 --- a/apps/meteor/server/lib/messages/parseUrlsInMessage.ts +++ b/apps/meteor/server/lib/messages/parseUrlsInMessage.ts @@ -1,8 +1,8 @@ import type { IMessage, AtLeast } from '@rocket.chat/core-typings'; import { extractUrlsFromMessageAST } from './extractUrlsFromMessageAST'; -import { settings } from '../../../app/settings/server'; import { getMessageUrlRegex } from '../../../lib/getMessageUrlRegex'; +import { settings } from '../../settings'; import { Markdown } from '../messaging/markdown'; const prepareUrl = (url: string, previewUrls: string[] | undefined) => ({ diff --git a/apps/meteor/server/lib/messages/processWebhookMessage.ts b/apps/meteor/server/lib/messages/processWebhookMessage.ts index 19d1f1596068f..38452d8205bf3 100644 --- a/apps/meteor/server/lib/messages/processWebhookMessage.ts +++ b/apps/meteor/server/lib/messages/processWebhookMessage.ts @@ -4,9 +4,9 @@ import { Meteor } from 'meteor/meteor'; import _ from 'underscore'; import { sendMessage, validateMessage } from './sendMessage'; -import { settings } from '../../../app/settings/server'; import { ensureArray } from '../../../lib/utils/arrayUtils'; import { trim } from '../../../lib/utils/stringUtils'; +import { settings } from '../../settings'; import { validateRoomMessagePermissionsAsync } from '../authorization/canSendMessage'; import { SystemLogger } from '../logger/system'; import { getRoomByNameOrIdWithOptionToJoin } from '../rooms/getRoomByNameOrIdWithOptionToJoin'; diff --git a/apps/meteor/server/lib/messages/sendMessage.ts b/apps/meteor/server/lib/messages/sendMessage.ts index 7866d17785b2c..082c3769a666a 100644 --- a/apps/meteor/server/lib/messages/sendMessage.ts +++ b/apps/meteor/server/lib/messages/sendMessage.ts @@ -5,13 +5,13 @@ import { Messages } from '@rocket.chat/models'; import { isAbsoluteURL } from '@rocket.chat/tools'; import { Match, check } from 'meteor/check'; -import { notifyOnRoomChangedById } from '../../../app/lib/server/lib/notifyListener'; -import { validateCustomMessageFields } from '../../../app/lib/server/lib/validateCustomMessageFields'; -import { settings } from '../../../app/settings/server'; import { isRelativeURL } from '../../../lib/utils/isRelativeURL'; import { afterSaveMessage } from '../../hooks/messages/afterSaveMessage'; +import { settings } from '../../settings'; import { hasPermissionAsync } from '../authorization/hasPermission'; import { FileUpload } from '../media/file-upload'; +import { validateCustomMessageFields } from '../messaging/validateCustomMessageFields'; +import { notifyOnRoomChangedById } from '../notifyListener'; export type SendMessageOptions = { upsert?: boolean; diff --git a/apps/meteor/server/lib/messages/updateMessage.ts b/apps/meteor/server/lib/messages/updateMessage.ts index 3670ad8677bc9..3b5410d9779e5 100644 --- a/apps/meteor/server/lib/messages/updateMessage.ts +++ b/apps/meteor/server/lib/messages/updateMessage.ts @@ -4,10 +4,10 @@ import type { IMessage, IUser, AtLeast } from '@rocket.chat/core-typings'; import { Messages, Rooms } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { notifyOnRoomChangedById } from '../../../app/lib/server/lib/notifyListener'; -import { validateCustomMessageFields } from '../../../app/lib/server/lib/validateCustomMessageFields'; -import { settings } from '../../../app/settings/server'; import { afterSaveMessage } from '../../hooks/messages/afterSaveMessage'; +import { settings } from '../../settings'; +import { validateCustomMessageFields } from '../messaging/validateCustomMessageFields'; +import { notifyOnRoomChangedById } from '../notifyListener'; export const updateMessage = async function ( { diff --git a/apps/meteor/app/ui-utils/server/Message.ts b/apps/meteor/server/lib/messaging/Message.ts similarity index 89% rename from apps/meteor/app/ui-utils/server/Message.ts rename to apps/meteor/server/lib/messaging/Message.ts index 6aae8df9b6bf3..a784088b3d884 100644 --- a/apps/meteor/app/ui-utils/server/Message.ts +++ b/apps/meteor/server/lib/messaging/Message.ts @@ -4,8 +4,8 @@ import { escapeHTML } from '@rocket.chat/string-helpers'; import { Accounts } from 'meteor/accounts-base'; import { trim } from '../../../lib/utils/stringUtils'; -import { i18n } from '../../../server/lib/i18n'; -import { settings } from '../../settings/server'; +import { settings } from '../../settings'; +import { i18n } from '../i18n'; export const Message = { parse(msg: IMessage, language: string) { diff --git a/apps/meteor/app/lib/server/lib/getHiddenSystemMessages.ts b/apps/meteor/server/lib/messaging/getHiddenSystemMessages.ts similarity index 100% rename from apps/meteor/app/lib/server/lib/getHiddenSystemMessages.ts rename to apps/meteor/server/lib/messaging/getHiddenSystemMessages.ts diff --git a/apps/meteor/server/lib/messaging/mentions/getMentionedTeamMembers.ts b/apps/meteor/server/lib/messaging/mentions/getMentionedTeamMembers.ts index 67c1d09e2106e..75645b127f527 100644 --- a/apps/meteor/server/lib/messaging/mentions/getMentionedTeamMembers.ts +++ b/apps/meteor/server/lib/messaging/mentions/getMentionedTeamMembers.ts @@ -1,7 +1,7 @@ import { Team } from '@rocket.chat/core-services'; import type { MessageMention } from '@rocket.chat/core-typings'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; import { callbacks } from '../../callbacks'; const beforeGetMentions = async (mentionIds: string[], teamMentions: MessageMention[]): Promise => { diff --git a/apps/meteor/server/lib/messaging/msgStream.ts b/apps/meteor/server/lib/messaging/msgStream.ts new file mode 100644 index 0000000000000..4e6a2a829d8c9 --- /dev/null +++ b/apps/meteor/server/lib/messaging/msgStream.ts @@ -0,0 +1,3 @@ +import notifications from '../notifications/core/lib/Notifications'; + +export const msgStream = notifications.streamRoomMessage; diff --git a/apps/meteor/server/lib/messaging/pins/pinMessage.ts b/apps/meteor/server/lib/messaging/pins/pinMessage.ts index cb2872a813aca..93d3f926f161d 100644 --- a/apps/meteor/server/lib/messaging/pins/pinMessage.ts +++ b/apps/meteor/server/lib/messaging/pins/pinMessage.ts @@ -8,13 +8,13 @@ import { isTruthy } from '@rocket.chat/tools'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { canAccessRoomAsync, roomAccessAttributes } from '../../../../app/authorization/server'; -import { methodDeprecationLogger } from '../../../../app/lib/server/lib/deprecationWarningLogger'; -import { notifyOnRoomChangedById, notifyOnMessageChange } from '../../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../../app/settings/server'; -import { getUserAvatarURL } from '../../../../app/utils/server/getUserAvatarURL'; +import { settings } from '../../../settings'; +import { canAccessRoomAsync, roomAccessAttributes } from '../../authorization'; import { hasPermissionAsync } from '../../authorization/hasPermission'; +import { methodDeprecationLogger } from '../../deprecationWarningLogger'; import { isTheLastMessage } from '../../messages/isTheLastMessage'; +import { notifyOnRoomChangedById, notifyOnMessageChange } from '../../notifyListener'; +import { getUserAvatarURL } from '../../utils/getUserAvatarURL'; const recursiveRemove = (msg: MessageAttachment, deep = 1) => { if (!msg || !isQuoteAttachment(msg)) { diff --git a/apps/meteor/server/lib/messaging/reactions/setReaction.ts b/apps/meteor/server/lib/messaging/reactions/setReaction.ts index 98077253866b6..da67905e72870 100644 --- a/apps/meteor/server/lib/messaging/reactions/setReaction.ts +++ b/apps/meteor/server/lib/messaging/reactions/setReaction.ts @@ -4,12 +4,12 @@ import type { IMessage, IRoom, IUser } from '@rocket.chat/core-typings'; import { Messages, EmojiCustom, Rooms, Users } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { canAccessRoomAsync } from '../../../../app/authorization/server'; -import { notifyOnMessageChange } from '../../../../app/lib/server/lib/notifyListener'; +import { canAccessRoomAsync } from '../../authorization'; import { hasPermissionAsync } from '../../authorization/hasPermission'; import { callbacks } from '../../callbacks'; import { i18n } from '../../i18n'; import { isTheLastMessage } from '../../messages/isTheLastMessage'; +import { notifyOnMessageChange } from '../../notifyListener'; import { emoji } from '../emoji'; export const removeUserReaction = (message: IMessage, reaction: string, username: string) => { diff --git a/apps/meteor/server/lib/messaging/stars/starMessage.ts b/apps/meteor/server/lib/messaging/stars/starMessage.ts index 44cbc2c1a24ea..5c5b1c9afc4f8 100644 --- a/apps/meteor/server/lib/messaging/stars/starMessage.ts +++ b/apps/meteor/server/lib/messaging/stars/starMessage.ts @@ -4,11 +4,11 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Messages, Subscriptions, Rooms } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { canAccessRoomAsync, roomAccessAttributes } from '../../../../app/authorization/server'; -import { methodDeprecationLogger } from '../../../../app/lib/server/lib/deprecationWarningLogger'; -import { notifyOnRoomChangedById, notifyOnMessageChange } from '../../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; +import { canAccessRoomAsync, roomAccessAttributes } from '../../authorization'; +import { methodDeprecationLogger } from '../../deprecationWarningLogger'; import { isTheLastMessage } from '../../messages/isTheLastMessage'; +import { notifyOnRoomChangedById, notifyOnMessageChange } from '../../notifyListener'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/app/threads/README.md b/apps/meteor/server/lib/messaging/threads/README.md similarity index 100% rename from apps/meteor/app/threads/README.md rename to apps/meteor/server/lib/messaging/threads/README.md diff --git a/apps/meteor/server/lib/messaging/threads/functions.ts b/apps/meteor/server/lib/messaging/threads/functions.ts index cb12a359ef4c5..5a1b89248546d 100644 --- a/apps/meteor/server/lib/messaging/threads/functions.ts +++ b/apps/meteor/server/lib/messaging/threads/functions.ts @@ -2,12 +2,9 @@ import type { IMessage, IRoom, IUser } from '@rocket.chat/core-typings'; import { isEditedMessage } from '@rocket.chat/core-typings'; import { Messages, Subscriptions, NotificationQueue } from '@rocket.chat/models'; -import { - notifyOnSubscriptionChangedByRoomIdAndUserIds, - notifyOnSubscriptionChangedByRoomIdAndUserId, -} from '../../../../app/lib/server/lib/notifyListener'; import { getMentions, getUserIdsFromHighlights } from '../../../hooks/messages/notifyUsersOnMessage'; import { callbacks } from '../../callbacks'; +import { notifyOnSubscriptionChangedByRoomIdAndUserIds, notifyOnSubscriptionChangedByRoomIdAndUserId } from '../../notifyListener'; export async function reply({ tmid }: { tmid?: string }, message: IMessage, parentMessage: IMessage, followers: string[]) { if (!tmid || isEditedMessage(message)) { diff --git a/apps/meteor/server/lib/messaging/unread/unreadMessages.ts b/apps/meteor/server/lib/messaging/unread/unreadMessages.ts index 018c199712cac..b118ea7184109 100644 --- a/apps/meteor/server/lib/messaging/unread/unreadMessages.ts +++ b/apps/meteor/server/lib/messaging/unread/unreadMessages.ts @@ -4,8 +4,8 @@ import { Messages, Subscriptions } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; import logger from './logger'; -import { methodDeprecationLogger } from '../../../../app/lib/server/lib/deprecationWarningLogger'; -import { notifyOnSubscriptionChangedByRoomIdAndUserId } from '../../../../app/lib/server/lib/notifyListener'; +import { methodDeprecationLogger } from '../../deprecationWarningLogger'; +import { notifyOnSubscriptionChangedByRoomIdAndUserId } from '../../notifyListener'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/app/lib/server/lib/validateCustomMessageFields.ts b/apps/meteor/server/lib/messaging/validateCustomMessageFields.ts similarity index 100% rename from apps/meteor/app/lib/server/lib/validateCustomMessageFields.ts rename to apps/meteor/server/lib/messaging/validateCustomMessageFields.ts diff --git a/apps/meteor/server/lib/metrics/lib/collectMetrics.ts b/apps/meteor/server/lib/metrics/lib/collectMetrics.ts index 6ff79232ddbca..37967a41b8194 100644 --- a/apps/meteor/server/lib/metrics/lib/collectMetrics.ts +++ b/apps/meteor/server/lib/metrics/lib/collectMetrics.ts @@ -10,8 +10,8 @@ import gcStats from 'prometheus-gc-stats'; import _ from 'underscore'; import { metrics } from './metrics'; -import { settings } from '../../../../app/settings/server'; import { Info } from '../../../../app/utils/rocketchat.info'; +import { settings } from '../../../settings'; import { SystemLogger } from '../../logger/system'; import { getControl } from '../../migrations'; import { getAppsStatistics } from '../../statistics/lib/getAppsStatistics'; diff --git a/apps/meteor/server/lib/moderation/deleteReportedMessages.ts b/apps/meteor/server/lib/moderation/deleteReportedMessages.ts index e1ee56dd17788..af6226045e789 100644 --- a/apps/meteor/server/lib/moderation/deleteReportedMessages.ts +++ b/apps/meteor/server/lib/moderation/deleteReportedMessages.ts @@ -2,7 +2,7 @@ import { api } from '@rocket.chat/core-services'; import type { IUser, IMessage } from '@rocket.chat/core-typings'; import { Messages, Uploads, ReadReceipts, ReadReceiptsArchive } from '@rocket.chat/models'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; import { FileUpload } from '../media/file-upload'; // heavily inspired from message delete taking place in the user deletion process diff --git a/apps/meteor/server/lib/notifications/email/api.ts b/apps/meteor/server/lib/notifications/email/api.ts index ec26566a51b9f..c9fadc968b0b7 100644 --- a/apps/meteor/server/lib/notifications/email/api.ts +++ b/apps/meteor/server/lib/notifications/email/api.ts @@ -10,10 +10,10 @@ import { stripHtml } from 'string-strip-html'; import _ from 'underscore'; import { replaceVariables } from './replaceVariables'; -import { notifyOnSettingChanged } from '../../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../../app/settings/server'; import { strLeft, strRightBack } from '../../../../lib/utils/stringUtils'; +import { settings } from '../../../settings'; import { i18n } from '../../i18n'; +import { notifyOnSettingChanged } from '../../notifyListener'; let contentHeader: string | undefined; let contentFooter: string | undefined; diff --git a/apps/meteor/app/lib/server/lib/interceptDirectReplyEmails.js b/apps/meteor/server/lib/notifications/interceptDirectReplyEmails.js similarity index 96% rename from apps/meteor/app/lib/server/lib/interceptDirectReplyEmails.js rename to apps/meteor/server/lib/notifications/interceptDirectReplyEmails.js index 77aaa03887c54..2100ea178ad1a 100644 --- a/apps/meteor/app/lib/server/lib/interceptDirectReplyEmails.js +++ b/apps/meteor/server/lib/notifications/interceptDirectReplyEmails.js @@ -2,8 +2,8 @@ import POP3Lib from '@rocket.chat/poplib'; import { simpleParser } from 'mailparser'; import { processDirectEmail } from './processDirectEmail'; -import { IMAPInterceptor } from '../../../../server/email/IMAPInterceptor'; -import { settings } from '../../../settings/server'; +import { IMAPInterceptor } from '../../email/IMAPInterceptor'; +import { settings } from '../../settings'; export class DirectReplyIMAPInterceptor extends IMAPInterceptor { constructor(imapConfig, options = {}) { diff --git a/apps/meteor/server/lib/notifications/mail-messages/functions/sendMail.ts b/apps/meteor/server/lib/notifications/mail-messages/functions/sendMail.ts index 4fa229aa5616d..ce01e570b4501 100644 --- a/apps/meteor/server/lib/notifications/mail-messages/functions/sendMail.ts +++ b/apps/meteor/server/lib/notifications/mail-messages/functions/sendMail.ts @@ -5,9 +5,9 @@ import EJSON from 'ejson'; import { Meteor } from 'meteor/meteor'; import type { Filter } from 'mongodb'; -import { placeholders } from '../../../../../app/utils/server/placeholders'; import { generatePath } from '../../../../../lib/utils/generatePath'; import { SystemLogger } from '../../../logger/system'; +import { placeholders } from '../../../utils/placeholders'; import * as Mailer from '../../email/api'; export const sendMail = async function ({ diff --git a/apps/meteor/app/lib/server/functions/notifications/desktop.ts b/apps/meteor/server/lib/notifications/message/desktop.ts similarity index 93% rename from apps/meteor/app/lib/server/functions/notifications/desktop.ts rename to apps/meteor/server/lib/notifications/message/desktop.ts index f215981bfe10e..d55cefecfe0b9 100644 --- a/apps/meteor/app/lib/server/functions/notifications/desktop.ts +++ b/apps/meteor/server/lib/notifications/message/desktop.ts @@ -1,9 +1,9 @@ import { api } from '@rocket.chat/core-services'; import type { IMessage, IRoom, IUser, AtLeast } from '@rocket.chat/core-typings'; -import { metrics } from '../../../../../server/lib/metrics'; -import { roomCoordinator } from '../../../../../server/lib/rooms/roomCoordinator'; -import { settings } from '../../../../settings/server'; +import { settings } from '../../../settings'; +import { metrics } from '../../metrics'; +import { roomCoordinator } from '../../rooms/roomCoordinator'; /** * Send notification to user diff --git a/apps/meteor/app/lib/server/functions/notifications/email.js b/apps/meteor/server/lib/notifications/message/email.js similarity index 93% rename from apps/meteor/app/lib/server/functions/notifications/email.js rename to apps/meteor/server/lib/notifications/message/email.js index 5a5a72b2a4659..afa2937baa08a 100644 --- a/apps/meteor/app/lib/server/functions/notifications/email.js +++ b/apps/meteor/server/lib/notifications/message/email.js @@ -1,14 +1,14 @@ import { escapeHTML } from '@rocket.chat/string-helpers'; import { Meteor } from 'meteor/meteor'; -import { ltrim } from '../../../../../lib/utils/stringUtils'; -import { callbacks } from '../../../../../server/lib/callbacks'; -import { i18n } from '../../../../../server/lib/i18n'; -import { metrics } from '../../../../../server/lib/metrics'; -import * as Mailer from '../../../../../server/lib/notifications/email/api'; -import { roomCoordinator } from '../../../../../server/lib/rooms/roomCoordinator'; -import { settings } from '../../../../settings/server'; -import { getURL } from '../../../../utils/server/getURL'; +import { ltrim } from '../../../../lib/utils/stringUtils'; +import { settings } from '../../../settings'; +import { callbacks } from '../../callbacks'; +import { i18n } from '../../i18n'; +import { metrics } from '../../metrics'; +import { roomCoordinator } from '../../rooms/roomCoordinator'; +import { getURL } from '../../utils/getURL'; +import * as Mailer from '../email/api'; let advice = ''; let goToMessage = ''; diff --git a/apps/meteor/app/lib/server/functions/notifications/index.ts b/apps/meteor/server/lib/notifications/message/index.ts similarity index 90% rename from apps/meteor/app/lib/server/functions/notifications/index.ts rename to apps/meteor/server/lib/notifications/message/index.ts index 47a38ac0f068c..23aaaf3b1109a 100644 --- a/apps/meteor/app/lib/server/functions/notifications/index.ts +++ b/apps/meteor/server/lib/notifications/message/index.ts @@ -2,9 +2,9 @@ import type { IMessage, IUser } from '@rocket.chat/core-typings'; import { isFileAttachment, isFileImageAttachment } from '@rocket.chat/core-typings'; import { escapeRegExp } from '@rocket.chat/string-helpers'; -import { callbacks } from '../../../../../server/lib/callbacks'; -import { i18n } from '../../../../../server/lib/i18n'; -import { settings } from '../../../../settings/server'; +import { settings } from '../../../settings'; +import { callbacks } from '../../callbacks'; +import { i18n } from '../../i18n'; /** * This function returns a string ready to be shown in the notification diff --git a/apps/meteor/app/lib/server/functions/notifications/messageContainsHighlight.ts b/apps/meteor/server/lib/notifications/message/messageContainsHighlight.ts similarity index 100% rename from apps/meteor/app/lib/server/functions/notifications/messageContainsHighlight.ts rename to apps/meteor/server/lib/notifications/message/messageContainsHighlight.ts diff --git a/apps/meteor/app/lib/server/functions/notifications/mobile.js b/apps/meteor/server/lib/notifications/message/mobile.js similarity index 91% rename from apps/meteor/app/lib/server/functions/notifications/mobile.js rename to apps/meteor/server/lib/notifications/message/mobile.js index 1ce3167966082..c96d69e088815 100644 --- a/apps/meteor/app/lib/server/functions/notifications/mobile.js +++ b/apps/meteor/server/lib/notifications/message/mobile.js @@ -1,9 +1,9 @@ import { Subscriptions } from '@rocket.chat/models'; -import { i18n } from '../../../../../server/lib/i18n'; -import { isRoomCompatibleWithVideoConfRinging } from '../../../../../server/lib/isRoomCompatibleWithVideoConfRinging'; -import { roomCoordinator } from '../../../../../server/lib/rooms/roomCoordinator'; -import { settings } from '../../../../settings/server'; +import { settings } from '../../../settings'; +import { i18n } from '../../i18n'; +import { isRoomCompatibleWithVideoConfRinging } from '../../isRoomCompatibleWithVideoConfRinging'; +import { roomCoordinator } from '../../rooms/roomCoordinator'; const CATEGORY_MESSAGE = 'MESSAGE'; const CATEGORY_MESSAGE_NOREPLY = 'MESSAGE_NOREPLY'; diff --git a/apps/meteor/app/lib/server/lib/processDirectEmail.ts b/apps/meteor/server/lib/notifications/processDirectEmail.ts similarity index 90% rename from apps/meteor/app/lib/server/lib/processDirectEmail.ts rename to apps/meteor/server/lib/notifications/processDirectEmail.ts index 507939e2d1e4e..7ad8848090834 100644 --- a/apps/meteor/app/lib/server/lib/processDirectEmail.ts +++ b/apps/meteor/server/lib/notifications/processDirectEmail.ts @@ -3,11 +3,11 @@ import { Messages, Subscriptions, Users, Rooms } from '@rocket.chat/models'; import type { ParsedMail } from 'mailparser'; import moment from 'moment'; -import { hasPermissionAsync } from '../../../../server/lib/authorization/hasPermission'; -import { sendMessage } from '../../../../server/lib/messages/sendMessage'; -import { metrics } from '../../../../server/lib/metrics'; -import { canAccessRoomAsync } from '../../../authorization/server'; -import { settings } from '../../../settings/server'; +import { settings } from '../../settings'; +import { canAccessRoomAsync } from '../authorization'; +import { hasPermissionAsync } from '../authorization/hasPermission'; +import { sendMessage } from '../messages/sendMessage'; +import { metrics } from '../metrics'; const isParsedEmail = (email: ParsedMail): email is Required => 'date' in email && 'html' in email; diff --git a/apps/meteor/server/lib/notifications/push-config/lib/PushNotification.ts b/apps/meteor/server/lib/notifications/push-config/lib/PushNotification.ts index f6ef4c10d2c40..0b138f00c6f46 100644 --- a/apps/meteor/server/lib/notifications/push-config/lib/PushNotification.ts +++ b/apps/meteor/server/lib/notifications/push-config/lib/PushNotification.ts @@ -2,12 +2,12 @@ import type { IMessage, IPushNotificationConfig, IRoom, IUser } from '@rocket.ch import { Users } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { replaceMentionedUsernamesWithFullNames, parseMessageTextPerUser } from '../../../../../app/lib/server/functions/notifications'; -import { getPushData } from '../../../../../app/lib/server/functions/notifications/mobile'; -import { settings } from '../../../../../app/settings/server'; +import { settings } from '../../../../settings'; import { callbacks } from '../../../callbacks'; import { RocketChatAssets } from '../../../media/assets'; import { metrics } from '../../../metrics'; +import { replaceMentionedUsernamesWithFullNames, parseMessageTextPerUser } from '../../message'; +import { getPushData } from '../../message/mobile'; import { Push } from '../../push'; type PushNotificationData = { diff --git a/apps/meteor/server/lib/notifications/push/push.ts b/apps/meteor/server/lib/notifications/push/push.ts index 856edc308c523..bd325d9df1d27 100644 --- a/apps/meteor/server/lib/notifications/push/push.ts +++ b/apps/meteor/server/lib/notifications/push/push.ts @@ -12,7 +12,7 @@ import { initAPN, sendAPN, shutdownAPN } from './apn'; import type { PushOptions, PendingPushNotification } from './definition'; import { sendFCM } from './fcm'; import { logger } from './logger'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; export const _matchToken = Match.OneOf({ apn: String }, { gcm: String }); diff --git a/apps/meteor/server/lib/notifications/queue/NotificationQueue.ts b/apps/meteor/server/lib/notifications/queue/NotificationQueue.ts index 7e52afd61a3b8..692ef905509c9 100644 --- a/apps/meteor/server/lib/notifications/queue/NotificationQueue.ts +++ b/apps/meteor/server/lib/notifications/queue/NotificationQueue.ts @@ -3,8 +3,8 @@ import { NotificationQueue, Users } from '@rocket.chat/models'; import { tracerSpan } from '@rocket.chat/tracing'; import { Meteor } from 'meteor/meteor'; -import { sendEmailFromData } from '../../../../app/lib/server/functions/notifications/email'; import { SystemLogger } from '../../logger/system'; +import { sendEmailFromData } from '../message/email'; import { PushNotification } from '../push-config'; const { diff --git a/apps/meteor/app/lib/server/lib/notifyListener.ts b/apps/meteor/server/lib/notifyListener.ts similarity index 99% rename from apps/meteor/app/lib/server/lib/notifyListener.ts rename to apps/meteor/server/lib/notifyListener.ts index 210510b001dc6..3a10d7ea000fa 100644 --- a/apps/meteor/app/lib/server/lib/notifyListener.ts +++ b/apps/meteor/server/lib/notifyListener.ts @@ -39,8 +39,8 @@ import { } from '@rocket.chat/models'; import mem from 'mem'; -import { subscriptionFields } from '../../../../lib/publishFields'; -import { shouldHideSystemMessage } from '../../../../server/lib/systemMessage/hideSystemMessage'; +import { shouldHideSystemMessage } from './systemMessage/hideSystemMessage'; +import { subscriptionFields } from '../../lib/publishFields'; type ClientAction = 'inserted' | 'updated' | 'removed'; diff --git a/apps/meteor/server/lib/oauth/addOAuthService.ts b/apps/meteor/server/lib/oauth/addOAuthService.ts index db84cb467ffca..9af5475aa5c7d 100644 --- a/apps/meteor/server/lib/oauth/addOAuthService.ts +++ b/apps/meteor/server/lib/oauth/addOAuthService.ts @@ -2,7 +2,7 @@ /* eslint comma-spacing: 0 */ import { capitalize } from '@rocket.chat/string-helpers'; -import { settingsRegistry } from '../../../app/settings/server'; +import { settingsRegistry } from '../../settings'; export async function addOAuthService(name: string, values: { [k: string]: string | boolean | undefined } = {}): Promise { name = name.toLowerCase().replace(/[^a-z0-9_]/g, ''); diff --git a/apps/meteor/server/lib/oauth/addPassportCustomOAuth.ts b/apps/meteor/server/lib/oauth/addPassportCustomOAuth.ts index 3f4d615bdd17c..14c849fcf9e0d 100644 --- a/apps/meteor/server/lib/oauth/addPassportCustomOAuth.ts +++ b/apps/meteor/server/lib/oauth/addPassportCustomOAuth.ts @@ -5,8 +5,8 @@ import type { DoneCallback, Profile } from 'passport'; import { allowPassportOAuthMiddleware } from './allowPassportOAuthMiddleware'; import { passportOAuthCallback } from './passportOAuthCallback'; import { verifyFunction } from './verifyFunction'; -import { settings } from '../../../app/settings/server'; import { oAuthRouter } from '../../configuration/configurePassport'; +import { settings } from '../../settings'; import { CustomOAuthStrategy } from '../auth-providers/custom-oauth/customOAuth'; export const addPassportCustomOAuth = ( diff --git a/apps/meteor/server/lib/oauth/allowPassportOAuthMiddleware.ts b/apps/meteor/server/lib/oauth/allowPassportOAuthMiddleware.ts index daee09f87d199..dc32a790d791a 100644 --- a/apps/meteor/server/lib/oauth/allowPassportOAuthMiddleware.ts +++ b/apps/meteor/server/lib/oauth/allowPassportOAuthMiddleware.ts @@ -1,7 +1,7 @@ import { capitalize } from '@rocket.chat/string-helpers'; import type { NextFunction, Request, Response } from 'express'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; export const allowPassportOAuthMiddleware = (service: string, isCustomOAuth: boolean = false) => diff --git a/apps/meteor/server/lib/oauth/configureOAuthServices.ts b/apps/meteor/server/lib/oauth/configureOAuthServices.ts index 06e45ecfa183e..33e5ace32dbdd 100644 --- a/apps/meteor/server/lib/oauth/configureOAuthServices.ts +++ b/apps/meteor/server/lib/oauth/configureOAuthServices.ts @@ -6,8 +6,8 @@ import type { Profile, DoneCallback } from 'passport'; import { allowPassportOAuthMiddleware } from './allowPassportOAuthMiddleware'; import type { OAuthServiceConfig } from './createOAuthServiceConfig'; import { passportOAuthCallback } from './passportOAuthCallback'; -import type { ICachedSettings } from '../../../app/settings/server/CachedSettings'; import { oAuthRouter } from '../../configuration/configurePassport'; +import type { ICachedSettings } from '../../settings/CachedSettings'; export const configureOAuthServices = (oauthServiceConfig: OAuthServiceConfig[], settings: ICachedSettings) => { oauthServiceConfig.forEach((config) => { diff --git a/apps/meteor/server/lib/oauth/createOAuthServiceConfig.ts b/apps/meteor/server/lib/oauth/createOAuthServiceConfig.ts index 3ea8213140b95..026303c866b8d 100644 --- a/apps/meteor/server/lib/oauth/createOAuthServiceConfig.ts +++ b/apps/meteor/server/lib/oauth/createOAuthServiceConfig.ts @@ -3,7 +3,7 @@ import { isTruthy } from '@rocket.chat/tools'; import type { Strategy } from 'passport'; import { OAuthConfigs } from './oauthConfigs'; -import { type ICachedSettings } from '../../../app/settings/server/CachedSettings'; +import { type ICachedSettings } from '../../settings/CachedSettings'; export type OAuthServiceConfig = { provider: string; diff --git a/apps/meteor/server/lib/oauth/getOAuthServices.ts b/apps/meteor/server/lib/oauth/getOAuthServices.ts index 7a431982d9f71..743d60c80c8d5 100644 --- a/apps/meteor/server/lib/oauth/getOAuthServices.ts +++ b/apps/meteor/server/lib/oauth/getOAuthServices.ts @@ -1,7 +1,7 @@ import { isTruthy } from '@rocket.chat/tools'; import { OAuthConfigs } from './oauthConfigs'; -import { type ICachedSettings } from '../../../app/settings/server/CachedSettings'; +import { type ICachedSettings } from '../../settings/CachedSettings'; export const getOAuthServices = (settings: ICachedSettings) => { const services = settings.getByRegexp(/^(Accounts_OAuth_|Accounts_OAuth_Custom-)[a-z0-9_]+$/i); diff --git a/apps/meteor/server/lib/oauth/updateOAuthServices.ts b/apps/meteor/server/lib/oauth/updateOAuthServices.ts index 7a86c348d5a5b..6947e38da2fcb 100644 --- a/apps/meteor/server/lib/oauth/updateOAuthServices.ts +++ b/apps/meteor/server/lib/oauth/updateOAuthServices.ts @@ -9,12 +9,9 @@ import { LoginServiceConfiguration } from '@rocket.chat/models'; import { addPassportCustomOAuth } from './addPassportCustomOAuth'; import { logger } from './logger'; -import { - notifyOnLoginServiceConfigurationChanged, - notifyOnLoginServiceConfigurationChangedByService, -} from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server/cached'; +import { settings } from '../../settings/cached'; import { CustomOAuth } from '../auth-providers/custom-oauth/custom_oauth_server'; +import { notifyOnLoginServiceConfigurationChanged, notifyOnLoginServiceConfigurationChangedByService } from '../notifyListener'; export async function updateOAuthServices(): Promise { const services = settings.getByRegexp(/^(Accounts_OAuth_|Accounts_OAuth_Custom-)[a-z0-9_]+$/i); diff --git a/apps/meteor/app/livechat/server/lib/AnalyticsTyped.ts b/apps/meteor/server/lib/omnichannel/AnalyticsTyped.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/AnalyticsTyped.ts rename to apps/meteor/server/lib/omnichannel/AnalyticsTyped.ts diff --git a/apps/meteor/app/livechat/lib/Assets.ts b/apps/meteor/server/lib/omnichannel/Assets.ts similarity index 100% rename from apps/meteor/app/livechat/lib/Assets.ts rename to apps/meteor/server/lib/omnichannel/Assets.ts diff --git a/apps/meteor/app/livechat/server/lib/Helper.ts b/apps/meteor/server/lib/omnichannel/Helper.ts similarity index 98% rename from apps/meteor/app/livechat/server/lib/Helper.ts rename to apps/meteor/server/lib/omnichannel/Helper.ts index 4739c429674e2..a9d04f1a43abd 100644 --- a/apps/meteor/app/livechat/server/lib/Helper.ts +++ b/apps/meteor/server/lib/omnichannel/Helper.ts @@ -44,10 +44,11 @@ import { migrateVisitorIfMissingContact } from './contacts/migrateVisitorIfMissi import { afterRoomQueued, beforeNewRoom } from './hooks'; import { checkOnlineAgents, getOnlineAgents } from './service-status'; import { saveTransferHistory } from './transfer'; -import { hasRoleAsync } from '../../../../server/lib/authorization/hasRole'; -import { callbacks } from '../../../../server/lib/callbacks'; -import { i18n } from '../../../../server/lib/i18n'; -import { sendNotification } from '../../../lib/server'; +import { sendNotification } from '../../hooks/messages/sendNotificationsOnMessage'; +import { settings } from '../../settings'; +import { hasRoleAsync } from '../authorization/hasRole'; +import { callbacks } from '../callbacks'; +import { i18n } from '../i18n'; import { notifyOnLivechatDepartmentAgentChanged, notifyOnLivechatDepartmentAgentChangedByAgentsAndDepartmentId, @@ -56,8 +57,7 @@ import { notifyOnSubscriptionChanged, notifyOnRoomChangedById, notifyOnLivechatInquiryChangedByRoom, -} from '../../../lib/server/lib/notifyListener'; -import { settings } from '../../../settings/server'; +} from '../notifyListener'; const logger = new Logger('LivechatHelper'); export const allowAgentSkipQueue = (agent: SelectedAgent) => { diff --git a/apps/meteor/app/livechat/server/lib/QueueManager.ts b/apps/meteor/server/lib/omnichannel/QueueManager.ts similarity index 97% rename from apps/meteor/app/livechat/server/lib/QueueManager.ts rename to apps/meteor/server/lib/omnichannel/QueueManager.ts index 858db7279981e..16a8790d1b642 100644 --- a/apps/meteor/app/livechat/server/lib/QueueManager.ts +++ b/apps/meteor/server/lib/omnichannel/QueueManager.ts @@ -26,13 +26,13 @@ import { checkOnlineForDepartment } from './departmentsLib'; import { afterInquiryQueued, afterRoomQueued, beforeDelegateAgent, beforeRouteChat, onNewRoom } from './hooks'; import { checkOnlineAgents, getOnlineAgents } from './service-status'; import { getInquirySortMechanismSetting } from './settings'; -import { dispatchInquiryPosition } from '../../../../ee/app/livechat-enterprise/server/lib/Helper'; -import { client, shouldRetryTransaction } from '../../../../server/database/utils'; -import { sendNotification } from '../../../lib/server'; -import { notifyOnLivechatInquiryChangedById, notifyOnLivechatInquiryChanged } from '../../../lib/server/lib/notifyListener'; -import { settings } from '../../../settings/server'; -import { i18n } from '../../../utils/lib/i18n'; -import { getOmniChatSortQuery } from '../../lib/inquiries'; +import { getOmniChatSortQuery } from '../../../app/livechat/lib/inquiries'; +import { i18n } from '../../../app/utils/lib/i18n'; +import { dispatchInquiryPosition } from '../../../ee/server/lib/omnichannel/Helper'; +import { client, shouldRetryTransaction } from '../../database/utils'; +import { sendNotification } from '../../hooks/messages/sendNotificationsOnMessage'; +import { settings } from '../../settings'; +import { notifyOnLivechatInquiryChangedById, notifyOnLivechatInquiryChanged } from '../notifyListener'; const logger = new Logger('QueueManager'); diff --git a/apps/meteor/app/livechat/server/lib/RoutingManager.ts b/apps/meteor/server/lib/omnichannel/RoutingManager.ts similarity index 98% rename from apps/meteor/app/livechat/server/lib/RoutingManager.ts rename to apps/meteor/server/lib/omnichannel/RoutingManager.ts index 581ecfe1f6d94..6a713f6e6ac6b 100644 --- a/apps/meteor/app/livechat/server/lib/RoutingManager.ts +++ b/apps/meteor/server/lib/omnichannel/RoutingManager.ts @@ -30,9 +30,9 @@ import { } from './Helper'; import { conditionalLockAgent } from './conditionalLockAgent'; import { afterTakeInquiry, beforeDelegateAgent } from './hooks'; -import { callbacks } from '../../../../server/lib/callbacks'; -import { notifyOnLivechatInquiryChangedById, notifyOnLivechatInquiryChanged } from '../../../lib/server/lib/notifyListener'; -import { settings } from '../../../settings/server'; +import { settings } from '../../settings'; +import { callbacks } from '../callbacks'; +import { notifyOnLivechatInquiryChangedById, notifyOnLivechatInquiryChanged } from '../notifyListener'; const logger = new Logger('RoutingManager'); diff --git a/apps/meteor/app/livechat/server/lib/Visitors.ts b/apps/meteor/server/lib/omnichannel/Visitors.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/Visitors.ts rename to apps/meteor/server/lib/omnichannel/Visitors.ts diff --git a/apps/meteor/app/livechat/server/lib/analytics/agents.ts b/apps/meteor/server/lib/omnichannel/analytics/agents.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/analytics/agents.ts rename to apps/meteor/server/lib/omnichannel/analytics/agents.ts diff --git a/apps/meteor/app/livechat/server/lib/analytics/dashboards.ts b/apps/meteor/server/lib/omnichannel/analytics/dashboards.ts similarity index 98% rename from apps/meteor/app/livechat/server/lib/analytics/dashboards.ts rename to apps/meteor/server/lib/omnichannel/analytics/dashboards.ts index d02cf20f87262..619dfd1faf6db 100644 --- a/apps/meteor/app/livechat/server/lib/analytics/dashboards.ts +++ b/apps/meteor/server/lib/omnichannel/analytics/dashboards.ts @@ -4,8 +4,8 @@ import { LivechatRooms, Users, LivechatVisitors, LivechatAgentActivity } from '@ import mem from 'mem'; import moment from 'moment'; -import { secondsToHHMMSS } from '../../../../../lib/utils/secondsToHHMMSS'; -import { settings } from '../../../../settings/server'; +import { secondsToHHMMSS } from '../../../../lib/utils/secondsToHHMMSS'; +import { settings } from '../../../settings'; import { getAnalyticsOverviewDataCachedForRealtime } from '../AnalyticsTyped'; import { findPercentageOfAbandonedRoomsAsync, diff --git a/apps/meteor/app/livechat/server/lib/analytics/departments.ts b/apps/meteor/server/lib/omnichannel/analytics/departments.ts similarity index 98% rename from apps/meteor/app/livechat/server/lib/analytics/departments.ts rename to apps/meteor/server/lib/omnichannel/analytics/departments.ts index f505c6f17f9d0..da670ae47eb64 100644 --- a/apps/meteor/app/livechat/server/lib/analytics/departments.ts +++ b/apps/meteor/server/lib/omnichannel/analytics/departments.ts @@ -1,6 +1,6 @@ import { LivechatRooms, Messages } from '@rocket.chat/models'; -import { settings } from '../../../../settings/server'; +import { settings } from '../../../settings'; type Params = { start: Date; diff --git a/apps/meteor/app/livechat/server/business-hour/AbstractBusinessHour.ts b/apps/meteor/server/lib/omnichannel/business-hour/AbstractBusinessHour.ts similarity index 98% rename from apps/meteor/app/livechat/server/business-hour/AbstractBusinessHour.ts rename to apps/meteor/server/lib/omnichannel/business-hour/AbstractBusinessHour.ts index 1a61cca494935..10b4463d504ab 100644 --- a/apps/meteor/app/livechat/server/business-hour/AbstractBusinessHour.ts +++ b/apps/meteor/server/lib/omnichannel/business-hour/AbstractBusinessHour.ts @@ -6,7 +6,7 @@ import type { IWorkHoursCronJobsWrapper } from '@rocket.chat/models'; import moment from 'moment-timezone'; import type { UpdateFilter } from 'mongodb'; -import { notifyOnUserChange } from '../../../lib/server/lib/notifyListener'; +import { notifyOnUserChange } from '../../notifyListener'; export interface IBusinessHourBehavior { findHoursToCreateJobs(): Promise; diff --git a/apps/meteor/app/livechat/server/business-hour/BusinessHourManager.ts b/apps/meteor/server/lib/omnichannel/business-hour/BusinessHourManager.ts similarity index 97% rename from apps/meteor/app/livechat/server/business-hour/BusinessHourManager.ts rename to apps/meteor/server/lib/omnichannel/business-hour/BusinessHourManager.ts index f7302f42cfb8d..1fe462cc9cd59 100644 --- a/apps/meteor/app/livechat/server/business-hour/BusinessHourManager.ts +++ b/apps/meteor/server/lib/omnichannel/business-hour/BusinessHourManager.ts @@ -6,10 +6,10 @@ import moment from 'moment-timezone'; import type { IBusinessHourBehavior, IBusinessHourType } from './AbstractBusinessHour'; import { closeBusinessHour } from './closeBusinessHour'; -import { callbacks } from '../../../../server/lib/callbacks'; -import { notifyOnUserChange } from '../../../lib/server/lib/notifyListener'; -import { settings } from '../../../settings/server'; -import { businessHourLogger } from '../lib/logger'; +import { settings } from '../../../settings'; +import { callbacks } from '../../callbacks'; +import { notifyOnUserChange } from '../../notifyListener'; +import { businessHourLogger } from '../logger'; const CRON_EVERY_MIDNIGHT_EXPRESSION = '0 0 * * *'; const CRON_DAYLIGHT_JOB_NAME = 'livechat-business-hour-daylight-saving-time-verifier'; diff --git a/apps/meteor/app/livechat/server/business-hour/Default.ts b/apps/meteor/server/lib/omnichannel/business-hour/Default.ts similarity index 100% rename from apps/meteor/app/livechat/server/business-hour/Default.ts rename to apps/meteor/server/lib/omnichannel/business-hour/Default.ts diff --git a/apps/meteor/app/livechat/server/business-hour/Helper.ts b/apps/meteor/server/lib/omnichannel/business-hour/Helper.ts similarity index 96% rename from apps/meteor/app/livechat/server/business-hour/Helper.ts rename to apps/meteor/server/lib/omnichannel/business-hour/Helper.ts index b18863ead06aa..7a431af506b24 100644 --- a/apps/meteor/app/livechat/server/business-hour/Helper.ts +++ b/apps/meteor/server/lib/omnichannel/business-hour/Helper.ts @@ -5,8 +5,8 @@ import moment from 'moment'; import { createDefaultBusinessHourRow } from './LivechatBusinessHours'; import { filterBusinessHoursThatMustBeOpened } from './filterBusinessHoursThatMustBeOpened'; -import { notifyOnUserChangeAsync } from '../../../lib/server/lib/notifyListener'; -import { businessHourLogger } from '../lib/logger'; +import { notifyOnUserChangeAsync } from '../../notifyListener'; +import { businessHourLogger } from '../logger'; export { filterBusinessHoursThatMustBeOpened }; diff --git a/apps/meteor/app/livechat/server/business-hour/LivechatBusinessHours.ts b/apps/meteor/server/lib/omnichannel/business-hour/LivechatBusinessHours.ts similarity index 100% rename from apps/meteor/app/livechat/server/business-hour/LivechatBusinessHours.ts rename to apps/meteor/server/lib/omnichannel/business-hour/LivechatBusinessHours.ts diff --git a/apps/meteor/app/livechat/server/business-hour/Single.ts b/apps/meteor/server/lib/omnichannel/business-hour/Single.ts similarity index 95% rename from apps/meteor/app/livechat/server/business-hour/Single.ts rename to apps/meteor/server/lib/omnichannel/business-hour/Single.ts index ddd8d4d09e9c5..64987c8b58cb3 100644 --- a/apps/meteor/app/livechat/server/business-hour/Single.ts +++ b/apps/meteor/server/lib/omnichannel/business-hour/Single.ts @@ -4,8 +4,8 @@ import { LivechatBusinessHours, Users } from '@rocket.chat/models'; import type { IBusinessHourBehavior } from './AbstractBusinessHour'; import { AbstractBusinessHourBehavior } from './AbstractBusinessHour'; import { filterBusinessHoursThatMustBeOpened, makeAgentsUnavailableBasedOnBusinessHour, openBusinessHourDefault } from './Helper'; -import { notifyOnUserChange } from '../../../lib/server/lib/notifyListener'; -import { businessHourLogger } from '../lib/logger'; +import { notifyOnUserChange } from '../../notifyListener'; +import { businessHourLogger } from '../logger'; export class SingleBusinessHourBehavior extends AbstractBusinessHourBehavior implements IBusinessHourBehavior { async openBusinessHoursByDayAndHour(): Promise { diff --git a/apps/meteor/app/livechat/server/business-hour/closeBusinessHour.ts b/apps/meteor/server/lib/omnichannel/business-hour/closeBusinessHour.ts similarity index 95% rename from apps/meteor/app/livechat/server/business-hour/closeBusinessHour.ts rename to apps/meteor/server/lib/omnichannel/business-hour/closeBusinessHour.ts index c18784adb5ea4..885e2378887c9 100644 --- a/apps/meteor/app/livechat/server/business-hour/closeBusinessHour.ts +++ b/apps/meteor/server/lib/omnichannel/business-hour/closeBusinessHour.ts @@ -4,7 +4,7 @@ import { makeFunction } from '@rocket.chat/patch-injection'; import { makeAgentsUnavailableBasedOnBusinessHour } from './Helper'; import { getAgentIdsForBusinessHour } from './getAgentIdsForBusinessHour'; -import { businessHourLogger } from '../lib/logger'; +import { businessHourLogger } from '../logger'; export const closeBusinessHourByAgentIds = async ( businessHourId: ILivechatBusinessHour['_id'], diff --git a/apps/meteor/app/livechat/server/business-hour/filterBusinessHoursThatMustBeOpened.spec.ts b/apps/meteor/server/lib/omnichannel/business-hour/filterBusinessHoursThatMustBeOpened.spec.ts similarity index 100% rename from apps/meteor/app/livechat/server/business-hour/filterBusinessHoursThatMustBeOpened.spec.ts rename to apps/meteor/server/lib/omnichannel/business-hour/filterBusinessHoursThatMustBeOpened.spec.ts diff --git a/apps/meteor/app/livechat/server/business-hour/filterBusinessHoursThatMustBeOpened.ts b/apps/meteor/server/lib/omnichannel/business-hour/filterBusinessHoursThatMustBeOpened.ts similarity index 100% rename from apps/meteor/app/livechat/server/business-hour/filterBusinessHoursThatMustBeOpened.ts rename to apps/meteor/server/lib/omnichannel/business-hour/filterBusinessHoursThatMustBeOpened.ts diff --git a/apps/meteor/app/livechat/server/business-hour/getAgentIdsForBusinessHour.ts b/apps/meteor/server/lib/omnichannel/business-hour/getAgentIdsForBusinessHour.ts similarity index 100% rename from apps/meteor/app/livechat/server/business-hour/getAgentIdsForBusinessHour.ts rename to apps/meteor/server/lib/omnichannel/business-hour/getAgentIdsForBusinessHour.ts diff --git a/apps/meteor/app/livechat/server/business-hour/index.ts b/apps/meteor/server/lib/omnichannel/business-hour/index.ts similarity index 93% rename from apps/meteor/app/livechat/server/business-hour/index.ts rename to apps/meteor/server/lib/omnichannel/business-hour/index.ts index 95540bb44e9aa..13fc618fef6cd 100644 --- a/apps/meteor/app/livechat/server/business-hour/index.ts +++ b/apps/meteor/server/lib/omnichannel/business-hour/index.ts @@ -6,7 +6,7 @@ import { Meteor } from 'meteor/meteor'; import { BusinessHourManager } from './BusinessHourManager'; import { DefaultBusinessHour } from './Default'; import { SingleBusinessHourBehavior } from './Single'; -import { callbacks } from '../../../../server/lib/callbacks'; +import { callbacks } from '../../callbacks'; export const businessHourManager = new BusinessHourManager(cronJobs); diff --git a/apps/meteor/server/lib/omnichannel/closeLivechatRoom.ts b/apps/meteor/server/lib/omnichannel/closeLivechatRoom.ts index f674c92e2d6ed..96e1b889801fc 100644 --- a/apps/meteor/server/lib/omnichannel/closeLivechatRoom.ts +++ b/apps/meteor/server/lib/omnichannel/closeLivechatRoom.ts @@ -1,8 +1,8 @@ import type { IUser, IRoom, IOmnichannelRoom } from '@rocket.chat/core-typings'; import { LivechatRooms, Subscriptions } from '@rocket.chat/models'; -import { closeRoom } from '../../../app/livechat/server/lib/closeRoom'; -import type { CloseRoomParams } from '../../../app/livechat/server/lib/localTypes'; +import { closeRoom } from './closeRoom'; +import type { CloseRoomParams } from './localTypes'; import { hasPermissionAsync } from '../authorization/hasPermission'; export const closeLivechatRoom = async ( diff --git a/apps/meteor/server/lib/omnichannel/closeOmnichannelConversations.ts b/apps/meteor/server/lib/omnichannel/closeOmnichannelConversations.ts index fe66acc690dc8..93dd2a8a11911 100644 --- a/apps/meteor/server/lib/omnichannel/closeOmnichannelConversations.ts +++ b/apps/meteor/server/lib/omnichannel/closeOmnichannelConversations.ts @@ -1,8 +1,8 @@ import type { IUser } from '@rocket.chat/core-typings'; import { LivechatRooms } from '@rocket.chat/models'; -import { closeRoom } from '../../../app/livechat/server/lib/closeRoom'; -import { settings } from '../../../app/settings/server'; +import { closeRoom } from './closeRoom'; +import { settings } from '../../settings'; import { callbacks } from '../callbacks'; import { i18n } from '../i18n'; diff --git a/apps/meteor/app/livechat/server/lib/closeRoom.ts b/apps/meteor/server/lib/omnichannel/closeRoom.ts similarity index 97% rename from apps/meteor/app/livechat/server/lib/closeRoom.ts rename to apps/meteor/server/lib/omnichannel/closeRoom.ts index 8ee99231ee609..2b8a84578c8f5 100644 --- a/apps/meteor/app/livechat/server/lib/closeRoom.ts +++ b/apps/meteor/server/lib/omnichannel/closeRoom.ts @@ -9,15 +9,15 @@ import type { ClientSession } from 'mongodb'; import type { CloseRoomParams, CloseRoomParamsByUser, CloseRoomParamsByVisitor } from './localTypes'; import { livechatLogger as logger } from './logger'; import { parseTranscriptRequest } from './parseTranscriptRequest'; -import { client, shouldRetryTransaction } from '../../../../server/database/utils'; -import { callbacks } from '../../../../server/lib/callbacks'; +import { client, shouldRetryTransaction } from '../../database/utils'; +import { settings } from '../../settings'; +import { callbacks } from '../callbacks'; import { notifyOnLivechatInquiryChanged, notifyOnRoomChanged, notifyOnRoomChangedById, notifyOnSubscriptionChanged, -} from '../../../lib/server/lib/notifyListener'; -import { settings } from '../../../settings/server'; +} from '../notifyListener'; type ChatCloser = { _id: string; username: string | undefined }; diff --git a/apps/meteor/app/livechat/server/lib/conditionalLockAgent.ts b/apps/meteor/server/lib/omnichannel/conditionalLockAgent.ts similarity index 86% rename from apps/meteor/app/livechat/server/lib/conditionalLockAgent.ts rename to apps/meteor/server/lib/omnichannel/conditionalLockAgent.ts index 5bb9db565b712..bcceb026c3441 100644 --- a/apps/meteor/app/livechat/server/lib/conditionalLockAgent.ts +++ b/apps/meteor/server/lib/omnichannel/conditionalLockAgent.ts @@ -1,7 +1,7 @@ import { Users } from '@rocket.chat/models'; -import { hasRoleAsync } from '../../../../server/lib/authorization/hasRole'; -import { settings } from '../../../settings/server'; +import { settings } from '../../settings'; +import { hasRoleAsync } from '../authorization/hasRole'; type LockResult = { acquired: boolean; diff --git a/apps/meteor/app/livechat/server/lib/contacts/ContactMerger.ts b/apps/meteor/server/lib/omnichannel/contacts/ContactMerger.ts similarity index 99% rename from apps/meteor/app/livechat/server/lib/contacts/ContactMerger.ts rename to apps/meteor/server/lib/omnichannel/contacts/ContactMerger.ts index a52b5bbc17417..d53307188d141 100644 --- a/apps/meteor/app/livechat/server/lib/contacts/ContactMerger.ts +++ b/apps/meteor/server/lib/omnichannel/contacts/ContactMerger.ts @@ -11,7 +11,7 @@ import { LivechatContacts } from '@rocket.chat/models'; import type { ClientSession, UpdateFilter } from 'mongodb'; import { getContactManagerIdByUsername } from './getContactManagerIdByUsername'; -import { isSameChannel } from '../../../lib/isSameChannel'; +import { isSameChannel } from '../../../../app/livechat/lib/isSameChannel'; type ManagerValue = { id: string } | { username: string }; type ContactFields = { diff --git a/apps/meteor/app/livechat/server/lib/contacts/addContactEmail.ts b/apps/meteor/server/lib/omnichannel/contacts/addContactEmail.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/contacts/addContactEmail.ts rename to apps/meteor/server/lib/omnichannel/contacts/addContactEmail.ts diff --git a/apps/meteor/app/livechat/server/lib/contacts/createContact.ts b/apps/meteor/server/lib/omnichannel/contacts/createContact.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/contacts/createContact.ts rename to apps/meteor/server/lib/omnichannel/contacts/createContact.ts diff --git a/apps/meteor/app/livechat/server/lib/contacts/createContactFromVisitor.ts b/apps/meteor/server/lib/omnichannel/contacts/createContactFromVisitor.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/contacts/createContactFromVisitor.ts rename to apps/meteor/server/lib/omnichannel/contacts/createContactFromVisitor.ts diff --git a/apps/meteor/app/livechat/server/lib/contacts/disableContact.ts b/apps/meteor/server/lib/omnichannel/contacts/disableContact.ts similarity index 94% rename from apps/meteor/app/livechat/server/lib/contacts/disableContact.ts rename to apps/meteor/server/lib/omnichannel/contacts/disableContact.ts index 340d34e6906ba..d6441a19dde8b 100644 --- a/apps/meteor/app/livechat/server/lib/contacts/disableContact.ts +++ b/apps/meteor/server/lib/omnichannel/contacts/disableContact.ts @@ -1,7 +1,7 @@ import type { ILivechatContact } from '@rocket.chat/core-typings'; import { LivechatContacts, LivechatRooms } from '@rocket.chat/models'; -import { settings } from '../../../../settings/server'; +import { settings } from '../../../settings'; import { removeGuest } from '../guests'; export async function disableContactById(contactId: string): Promise { diff --git a/apps/meteor/app/livechat/server/lib/contacts/getAllowedCustomFields.ts b/apps/meteor/server/lib/omnichannel/contacts/getAllowedCustomFields.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/contacts/getAllowedCustomFields.ts rename to apps/meteor/server/lib/omnichannel/contacts/getAllowedCustomFields.ts diff --git a/apps/meteor/app/livechat/server/lib/contacts/getContactChannelsGrouped.ts b/apps/meteor/server/lib/omnichannel/contacts/getContactChannelsGrouped.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/contacts/getContactChannelsGrouped.ts rename to apps/meteor/server/lib/omnichannel/contacts/getContactChannelsGrouped.ts diff --git a/apps/meteor/app/livechat/server/lib/contacts/getContactHistory.ts b/apps/meteor/server/lib/omnichannel/contacts/getContactHistory.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/contacts/getContactHistory.ts rename to apps/meteor/server/lib/omnichannel/contacts/getContactHistory.ts diff --git a/apps/meteor/app/livechat/server/lib/contacts/getContactIdByVisitor.ts b/apps/meteor/server/lib/omnichannel/contacts/getContactIdByVisitor.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/contacts/getContactIdByVisitor.ts rename to apps/meteor/server/lib/omnichannel/contacts/getContactIdByVisitor.ts diff --git a/apps/meteor/app/livechat/server/lib/contacts/getContactManagerIdByUsername.ts b/apps/meteor/server/lib/omnichannel/contacts/getContactManagerIdByUsername.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/contacts/getContactManagerIdByUsername.ts rename to apps/meteor/server/lib/omnichannel/contacts/getContactManagerIdByUsername.ts diff --git a/apps/meteor/app/livechat/server/lib/contacts/getContacts.ts b/apps/meteor/server/lib/omnichannel/contacts/getContacts.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/contacts/getContacts.ts rename to apps/meteor/server/lib/omnichannel/contacts/getContacts.ts diff --git a/apps/meteor/app/livechat/server/lib/contacts/isAgentAvailableToTakeContactInquiry.ts b/apps/meteor/server/lib/omnichannel/contacts/isAgentAvailableToTakeContactInquiry.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/contacts/isAgentAvailableToTakeContactInquiry.ts rename to apps/meteor/server/lib/omnichannel/contacts/isAgentAvailableToTakeContactInquiry.ts diff --git a/apps/meteor/app/livechat/server/lib/contacts/isVerifiedChannelInSource.spec.ts b/apps/meteor/server/lib/omnichannel/contacts/isVerifiedChannelInSource.spec.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/contacts/isVerifiedChannelInSource.spec.ts rename to apps/meteor/server/lib/omnichannel/contacts/isVerifiedChannelInSource.spec.ts diff --git a/apps/meteor/app/livechat/server/lib/contacts/isVerifiedChannelInSource.ts b/apps/meteor/server/lib/omnichannel/contacts/isVerifiedChannelInSource.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/contacts/isVerifiedChannelInSource.ts rename to apps/meteor/server/lib/omnichannel/contacts/isVerifiedChannelInSource.ts diff --git a/apps/meteor/app/livechat/server/lib/contacts/mapVisitorToContact.spec.ts b/apps/meteor/server/lib/omnichannel/contacts/mapVisitorToContact.spec.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/contacts/mapVisitorToContact.spec.ts rename to apps/meteor/server/lib/omnichannel/contacts/mapVisitorToContact.spec.ts diff --git a/apps/meteor/app/livechat/server/lib/contacts/mapVisitorToContact.ts b/apps/meteor/server/lib/omnichannel/contacts/mapVisitorToContact.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/contacts/mapVisitorToContact.ts rename to apps/meteor/server/lib/omnichannel/contacts/mapVisitorToContact.ts diff --git a/apps/meteor/app/livechat/server/lib/contacts/mergeContacts.ts b/apps/meteor/server/lib/omnichannel/contacts/mergeContacts.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/contacts/mergeContacts.ts rename to apps/meteor/server/lib/omnichannel/contacts/mergeContacts.ts diff --git a/apps/meteor/app/livechat/server/lib/contacts/migrateVisitorIfMissingContact.ts b/apps/meteor/server/lib/omnichannel/contacts/migrateVisitorIfMissingContact.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/contacts/migrateVisitorIfMissingContact.ts rename to apps/meteor/server/lib/omnichannel/contacts/migrateVisitorIfMissingContact.ts diff --git a/apps/meteor/app/livechat/server/lib/contacts/migrateVisitorToContactId.spec.ts b/apps/meteor/server/lib/omnichannel/contacts/migrateVisitorToContactId.spec.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/contacts/migrateVisitorToContactId.spec.ts rename to apps/meteor/server/lib/omnichannel/contacts/migrateVisitorToContactId.spec.ts diff --git a/apps/meteor/app/livechat/server/lib/contacts/migrateVisitorToContactId.ts b/apps/meteor/server/lib/omnichannel/contacts/migrateVisitorToContactId.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/contacts/migrateVisitorToContactId.ts rename to apps/meteor/server/lib/omnichannel/contacts/migrateVisitorToContactId.ts diff --git a/apps/meteor/app/livechat/server/lib/contacts/patchContact.ts b/apps/meteor/server/lib/omnichannel/contacts/patchContact.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/contacts/patchContact.ts rename to apps/meteor/server/lib/omnichannel/contacts/patchContact.ts diff --git a/apps/meteor/app/livechat/server/lib/contacts/registerContact.spec.ts b/apps/meteor/server/lib/omnichannel/contacts/registerContact.spec.ts similarity index 98% rename from apps/meteor/app/livechat/server/lib/contacts/registerContact.spec.ts rename to apps/meteor/server/lib/omnichannel/contacts/registerContact.spec.ts index 9eb3499a8b175..fe83e38413eb6 100644 --- a/apps/meteor/app/livechat/server/lib/contacts/registerContact.spec.ts +++ b/apps/meteor/server/lib/omnichannel/contacts/registerContact.spec.ts @@ -36,7 +36,6 @@ const { registerContact } = proxyquire.noCallThru().load('./registerContact', { 'meteor/meteor': sinon.stub(), '@rocket.chat/models': modelsMock, '@rocket.chat/tools': { wrapExceptions: sinon.stub() }, - './Helper': { validateEmail: sinon.stub() }, }); describe('registerContact', () => { diff --git a/apps/meteor/app/livechat/server/lib/contacts/registerContact.ts b/apps/meteor/server/lib/omnichannel/contacts/registerContact.ts similarity index 94% rename from apps/meteor/app/livechat/server/lib/contacts/registerContact.ts rename to apps/meteor/server/lib/omnichannel/contacts/registerContact.ts index 007295abe62dc..04fa1969b7b7b 100644 --- a/apps/meteor/app/livechat/server/lib/contacts/registerContact.ts +++ b/apps/meteor/server/lib/omnichannel/contacts/registerContact.ts @@ -5,12 +5,8 @@ import type { MatchKeysAndValues, OnlyFieldsOfType } from 'mongodb'; import { getAllowedCustomFields } from './getAllowedCustomFields'; import { validateCustomFields } from './validateCustomFields'; -import { callbacks } from '../../../../../server/lib/callbacks'; -import { - notifyOnRoomChangedById, - notifyOnSubscriptionChangedByRoomId, - notifyOnLivechatInquiryChangedByRoom, -} from '../../../../lib/server/lib/notifyListener'; +import { callbacks } from '../../callbacks'; +import { notifyOnRoomChangedById, notifyOnSubscriptionChangedByRoomId, notifyOnLivechatInquiryChangedByRoom } from '../../notifyListener'; type RegisterContactProps = { _id?: string; diff --git a/apps/meteor/app/livechat/server/lib/contacts/resolveContactConflicts.spec.ts b/apps/meteor/server/lib/omnichannel/contacts/resolveContactConflicts.spec.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/contacts/resolveContactConflicts.spec.ts rename to apps/meteor/server/lib/omnichannel/contacts/resolveContactConflicts.spec.ts diff --git a/apps/meteor/app/livechat/server/lib/contacts/resolveContactConflicts.ts b/apps/meteor/server/lib/omnichannel/contacts/resolveContactConflicts.ts similarity index 96% rename from apps/meteor/app/livechat/server/lib/contacts/resolveContactConflicts.ts rename to apps/meteor/server/lib/omnichannel/contacts/resolveContactConflicts.ts index 84e36c5995b3e..b82bd6f585c47 100644 --- a/apps/meteor/app/livechat/server/lib/contacts/resolveContactConflicts.ts +++ b/apps/meteor/server/lib/omnichannel/contacts/resolveContactConflicts.ts @@ -3,7 +3,7 @@ import { LivechatContacts, Settings } from '@rocket.chat/models'; import { patchContact } from './patchContact'; import { validateContactManager } from './validateContactManager'; -import { notifyOnSettingChanged } from '../../../../lib/server/lib/notifyListener'; +import { notifyOnSettingChanged } from '../../notifyListener'; export type ResolveContactConflictsParams = { contactId: string; diff --git a/apps/meteor/app/livechat/server/lib/contacts/updateContact.spec.ts b/apps/meteor/server/lib/omnichannel/contacts/updateContact.spec.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/contacts/updateContact.spec.ts rename to apps/meteor/server/lib/omnichannel/contacts/updateContact.spec.ts diff --git a/apps/meteor/app/livechat/server/lib/contacts/updateContact.ts b/apps/meteor/server/lib/omnichannel/contacts/updateContact.ts similarity index 98% rename from apps/meteor/app/livechat/server/lib/contacts/updateContact.ts rename to apps/meteor/server/lib/omnichannel/contacts/updateContact.ts index f8e84b1e617fa..3fb0a9eeb6822 100644 --- a/apps/meteor/app/livechat/server/lib/contacts/updateContact.ts +++ b/apps/meteor/server/lib/omnichannel/contacts/updateContact.ts @@ -10,7 +10,7 @@ import { notifyOnRoomChangedByContactId, notifyOnLivechatInquiryChangedByVisitorIds, notifyOnSettingChanged, -} from '../../../../lib/server/lib/notifyListener'; +} from '../../notifyListener'; export type UpdateContactParams = { contactId: string; diff --git a/apps/meteor/app/livechat/server/lib/contacts/validateContactManager.spec.ts b/apps/meteor/server/lib/omnichannel/contacts/validateContactManager.spec.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/contacts/validateContactManager.spec.ts rename to apps/meteor/server/lib/omnichannel/contacts/validateContactManager.spec.ts diff --git a/apps/meteor/app/livechat/server/lib/contacts/validateContactManager.ts b/apps/meteor/server/lib/omnichannel/contacts/validateContactManager.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/contacts/validateContactManager.ts rename to apps/meteor/server/lib/omnichannel/contacts/validateContactManager.ts diff --git a/apps/meteor/app/livechat/server/lib/contacts/validateCustomFields.spec.ts b/apps/meteor/server/lib/omnichannel/contacts/validateCustomFields.spec.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/contacts/validateCustomFields.spec.ts rename to apps/meteor/server/lib/omnichannel/contacts/validateCustomFields.spec.ts diff --git a/apps/meteor/app/livechat/server/lib/contacts/validateCustomFields.ts b/apps/meteor/server/lib/omnichannel/contacts/validateCustomFields.ts similarity index 93% rename from apps/meteor/app/livechat/server/lib/contacts/validateCustomFields.ts rename to apps/meteor/server/lib/omnichannel/contacts/validateCustomFields.ts index 3ab981cf2513b..0dd3241e3bca9 100644 --- a/apps/meteor/app/livechat/server/lib/contacts/validateCustomFields.ts +++ b/apps/meteor/server/lib/omnichannel/contacts/validateCustomFields.ts @@ -1,7 +1,7 @@ import type { AtLeast, ILivechatCustomField } from '@rocket.chat/core-typings'; -import { trim } from '../../../../../lib/utils/stringUtils'; -import { i18n } from '../../../../utils/lib/i18n'; +import { i18n } from '../../../../app/utils/lib/i18n'; +import { trim } from '../../../../lib/utils/stringUtils'; export function validateCustomFields( allowedCustomFields: AtLeast[], diff --git a/apps/meteor/app/livechat/server/lib/contacts/verifyContactChannel.ts b/apps/meteor/server/lib/omnichannel/contacts/verifyContactChannel.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/contacts/verifyContactChannel.ts rename to apps/meteor/server/lib/omnichannel/contacts/verifyContactChannel.ts diff --git a/apps/meteor/app/livechat/server/lib/custom-fields.ts b/apps/meteor/server/lib/omnichannel/custom-fields.ts similarity index 99% rename from apps/meteor/app/livechat/server/lib/custom-fields.ts rename to apps/meteor/server/lib/omnichannel/custom-fields.ts index 09cdc4f0b7d9a..9b46b4a8305e9 100644 --- a/apps/meteor/app/livechat/server/lib/custom-fields.ts +++ b/apps/meteor/server/lib/omnichannel/custom-fields.ts @@ -2,7 +2,7 @@ import type { ILivechatContact, ILivechatCustomField, ILivechatVisitor } from '@ import { LivechatContacts, LivechatCustomField, LivechatRooms, LivechatVisitors } from '@rocket.chat/models'; import { livechatLogger } from './logger'; -import { i18n } from '../../../utils/lib/i18n'; +import { i18n } from '../../../app/utils/lib/i18n'; export const validateRequiredCustomFields = (customFields: string[], livechatCustomFields: ILivechatCustomField[]) => { const errors: string[] = []; diff --git a/apps/meteor/app/livechat/server/lib/departmentsLib.ts b/apps/meteor/server/lib/omnichannel/departmentsLib.ts similarity index 97% rename from apps/meteor/app/livechat/server/lib/departmentsLib.ts rename to apps/meteor/server/lib/omnichannel/departmentsLib.ts index b65d6fa675bf2..a7e1d58ad2e96 100644 --- a/apps/meteor/app/livechat/server/lib/departmentsLib.ts +++ b/apps/meteor/server/lib/omnichannel/departmentsLib.ts @@ -8,12 +8,9 @@ import { Meteor } from 'meteor/meteor'; import { updateDepartmentAgents } from './Helper'; import { afterDepartmentArchived, afterDepartmentUnarchived } from './hooks'; import { livechatLogger } from './logger'; -import { callbacks } from '../../../../server/lib/callbacks'; -import { - notifyOnLivechatDepartmentAgentChangedByDepartmentId, - notifyOnLivechatDepartmentAgentChanged, -} from '../../../lib/server/lib/notifyListener'; -import { settings } from '../../../settings/server'; +import { settings } from '../../settings'; +import { callbacks } from '../callbacks'; +import { notifyOnLivechatDepartmentAgentChangedByDepartmentId, notifyOnLivechatDepartmentAgentChanged } from '../notifyListener'; /** * @param {string|null} _id - The department id * @param {Partial} departmentData diff --git a/apps/meteor/app/livechat/server/lib/getRoomMessages.ts b/apps/meteor/server/lib/omnichannel/getRoomMessages.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/getRoomMessages.ts rename to apps/meteor/server/lib/omnichannel/getRoomMessages.ts diff --git a/apps/meteor/app/livechat/server/lib/guests.ts b/apps/meteor/server/lib/omnichannel/guests.ts similarity index 93% rename from apps/meteor/app/livechat/server/lib/guests.ts rename to apps/meteor/server/lib/omnichannel/guests.ts index a9727e4017e41..5cd25034829d7 100644 --- a/apps/meteor/app/livechat/server/lib/guests.ts +++ b/apps/meteor/server/lib/omnichannel/guests.ts @@ -17,15 +17,11 @@ import UAParser from 'ua-parser-js'; import { parseAgentCustomFields } from './Helper'; import type { ICRMData } from './localTypes'; import { livechatLogger } from './logger'; -import { trim } from '../../../../lib/utils/stringUtils'; -import { hasPermissionAsync } from '../../../../server/lib/authorization/hasPermission'; -import { i18n } from '../../../../server/lib/i18n'; -import { FileUpload } from '../../../../server/lib/media/file-upload'; -import { - notifyOnSubscriptionChanged, - notifyOnLivechatInquiryChanged, - notifyOnLivechatInquiryChangedByToken, -} from '../../../lib/server/lib/notifyListener'; +import { trim } from '../../../lib/utils/stringUtils'; +import { hasPermissionAsync } from '../authorization/hasPermission'; +import { i18n } from '../i18n'; +import { FileUpload } from '../media/file-upload'; +import { notifyOnSubscriptionChanged, notifyOnLivechatInquiryChanged, notifyOnLivechatInquiryChangedByToken } from '../notifyListener'; export async function saveGuest( guestData: Pick & { email?: string; phone?: string }, diff --git a/apps/meteor/app/livechat/server/lib/hooks.ts b/apps/meteor/server/lib/omnichannel/hooks.ts similarity index 94% rename from apps/meteor/app/livechat/server/lib/hooks.ts rename to apps/meteor/server/lib/omnichannel/hooks.ts index f58cd9c638335..784eadc031e6c 100644 --- a/apps/meteor/app/livechat/server/lib/hooks.ts +++ b/apps/meteor/server/lib/omnichannel/hooks.ts @@ -15,10 +15,10 @@ import { LivechatContacts, LivechatDepartmentAgents, LivechatVisitors, Users } f import { makeFunction } from '@rocket.chat/patch-injection'; import { setUserStatusLivechat } from './utils'; -import { sendToCRM } from '../../../../server/hooks/omnichannel/sendToCRM'; -import { callbacks } from '../../../../server/lib/callbacks'; -import { notifyOnLivechatDepartmentAgentChangedByDepartmentId } from '../../../lib/server/lib/notifyListener'; -import { settings } from '../../../settings/server'; +import { sendToCRM } from '../../hooks/omnichannel/sendToCRM'; +import { settings } from '../../settings'; +import { callbacks } from '../callbacks'; +import { notifyOnLivechatDepartmentAgentChangedByDepartmentId } from '../notifyListener'; export async function afterAgentUserActivated(user: IUser) { if (!user.roles.includes('livechat-agent')) { diff --git a/apps/meteor/server/lib/omnichannel/index.ts b/apps/meteor/server/lib/omnichannel/index.ts new file mode 100644 index 0000000000000..f3d92584529b0 --- /dev/null +++ b/apps/meteor/server/lib/omnichannel/index.ts @@ -0,0 +1,24 @@ +import './livechat'; +import './startup'; +import '../../hooks/omnichannel/leadCapture'; +import '../../hooks/omnichannel/markRoomResponded'; +import '../../hooks/omnichannel/offlineMessage'; +import '../../hooks/omnichannel/offlineMessageToChannel'; +import '../../hooks/omnichannel/saveAnalyticsData'; +import '../../hooks/omnichannel/sendToCRM'; +import '../../hooks/omnichannel/processRoomAbandonment'; +import '../../hooks/omnichannel/saveLastVisitorMessageTs'; +import '../../hooks/omnichannel/markRoomNotResponded'; +import '../../hooks/omnichannel/sendEmailTranscriptOnClose'; +import '../../hooks/omnichannel/saveLastMessageToInquiry'; +import '../../hooks/omnichannel/afterUserActions'; +import '../../hooks/omnichannel/afterAgentRemoved'; +import '../../hooks/omnichannel/afterSaveOmnichannelMessage'; +import './QueueManager'; +import './RoutingManager'; +import './routing/External'; +import './routing/ManualSelection'; +import './routing/AutoSelection'; +import './stream/agentStatus'; +import './sendMessageBySMS'; +import '../../api/v1/omnichannel'; diff --git a/apps/meteor/app/livechat/server/lib/isMessageFromBot.ts b/apps/meteor/server/lib/omnichannel/isMessageFromBot.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/isMessageFromBot.ts rename to apps/meteor/server/lib/omnichannel/isMessageFromBot.ts diff --git a/apps/meteor/app/livechat/server/livechat.ts b/apps/meteor/server/lib/omnichannel/livechat.ts similarity index 95% rename from apps/meteor/app/livechat/server/livechat.ts rename to apps/meteor/server/lib/omnichannel/livechat.ts index 70dd67257650d..c90e84c0c76a6 100644 --- a/apps/meteor/app/livechat/server/livechat.ts +++ b/apps/meteor/server/lib/omnichannel/livechat.ts @@ -4,8 +4,8 @@ import jsdom from 'jsdom'; import mem from 'mem'; import { WebApp } from 'meteor/webapp'; -import { settings } from '../../settings/server'; -import { addServerUrlToIndex } from '../lib/Assets'; +import { addServerUrlToIndex } from './Assets'; +import { settings } from '../../settings'; const indexHtmlWithServerURL = await Assets.getTextAsync('livechat/index.html'); diff --git a/apps/meteor/app/livechat/server/lib/localTypes.ts b/apps/meteor/server/lib/omnichannel/localTypes.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/localTypes.ts rename to apps/meteor/server/lib/omnichannel/localTypes.ts diff --git a/apps/meteor/app/livechat/server/lib/logger.ts b/apps/meteor/server/lib/omnichannel/logger.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/logger.ts rename to apps/meteor/server/lib/omnichannel/logger.ts diff --git a/apps/meteor/app/livechat/server/lib/messages.ts b/apps/meteor/server/lib/omnichannel/messages.ts similarity index 90% rename from apps/meteor/app/livechat/server/lib/messages.ts rename to apps/meteor/server/lib/omnichannel/messages.ts index ec03f872777e5..7225067766c65 100644 --- a/apps/meteor/app/livechat/server/lib/messages.ts +++ b/apps/meteor/server/lib/omnichannel/messages.ts @@ -9,12 +9,12 @@ import { Meteor } from 'meteor/meteor'; import type { ILivechatMessage } from './localTypes'; import { getRoom } from './rooms'; import { showConnecting } from './utils'; -import { callbacks } from '../../../../server/lib/callbacks'; -import { deleteMessage as deleteMessageFunc } from '../../../../server/lib/messages/deleteMessage'; -import { sendMessage as sendMessageFunc } from '../../../../server/lib/messages/sendMessage'; -import { updateMessage as updateMessageFunc } from '../../../../server/lib/messages/updateMessage'; -import * as Mailer from '../../../../server/lib/notifications/email/api'; -import { settings } from '../../../settings/server'; +import { settings } from '../../settings'; +import { callbacks } from '../callbacks'; +import { deleteMessage as deleteMessageFunc } from '../messages/deleteMessage'; +import { sendMessage as sendMessageFunc } from '../messages/sendMessage'; +import { updateMessage as updateMessageFunc } from '../messages/updateMessage'; +import * as Mailer from '../notifications/email/api'; const dnsResolveMx = util.promisify(dns.resolveMx); diff --git a/apps/meteor/app/livechat/server/lib/omni-users.ts b/apps/meteor/server/lib/omnichannel/omni-users.ts similarity index 91% rename from apps/meteor/app/livechat/server/lib/omni-users.ts rename to apps/meteor/server/lib/omnichannel/omni-users.ts index 28a0678cea959..bc57165816b65 100644 --- a/apps/meteor/app/livechat/server/lib/omni-users.ts +++ b/apps/meteor/server/lib/omnichannel/omni-users.ts @@ -5,10 +5,10 @@ import { removeEmpty } from '@rocket.chat/tools'; import { updateDepartmentAgents } from './Helper'; import { afterAgentAdded, afterRemoveAgent } from './hooks'; -import { callbacks } from '../../../../server/lib/callbacks'; -import { addUserRolesAsync } from '../../../../server/lib/roles/addUserRoles'; -import { removeUserFromRolesAsync } from '../../../../server/lib/roles/removeUserFromRoles'; -import { settings } from '../../../settings/server'; +import { settings } from '../../settings'; +import { callbacks } from '../callbacks'; +import { addUserRolesAsync } from '../roles/addUserRoles'; +import { removeUserFromRolesAsync } from '../roles/removeUserFromRoles'; export async function notifyAgentStatusChanged(userId: string, status?: UserStatus) { if (!status) { diff --git a/apps/meteor/app/livechat/server/lib/outboundcommunication.ts b/apps/meteor/server/lib/omnichannel/outboundcommunication.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/outboundcommunication.ts rename to apps/meteor/server/lib/omnichannel/outboundcommunication.ts diff --git a/apps/meteor/app/livechat/server/lib/parseTranscriptRequest.ts b/apps/meteor/server/lib/omnichannel/parseTranscriptRequest.ts similarity index 96% rename from apps/meteor/app/livechat/server/lib/parseTranscriptRequest.ts rename to apps/meteor/server/lib/omnichannel/parseTranscriptRequest.ts index 1a9b27b50151e..1a8fb1587ac23 100644 --- a/apps/meteor/app/livechat/server/lib/parseTranscriptRequest.ts +++ b/apps/meteor/server/lib/omnichannel/parseTranscriptRequest.ts @@ -2,7 +2,7 @@ import type { ILivechatVisitor, IOmnichannelRoom, IUser } from '@rocket.chat/cor import { LivechatVisitors, Users } from '@rocket.chat/models'; import type { CloseRoomParams } from './localTypes'; -import { settings } from '../../../settings/server'; +import { settings } from '../../settings'; export const parseTranscriptRequest = async ( room: IOmnichannelRoom, diff --git a/apps/meteor/app/livechat/server/lib/resolveVisitor.ts b/apps/meteor/server/lib/omnichannel/resolveVisitor.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/resolveVisitor.ts rename to apps/meteor/server/lib/omnichannel/resolveVisitor.ts diff --git a/apps/meteor/app/livechat/server/roomAccessValidator.compatibility.ts b/apps/meteor/server/lib/omnichannel/roomAccessValidator.compatibility.ts similarity index 93% rename from apps/meteor/app/livechat/server/roomAccessValidator.compatibility.ts rename to apps/meteor/server/lib/omnichannel/roomAccessValidator.compatibility.ts index b944d46212ad8..f7dce390e1b0a 100644 --- a/apps/meteor/app/livechat/server/roomAccessValidator.compatibility.ts +++ b/apps/meteor/server/lib/omnichannel/roomAccessValidator.compatibility.ts @@ -1,9 +1,9 @@ import type { IUser, IOmnichannelRoom } from '@rocket.chat/core-typings'; import { LivechatDepartmentAgents, LivechatInquiry, LivechatRooms, LivechatDepartment } from '@rocket.chat/models'; -import { RoutingManager } from './lib/RoutingManager'; -import { hasPermissionAsync } from '../../../server/lib/authorization/hasPermission'; -import { hasRoleAsync } from '../../../server/lib/authorization/hasRole'; +import { RoutingManager } from './RoutingManager'; +import { hasPermissionAsync } from '../authorization/hasPermission'; +import { hasRoleAsync } from '../authorization/hasRole'; type OmnichannelRoomAccessValidator = ( room: IOmnichannelRoom, diff --git a/apps/meteor/app/livechat/server/roomAccessValidator.internalService.ts b/apps/meteor/server/lib/omnichannel/roomAccessValidator.internalService.ts similarity index 100% rename from apps/meteor/app/livechat/server/roomAccessValidator.internalService.ts rename to apps/meteor/server/lib/omnichannel/roomAccessValidator.internalService.ts diff --git a/apps/meteor/app/livechat/server/lib/rooms.ts b/apps/meteor/server/lib/omnichannel/rooms.ts similarity index 96% rename from apps/meteor/app/livechat/server/lib/rooms.ts rename to apps/meteor/server/lib/omnichannel/rooms.ts index 98f6d1c171776..cecc36b15d530 100644 --- a/apps/meteor/app/livechat/server/lib/rooms.ts +++ b/apps/meteor/server/lib/omnichannel/rooms.ts @@ -33,9 +33,11 @@ import { getRequiredDepartment } from './departmentsLib'; import { checkDefaultAgentOnNewRoom } from './hooks'; import { livechatLogger } from './logger'; import { saveTransferHistory } from './transfer'; -import { trim } from '../../../../lib/utils/stringUtils'; -import { hasPermissionAsync } from '../../../../server/lib/authorization/hasPermission'; -import { callbacks } from '../../../../server/lib/callbacks'; +import { i18n } from '../../../app/utils/lib/i18n'; +import { trim } from '../../../lib/utils/stringUtils'; +import { settings } from '../../settings'; +import { hasPermissionAsync } from '../authorization/hasPermission'; +import { callbacks } from '../callbacks'; import { notifyOnLivechatInquiryChangedByRoom, notifyOnSubscriptionChangedByRoomId, @@ -43,9 +45,7 @@ import { notifyOnLivechatInquiryChanged, notifyOnSubscriptionChanged, notifyOnRoomChanged, -} from '../../../lib/server/lib/notifyListener'; -import { settings } from '../../../settings/server'; -import { i18n } from '../../../utils/lib/i18n'; +} from '../notifyListener'; export async function getRoom( guest: ILivechatVisitor, diff --git a/apps/meteor/app/livechat/server/lib/routing/AutoSelection.ts b/apps/meteor/server/lib/omnichannel/routing/AutoSelection.ts similarity index 92% rename from apps/meteor/app/livechat/server/lib/routing/AutoSelection.ts rename to apps/meteor/server/lib/omnichannel/routing/AutoSelection.ts index 1accf6347e3e8..64cb3f8ba5842 100644 --- a/apps/meteor/app/livechat/server/lib/routing/AutoSelection.ts +++ b/apps/meteor/server/lib/omnichannel/routing/AutoSelection.ts @@ -1,8 +1,8 @@ import type { IRoutingMethod, RoutingMethodConfig, SelectedAgent } from '@rocket.chat/core-typings'; import { LivechatDepartmentAgents, Users } from '@rocket.chat/models'; -import { callbacks } from '../../../../../server/lib/callbacks'; -import { settings } from '../../../../settings/server'; +import { settings } from '../../../settings'; +import { callbacks } from '../../callbacks'; import { RoutingManager } from '../RoutingManager'; /* Auto Selection Queuing method: diff --git a/apps/meteor/app/livechat/server/lib/routing/External.ts b/apps/meteor/server/lib/omnichannel/routing/External.ts similarity index 95% rename from apps/meteor/app/livechat/server/lib/routing/External.ts rename to apps/meteor/server/lib/omnichannel/routing/External.ts index 98222c318c10b..1d3ee5aa6fbd8 100644 --- a/apps/meteor/app/livechat/server/lib/routing/External.ts +++ b/apps/meteor/server/lib/omnichannel/routing/External.ts @@ -3,8 +3,8 @@ import { Users } from '@rocket.chat/models'; import { serverFetch as fetch } from '@rocket.chat/server-fetch'; import { Meteor } from 'meteor/meteor'; -import { SystemLogger } from '../../../../../server/lib/logger/system'; -import { settings } from '../../../../settings/server'; +import { settings } from '../../../settings'; +import { SystemLogger } from '../../logger/system'; import { RoutingManager } from '../RoutingManager'; class ExternalQueue implements IRoutingMethod { diff --git a/apps/meteor/app/livechat/server/lib/routing/ManualSelection.ts b/apps/meteor/server/lib/omnichannel/routing/ManualSelection.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/routing/ManualSelection.ts rename to apps/meteor/server/lib/omnichannel/routing/ManualSelection.ts diff --git a/apps/meteor/app/livechat/server/sendMessageBySMS.ts b/apps/meteor/server/lib/omnichannel/sendMessageBySMS.ts similarity index 89% rename from apps/meteor/app/livechat/server/sendMessageBySMS.ts rename to apps/meteor/server/lib/omnichannel/sendMessageBySMS.ts index 32c96b529e497..28e5a4d37c383 100644 --- a/apps/meteor/app/livechat/server/sendMessageBySMS.ts +++ b/apps/meteor/server/lib/omnichannel/sendMessageBySMS.ts @@ -2,10 +2,10 @@ import { OmnichannelIntegration } from '@rocket.chat/core-services'; import { isEditedMessage } from '@rocket.chat/core-typings'; import { LivechatVisitors } from '@rocket.chat/models'; -import { callbackLogger } from './lib/logger'; -import { callbacks } from '../../../server/lib/callbacks'; -import { settings } from '../../settings/server'; -import { normalizeMessageFileUpload } from '../../utils/server/functions/normalizeMessageFileUpload'; +import { callbackLogger } from './logger'; +import { settings } from '../../settings'; +import { callbacks } from '../callbacks'; +import { normalizeMessageFileUpload } from '../utils/functions/normalizeMessageFileUpload'; callbacks.add( 'afterOmnichannelSaveMessage', diff --git a/apps/meteor/app/livechat/server/lib/sendTranscript.ts b/apps/meteor/server/lib/omnichannel/sendTranscript.ts similarity index 95% rename from apps/meteor/app/livechat/server/lib/sendTranscript.ts rename to apps/meteor/server/lib/omnichannel/sendTranscript.ts index c837ee4fc1c0a..018cabf1412bd 100644 --- a/apps/meteor/app/livechat/server/lib/sendTranscript.ts +++ b/apps/meteor/server/lib/omnichannel/sendTranscript.ts @@ -18,12 +18,12 @@ import { JSDOM } from 'jsdom'; import { Meteor } from 'meteor/meteor'; import moment from 'moment-timezone'; -import { callbacks } from '../../../../server/lib/callbacks'; -import { i18n } from '../../../../server/lib/i18n'; -import { FileUpload } from '../../../../server/lib/media/file-upload'; -import * as Mailer from '../../../../server/lib/notifications/email/api'; -import { settings } from '../../../settings/server'; -import { getTimezone } from '../../../utils/server/lib/getTimezone'; +import { settings } from '../../settings'; +import { callbacks } from '../callbacks'; +import { i18n } from '../i18n'; +import { FileUpload } from '../media/file-upload'; +import * as Mailer from '../notifications/email/api'; +import { getTimezone } from '../utils/lib/getTimezone'; const logger = new Logger('Livechat-SendTranscript'); diff --git a/apps/meteor/app/livechat/server/lib/service-status.ts b/apps/meteor/server/lib/omnichannel/service-status.ts similarity index 98% rename from apps/meteor/app/livechat/server/lib/service-status.ts rename to apps/meteor/server/lib/omnichannel/service-status.ts index 94d1e06aeb64b..18fd662a861a5 100644 --- a/apps/meteor/app/livechat/server/lib/service-status.ts +++ b/apps/meteor/server/lib/omnichannel/service-status.ts @@ -4,7 +4,7 @@ import type { FindCursor } from 'mongodb'; import { checkOnlineForDepartment, getOnlineForDepartment } from './departmentsLib'; import { livechatLogger } from './logger'; -import { settings } from '../../../settings/server'; +import { settings } from '../../settings'; export async function getOnlineAgents(department?: string, agent?: SelectedAgent | null): Promise | undefined> { if (agent?.agentId) { diff --git a/apps/meteor/app/livechat/server/lib/settings.ts b/apps/meteor/server/lib/omnichannel/settings.ts similarity index 97% rename from apps/meteor/app/livechat/server/lib/settings.ts rename to apps/meteor/server/lib/omnichannel/settings.ts index f4a917b966d7a..32fd2e7fb0bff 100644 --- a/apps/meteor/app/livechat/server/lib/settings.ts +++ b/apps/meteor/server/lib/omnichannel/settings.ts @@ -1,7 +1,7 @@ import { OmnichannelSortingMechanismSettingType } from '@rocket.chat/core-typings'; import { showConnecting } from './utils'; -import { settings } from '../../../settings/server'; +import { settings } from '../../settings'; export const getInquirySortMechanismSetting = (): OmnichannelSortingMechanismSettingType => settings.get('Omnichannel_sorting_mechanism') || OmnichannelSortingMechanismSettingType.Timestamp; diff --git a/apps/meteor/app/livechat/server/startup.ts b/apps/meteor/server/lib/omnichannel/startup.ts similarity index 85% rename from apps/meteor/app/livechat/server/startup.ts rename to apps/meteor/server/lib/omnichannel/startup.ts index 7251eded9df66..010b983039a38 100644 --- a/apps/meteor/app/livechat/server/startup.ts +++ b/apps/meteor/server/lib/omnichannel/startup.ts @@ -9,18 +9,18 @@ import { Meteor } from 'meteor/meteor'; import { businessHourManager } from './business-hour'; import { createDefaultBusinessHourIfNotExists } from './business-hour/Helper'; -import { setUserStatusLivechatIf } from './lib/utils'; import { LivechatAgentActivityMonitor } from './statistics/LivechatAgentActivityMonitor'; -import { maybeMigrateLivechatRoom } from '../../../server/api/lib/maybeMigrateLivechatRoom'; -import { hasPermissionAsync } from '../../../server/lib/authorization/hasPermission'; -import { callbacks } from '../../../server/lib/callbacks'; -import { beforeLeaveRoomCallback } from '../../../server/lib/callbacks/beforeLeaveRoomCallback'; -import { i18n } from '../../../server/lib/i18n'; -import { roomCoordinator } from '../../../server/lib/rooms/roomCoordinator'; -import { notifyOnUserChange } from '../../lib/server/lib/notifyListener'; -import { settings } from '../../settings/server'; +import { setUserStatusLivechatIf } from './utils'; +import { maybeMigrateLivechatRoom } from '../../api/lib/maybeMigrateLivechatRoom'; +import { settings } from '../../settings'; +import { hasPermissionAsync } from '../authorization/hasPermission'; +import { callbacks } from '../callbacks'; +import { beforeLeaveRoomCallback } from '../callbacks/beforeLeaveRoomCallback'; +import { i18n } from '../i18n'; +import { notifyOnUserChange } from '../notifyListener'; +import { roomCoordinator } from '../rooms/roomCoordinator'; import './roomAccessValidator.internalService'; -import { ContactMerger, type FieldAndValue } from './lib/contacts/ContactMerger'; +import { ContactMerger, type FieldAndValue } from './contacts/ContactMerger'; const logger = new Logger('LivechatStartup'); diff --git a/apps/meteor/app/livechat/server/statistics/LivechatAgentActivityMonitor.ts b/apps/meteor/server/lib/omnichannel/statistics/LivechatAgentActivityMonitor.ts similarity index 98% rename from apps/meteor/app/livechat/server/statistics/LivechatAgentActivityMonitor.ts rename to apps/meteor/server/lib/omnichannel/statistics/LivechatAgentActivityMonitor.ts index dc112b33c28ae..fd5f273d57dc9 100644 --- a/apps/meteor/app/livechat/server/statistics/LivechatAgentActivityMonitor.ts +++ b/apps/meteor/server/lib/omnichannel/statistics/LivechatAgentActivityMonitor.ts @@ -4,7 +4,7 @@ import { LivechatAgentActivity, Sessions, Users } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; import moment from 'moment'; -import { callbacks } from '../../../../server/lib/callbacks'; +import { callbacks } from '../../callbacks'; const formatDate = (dateTime = new Date()): { date: number } => ({ date: parseInt(moment(dateTime).format('YYYYMMDD')), diff --git a/apps/meteor/app/livechat/server/lib/stream/agentStatus.ts b/apps/meteor/server/lib/omnichannel/stream/agentStatus.ts similarity index 96% rename from apps/meteor/app/livechat/server/lib/stream/agentStatus.ts rename to apps/meteor/server/lib/omnichannel/stream/agentStatus.ts index 07e4f8c5ce7d8..7fb615bd68f88 100644 --- a/apps/meteor/app/livechat/server/lib/stream/agentStatus.ts +++ b/apps/meteor/server/lib/omnichannel/stream/agentStatus.ts @@ -1,6 +1,6 @@ import { Logger } from '@rocket.chat/logger'; -import { settings } from '../../../../settings/server'; +import { settings } from '../../../settings'; import { closeOpenChats } from '../closeRoom'; import { forwardOpenChats } from '../transfer'; diff --git a/apps/meteor/app/livechat/server/lib/takeInquiry.ts b/apps/meteor/server/lib/omnichannel/takeInquiry.ts similarity index 97% rename from apps/meteor/app/livechat/server/lib/takeInquiry.ts rename to apps/meteor/server/lib/omnichannel/takeInquiry.ts index ae2298bea9504..047d25ab815bd 100644 --- a/apps/meteor/app/livechat/server/lib/takeInquiry.ts +++ b/apps/meteor/server/lib/omnichannel/takeInquiry.ts @@ -5,7 +5,7 @@ import { Meteor } from 'meteor/meteor'; import { RoutingManager } from './RoutingManager'; import { isAgentAvailableToTakeContactInquiry } from './contacts/isAgentAvailableToTakeContactInquiry'; import { migrateVisitorIfMissingContact } from './contacts/migrateVisitorIfMissingContact'; -import { settings } from '../../../settings/server'; +import { settings } from '../../settings'; export const takeInquiry = async ( userId: string, diff --git a/apps/meteor/app/livechat/server/lib/tracking.ts b/apps/meteor/server/lib/omnichannel/tracking.ts similarity index 96% rename from apps/meteor/app/livechat/server/lib/tracking.ts rename to apps/meteor/server/lib/omnichannel/tracking.ts index ef42ff6661e53..a9a0f28236300 100644 --- a/apps/meteor/app/livechat/server/lib/tracking.ts +++ b/apps/meteor/server/lib/omnichannel/tracking.ts @@ -2,7 +2,7 @@ import { Message } from '@rocket.chat/core-services'; import { Users } from '@rocket.chat/models'; import { livechatLogger } from './logger'; -import { settings } from '../../../settings/server'; +import { settings } from '../../settings'; type PageInfo = { title: string; location: { href: string }; change: string }; diff --git a/apps/meteor/app/livechat/server/lib/transfer.ts b/apps/meteor/server/lib/omnichannel/transfer.ts similarity index 100% rename from apps/meteor/app/livechat/server/lib/transfer.ts rename to apps/meteor/server/lib/omnichannel/transfer.ts diff --git a/apps/meteor/app/livechat/server/lib/utils.ts b/apps/meteor/server/lib/omnichannel/utils.ts similarity index 90% rename from apps/meteor/app/livechat/server/lib/utils.ts rename to apps/meteor/server/lib/omnichannel/utils.ts index 45e5d58e1dc4b..6516a63639e49 100644 --- a/apps/meteor/app/livechat/server/lib/utils.ts +++ b/apps/meteor/server/lib/omnichannel/utils.ts @@ -4,10 +4,10 @@ import { Users } from '@rocket.chat/models'; import type { Filter } from 'mongodb'; import { RoutingManager } from './RoutingManager'; +import { businessHourManager } from './business-hour'; import type { AKeyOf } from './localTypes'; -import { callbacks } from '../../../../server/lib/callbacks'; -import { notifyOnUserChange } from '../../../lib/server/lib/notifyListener'; -import { businessHourManager } from '../business-hour'; +import { callbacks } from '../callbacks'; +import { notifyOnUserChange } from '../notifyListener'; export function showConnecting() { return RoutingManager.getConfig()?.showConnecting || false; diff --git a/apps/meteor/app/livechat/server/lib/webhooks.ts b/apps/meteor/server/lib/omnichannel/webhooks.ts similarity index 95% rename from apps/meteor/app/livechat/server/lib/webhooks.ts rename to apps/meteor/server/lib/omnichannel/webhooks.ts index a4621bbecf957..85f9dc0b4148a 100644 --- a/apps/meteor/app/livechat/server/lib/webhooks.ts +++ b/apps/meteor/server/lib/omnichannel/webhooks.ts @@ -2,8 +2,8 @@ import { serverFetch as fetch } from '@rocket.chat/server-fetch'; import type { Response } from '@rocket.chat/server-fetch'; import { webhooksLogger } from './logger'; -import { metrics } from '../../../../server/lib/metrics'; -import { settings } from '../../../settings/server'; +import { settings } from '../../settings'; +import { metrics } from '../metrics'; const isRetryable = (status: number): boolean => status >= 500 || status === 429; diff --git a/apps/meteor/server/lib/openRoom.ts b/apps/meteor/server/lib/openRoom.ts index cf5b615bde09a..646927950b84c 100644 --- a/apps/meteor/server/lib/openRoom.ts +++ b/apps/meteor/server/lib/openRoom.ts @@ -1,6 +1,6 @@ import { Subscriptions } from '@rocket.chat/models'; -import { notifyOnSubscriptionChangedByRoomIdAndUserId } from '../../app/lib/server/lib/notifyListener'; +import { notifyOnSubscriptionChangedByRoomIdAndUserId } from './notifyListener'; export async function openRoom(userId: string, roomId: string) { const openByRoomResponse = await Subscriptions.openByRoomIdAndUserId(roomId, userId); diff --git a/apps/meteor/server/lib/pushConfig.ts b/apps/meteor/server/lib/pushConfig.ts index 8c86aa7f11475..a61b32cba5588 100644 --- a/apps/meteor/server/lib/pushConfig.ts +++ b/apps/meteor/server/lib/pushConfig.ts @@ -3,11 +3,11 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { PushToken } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; +import { RateLimiterClass as RateLimiter } from './RateLimiter'; import { hasPermissionAsync } from './authorization/hasPermission'; import { i18n } from './i18n'; +import { settings } from '../settings'; import { Push } from './notifications/push'; -import { RateLimiter } from '../../app/lib/server/lib'; -import { settings } from '../../app/settings/server'; export const executePushTest = async (userId: IUser['_id'], username: IUser['username']): Promise => { const tokens = await PushToken.countTokensByUserId(userId); diff --git a/apps/meteor/server/lib/readMessages.ts b/apps/meteor/server/lib/readMessages.ts index 012effab076b6..774a902f1cd3a 100644 --- a/apps/meteor/server/lib/readMessages.ts +++ b/apps/meteor/server/lib/readMessages.ts @@ -2,7 +2,7 @@ import type { IRoom, IUser } from '@rocket.chat/core-typings'; import { NotificationQueue, Subscriptions } from '@rocket.chat/models'; import { callbacks } from './callbacks'; -import { notifyOnSubscriptionChangedByRoomIdAndUserId } from '../../app/lib/server/lib/notifyListener'; +import { notifyOnSubscriptionChangedByRoomIdAndUserId } from './notifyListener'; export async function readMessages(room: IRoom, uid: IUser['_id'], readThreads: boolean): Promise { await callbacks.run('beforeReadMessages', room._id, uid); diff --git a/apps/meteor/server/lib/resetUserE2EKey.ts b/apps/meteor/server/lib/resetUserE2EKey.ts index dab5bb90d9dce..6f50e9d96c028 100644 --- a/apps/meteor/server/lib/resetUserE2EKey.ts +++ b/apps/meteor/server/lib/resetUserE2EKey.ts @@ -5,8 +5,8 @@ import { Meteor } from 'meteor/meteor'; import { i18n } from './i18n'; import { isUserIdFederated } from './isUserIdFederated'; import * as Mailer from './notifications/email/api'; -import { notifyOnUserChange, notifyOnSubscriptionChangedByUserId } from '../../app/lib/server/lib/notifyListener'; -import { settings } from '../../app/settings/server'; +import { notifyOnUserChange, notifyOnSubscriptionChangedByUserId } from './notifyListener'; +import { settings } from '../settings'; const sendResetNotification = async function (uid: string): Promise { const user = await Users.findOneById(uid, {}); diff --git a/apps/meteor/server/lib/roles/addUserRoles.ts b/apps/meteor/server/lib/roles/addUserRoles.ts index 4e098b6fc4477..f5d0d6b060a68 100644 --- a/apps/meteor/server/lib/roles/addUserRoles.ts +++ b/apps/meteor/server/lib/roles/addUserRoles.ts @@ -4,7 +4,7 @@ import { Roles, Subscriptions, Users } from '@rocket.chat/models'; import { syncRoomRolePriorityForUserAndRoom } from './syncRoomRolePriority'; import { validateRoleList } from './validateRoleList'; -import { notifyOnSubscriptionChangedByRoomIdAndUserId } from '../../../app/lib/server/lib/notifyListener'; +import { notifyOnSubscriptionChangedByRoomIdAndUserId } from '../notifyListener'; export const addUserRolesAsync = async (userId: IUser['_id'], roles: IRole['_id'][], scope?: IRoom['_id']): Promise => { if (!userId || !roles?.length) { diff --git a/apps/meteor/server/lib/roles/getRoomRoles.ts b/apps/meteor/server/lib/roles/getRoomRoles.ts index 454404d82604e..7fa2f1316dd72 100644 --- a/apps/meteor/server/lib/roles/getRoomRoles.ts +++ b/apps/meteor/server/lib/roles/getRoomRoles.ts @@ -2,7 +2,7 @@ import type { IRoom } from '@rocket.chat/core-typings'; import { Roles, Subscriptions, Users } from '@rocket.chat/models'; import _ from 'underscore'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; export type RoomRoles = { rid: IRoom['_id']; diff --git a/apps/meteor/server/lib/roles/removeUserFromRoles.ts b/apps/meteor/server/lib/roles/removeUserFromRoles.ts index db4bdab48413f..c48787c94473c 100644 --- a/apps/meteor/server/lib/roles/removeUserFromRoles.ts +++ b/apps/meteor/server/lib/roles/removeUserFromRoles.ts @@ -4,7 +4,7 @@ import { Users, Subscriptions, Roles } from '@rocket.chat/models'; import { syncRoomRolePriorityForUserAndRoom } from './syncRoomRolePriority'; import { validateRoleList } from './validateRoleList'; -import { notifyOnSubscriptionChangedByRoomIdAndUserId } from '../../../app/lib/server/lib/notifyListener'; +import { notifyOnSubscriptionChangedByRoomIdAndUserId } from '../notifyListener'; export const removeUserFromRolesAsync = async (userId: IUser['_id'], roles: IRole['_id'][], scope?: IRoom['_id']): Promise => { if (!userId || !roles) { diff --git a/apps/meteor/server/lib/rooms/acceptRoomInvite.ts b/apps/meteor/server/lib/rooms/acceptRoomInvite.ts index f8e55851a1563..730042b74251c 100644 --- a/apps/meteor/server/lib/rooms/acceptRoomInvite.ts +++ b/apps/meteor/server/lib/rooms/acceptRoomInvite.ts @@ -5,8 +5,8 @@ import type { IUser, IRoom, ISubscription } from '@rocket.chat/core-typings'; import { Subscriptions, Users } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { notifyOnSubscriptionChangedById } from '../../../app/lib/server/lib/notifyListener'; import { callbacks } from '../callbacks'; +import { notifyOnSubscriptionChangedById } from '../notifyListener'; /** * Accepts a room invite when triggered by internal events such as federation diff --git a/apps/meteor/server/lib/rooms/addUserToDefaultChannels.ts b/apps/meteor/server/lib/rooms/addUserToDefaultChannels.ts index aea11ad46bb96..2a46aff88d514 100644 --- a/apps/meteor/server/lib/rooms/addUserToDefaultChannels.ts +++ b/apps/meteor/server/lib/rooms/addUserToDefaultChannels.ts @@ -3,11 +3,11 @@ import type { IUser } from '@rocket.chat/core-typings'; import { Subscriptions } from '@rocket.chat/models'; import { getDefaultChannels } from './getDefaultChannels'; -import { notifyOnSubscriptionChangedById } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; -import { getDefaultSubscriptionPref } from '../../../app/utils/lib/getDefaultSubscriptionPref'; +import { settings } from '../../settings'; import { callbacks } from '../callbacks'; import { getSubscriptionAutotranslateDefaultConfig } from '../getSubscriptionAutotranslateDefaultConfig'; +import { notifyOnSubscriptionChangedById } from '../notifyListener'; +import { getDefaultSubscriptionPref } from '../utils/lib/getDefaultSubscriptionPref'; export const addUserToDefaultChannels = async function (user: IUser, silenced?: boolean): Promise { await callbacks.run('beforeJoinDefaultChannels', user); diff --git a/apps/meteor/server/lib/rooms/addUserToRoom.ts b/apps/meteor/server/lib/rooms/addUserToRoom.ts index 6a278b2bf6c0b..1ac5cae7ad01e 100644 --- a/apps/meteor/server/lib/rooms/addUserToRoom.ts +++ b/apps/meteor/server/lib/rooms/addUserToRoom.ts @@ -8,10 +8,10 @@ import { Meteor } from 'meteor/meteor'; import { RoomMemberActions } from '../../../definition/IRoomTypeConfig'; import { callbacks } from '../callbacks'; import { roomCoordinator } from './roomCoordinator'; -import { notifyOnRoomChangedById, notifyOnSubscriptionChanged } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; import { beforeAddUserToRoom as beforeAddUserToRoomPatch } from '../../hooks/rooms/beforeAddUserToRoom'; +import { settings } from '../../settings'; import { beforeAddUserToRoom } from '../callbacks/beforeAddUserToRoom'; +import { notifyOnRoomChangedById, notifyOnSubscriptionChanged } from '../notifyListener'; /** * This function adds user to the given room. diff --git a/apps/meteor/server/lib/rooms/archiveRoom.ts b/apps/meteor/server/lib/rooms/archiveRoom.ts index d35d84e93bb99..f6781d99c07f5 100644 --- a/apps/meteor/server/lib/rooms/archiveRoom.ts +++ b/apps/meteor/server/lib/rooms/archiveRoom.ts @@ -2,8 +2,8 @@ import { Message } from '@rocket.chat/core-services'; import type { IMessage } from '@rocket.chat/core-typings'; import { Rooms, Subscriptions } from '@rocket.chat/models'; -import { notifyOnRoomChanged, notifyOnSubscriptionChangedByRoomId } from '../../../app/lib/server/lib/notifyListener'; import { callbacks } from '../callbacks'; +import { notifyOnRoomChanged, notifyOnSubscriptionChangedByRoomId } from '../notifyListener'; export const archiveRoom = async function (rid: string, user: IMessage['u']): Promise { await Rooms.archiveById(rid); diff --git a/apps/meteor/server/lib/rooms/banUserFromRoom.ts b/apps/meteor/server/lib/rooms/banUserFromRoom.ts index b33b8a0ad04ec..b68b9833fa671 100644 --- a/apps/meteor/server/lib/rooms/banUserFromRoom.ts +++ b/apps/meteor/server/lib/rooms/banUserFromRoom.ts @@ -3,8 +3,8 @@ import { isBannedSubscription } from '@rocket.chat/core-typings'; import type { IRoom, IUser } from '@rocket.chat/core-typings'; import { Rooms, Subscriptions, Users } from '@rocket.chat/models'; -import { notifyOnRoomChangedById, notifyOnSubscriptionChanged } from '../../../app/lib/server/lib/notifyListener'; import { afterBanFromRoomCallback } from '../callbacks/afterBanFromRoomCallback'; +import { notifyOnRoomChangedById, notifyOnSubscriptionChanged } from '../notifyListener'; import { removeUserFromRolesAsync } from '../roles/removeUserFromRoles'; /** diff --git a/apps/meteor/server/lib/rooms/cleanRoomHistory.ts b/apps/meteor/server/lib/rooms/cleanRoomHistory.ts index 69879a78ebbc3..db4d4390d8e05 100644 --- a/apps/meteor/server/lib/rooms/cleanRoomHistory.ts +++ b/apps/meteor/server/lib/rooms/cleanRoomHistory.ts @@ -3,10 +3,10 @@ import type { IRoom } from '@rocket.chat/core-typings'; import { Messages, Rooms, Subscriptions, ReadReceipts, ReadReceiptsArchive } from '@rocket.chat/models'; import { deleteRoom } from './deleteRoom'; -import { notifyOnRoomChangedById, notifyOnSubscriptionChangedById } from '../../../app/lib/server/lib/notifyListener'; import { NOTIFICATION_ATTACHMENT_COLOR } from '../../../lib/constants'; import { i18n } from '../i18n'; import { FileUpload } from '../media/file-upload'; +import { notifyOnRoomChangedById, notifyOnSubscriptionChangedById } from '../notifyListener'; const FILE_CLEANUP_BATCH_SIZE = 1000; diff --git a/apps/meteor/server/lib/rooms/createDirectRoom.ts b/apps/meteor/server/lib/rooms/createDirectRoom.ts index 2b5d1708d83fa..851ce50cd43d9 100644 --- a/apps/meteor/server/lib/rooms/createDirectRoom.ts +++ b/apps/meteor/server/lib/rooms/createDirectRoom.ts @@ -8,11 +8,11 @@ import { isTruthy } from '@rocket.chat/tools'; import { Meteor } from 'meteor/meteor'; import type { MatchKeysAndValues } from 'mongodb'; -import { notifyOnRoomChangedById, notifyOnSubscriptionChangedByRoomIdAndUserId } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; -import { getDefaultSubscriptionPref } from '../../../app/utils/lib/getDefaultSubscriptionPref'; import { getNameForDMs } from '../../services/room/getNameForDMs'; +import { settings } from '../../settings'; import { callbacks } from '../callbacks'; +import { notifyOnRoomChangedById, notifyOnSubscriptionChangedByRoomIdAndUserId } from '../notifyListener'; +import { getDefaultSubscriptionPref } from '../utils/lib/getDefaultSubscriptionPref'; const generateSubscription = ( fname: string, diff --git a/apps/meteor/server/lib/rooms/createRoom.ts b/apps/meteor/server/lib/rooms/createRoom.ts index 83e9575646b9f..90a11ddc3f704 100644 --- a/apps/meteor/server/lib/rooms/createRoom.ts +++ b/apps/meteor/server/lib/rooms/createRoom.ts @@ -7,15 +7,15 @@ import { Rooms, Subscriptions, Users } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; import { createDirectRoom } from './createDirectRoom'; -import { notifyOnRoomChanged, notifyOnSubscriptionChangedById } from '../../../app/lib/server/lib/notifyListener'; -import { getDefaultSubscriptionPref } from '../../../app/utils/lib/getDefaultSubscriptionPref'; -import { getValidRoomName } from '../../../app/utils/server/lib/getValidRoomName'; import { calculateRoomRolePriorityFromRoles } from '../../../lib/roles/calculateRoomRolePriorityFromRoles'; import { callbacks } from '../callbacks'; import { beforeAddUserToRoom } from '../callbacks/beforeAddUserToRoom'; import { beforeCreateRoomCallback, prepareCreateRoomCallback } from '../callbacks/beforeCreateRoomCallback'; import { getSubscriptionAutotranslateDefaultConfig } from '../getSubscriptionAutotranslateDefaultConfig'; +import { notifyOnRoomChanged, notifyOnSubscriptionChangedById } from '../notifyListener'; import { syncRoomRolePriorityForUserAndRoom } from '../roles/syncRoomRolePriority'; +import { getDefaultSubscriptionPref } from '../utils/lib/getDefaultSubscriptionPref'; +import { getValidRoomName } from '../utils/lib/getValidRoomName'; const isValidName = (name: unknown): name is string => { return typeof name === 'string' && name.trim().length > 0; diff --git a/apps/meteor/server/lib/rooms/deleteRoom.ts b/apps/meteor/server/lib/rooms/deleteRoom.ts index 5b2d03c1aa561..f7ff9ac96f1e0 100644 --- a/apps/meteor/server/lib/rooms/deleteRoom.ts +++ b/apps/meteor/server/lib/rooms/deleteRoom.ts @@ -1,8 +1,8 @@ import { Messages, Rooms, Subscriptions } from '@rocket.chat/models'; -import { notifyOnRoomChangedById, notifyOnSubscriptionChanged } from '../../../app/lib/server/lib/notifyListener'; import { callbacks } from '../callbacks'; import { FileUpload } from '../media/file-upload'; +import { notifyOnRoomChangedById, notifyOnSubscriptionChanged } from '../notifyListener'; export const deleteRoom = async function (rid: string): Promise { await FileUpload.removeFilesByRoomId(rid); diff --git a/apps/meteor/server/lib/rooms/executeUnbanUserFromRoom.ts b/apps/meteor/server/lib/rooms/executeUnbanUserFromRoom.ts index 471d25eb84035..e6625f689fa53 100644 --- a/apps/meteor/server/lib/rooms/executeUnbanUserFromRoom.ts +++ b/apps/meteor/server/lib/rooms/executeUnbanUserFromRoom.ts @@ -2,8 +2,8 @@ import { Message } from '@rocket.chat/core-services'; import { isBannedSubscription, isInviteSubscription, type IUser } from '@rocket.chat/core-typings'; import { Rooms, Subscriptions, Users } from '@rocket.chat/models'; -import { notifyOnRoomChangedById, notifyOnSubscriptionChanged } from '../../../app/lib/server/lib/notifyListener'; import { afterUnbanFromRoomCallback } from '../callbacks/afterUnbanFromRoomCallback'; +import { notifyOnRoomChangedById, notifyOnSubscriptionChanged } from '../notifyListener'; export const executeUnbanUserFromRoom = async function (rid: string, user: IUser, byUser: IUser): Promise { const room = await Rooms.findOneById(rid); diff --git a/apps/meteor/server/lib/rooms/getRoomsWithSingleOwner.ts b/apps/meteor/server/lib/rooms/getRoomsWithSingleOwner.ts index 55fdfd9ce8607..1fa596c67b0cf 100644 --- a/apps/meteor/server/lib/rooms/getRoomsWithSingleOwner.ts +++ b/apps/meteor/server/lib/rooms/getRoomsWithSingleOwner.ts @@ -1,7 +1,7 @@ import type { IUser } from '@rocket.chat/core-typings'; import { Subscriptions, Users } from '@rocket.chat/models'; -import { subscriptionHasRole } from '../../../app/authorization/server'; +import { subscriptionHasRole } from '../authorization'; export type SubscribedRoomsForUserWithDetails = { rid: string; diff --git a/apps/meteor/app/invites/server/functions/findOrCreateInvite.ts b/apps/meteor/server/lib/rooms/invites/findOrCreateInvite.ts similarity index 92% rename from apps/meteor/app/invites/server/functions/findOrCreateInvite.ts rename to apps/meteor/server/lib/rooms/invites/findOrCreateInvite.ts index 6805c4ac5eec8..1c7f543283aeb 100644 --- a/apps/meteor/app/invites/server/functions/findOrCreateInvite.ts +++ b/apps/meteor/server/lib/rooms/invites/findOrCreateInvite.ts @@ -5,10 +5,10 @@ import { Random } from '@rocket.chat/random'; import { Meteor } from 'meteor/meteor'; import { RoomMemberActions } from '../../../../definition/IRoomTypeConfig'; -import { hasPermissionAsync } from '../../../../server/lib/authorization/hasPermission'; -import { roomCoordinator } from '../../../../server/lib/rooms/roomCoordinator'; -import { settings } from '../../../settings/server'; -import { getURL } from '../../../utils/server/getURL'; +import { settings } from '../../../settings'; +import { hasPermissionAsync } from '../../authorization/hasPermission'; +import { getURL } from '../../utils/getURL'; +import { roomCoordinator } from '../roomCoordinator'; function getInviteUrl(invite: Omit) { const { _id } = invite; diff --git a/apps/meteor/app/invites/server/functions/listInvites.ts b/apps/meteor/server/lib/rooms/invites/listInvites.ts similarity index 82% rename from apps/meteor/app/invites/server/functions/listInvites.ts rename to apps/meteor/server/lib/rooms/invites/listInvites.ts index 604717656674f..cc43976f1a72f 100644 --- a/apps/meteor/app/invites/server/functions/listInvites.ts +++ b/apps/meteor/server/lib/rooms/invites/listInvites.ts @@ -1,7 +1,7 @@ import { Invites } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { hasPermissionAsync } from '../../../../server/lib/authorization/hasPermission'; +import { hasPermissionAsync } from '../../authorization/hasPermission'; export const listInvites = async (userId: string) => { if (!userId) { diff --git a/apps/meteor/app/invites/server/functions/removeInvite.ts b/apps/meteor/server/lib/rooms/invites/removeInvite.ts similarity index 89% rename from apps/meteor/app/invites/server/functions/removeInvite.ts rename to apps/meteor/server/lib/rooms/invites/removeInvite.ts index 9bfea0ef5b890..6be41578adbf5 100644 --- a/apps/meteor/app/invites/server/functions/removeInvite.ts +++ b/apps/meteor/server/lib/rooms/invites/removeInvite.ts @@ -2,7 +2,7 @@ import type { IInvite } from '@rocket.chat/core-typings'; import { Invites } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { hasPermissionAsync } from '../../../../server/lib/authorization/hasPermission'; +import { hasPermissionAsync } from '../../authorization/hasPermission'; export const removeInvite = async (userId: string, invite: Pick) => { if (!userId || !invite) { diff --git a/apps/meteor/app/invites/server/functions/sendInvitationEmail.ts b/apps/meteor/server/lib/rooms/invites/sendInvitationEmail.ts similarity index 84% rename from apps/meteor/app/invites/server/functions/sendInvitationEmail.ts rename to apps/meteor/server/lib/rooms/invites/sendInvitationEmail.ts index a63ebfab32a2c..dc4f25f87df77 100644 --- a/apps/meteor/app/invites/server/functions/sendInvitationEmail.ts +++ b/apps/meteor/server/lib/rooms/invites/sendInvitationEmail.ts @@ -2,10 +2,10 @@ import { Settings } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { hasPermissionAsync } from '../../../../server/lib/authorization/hasPermission'; -import * as Mailer from '../../../../server/lib/notifications/email/api'; -import { notifyOnSettingChanged } from '../../../lib/server/lib/notifyListener'; -import { settings } from '../../../settings/server'; +import { settings } from '../../../settings'; +import { hasPermissionAsync } from '../../authorization/hasPermission'; +import * as Mailer from '../../notifications/email/api'; +import { notifyOnSettingChanged } from '../../notifyListener'; let html = ''; Meteor.startup(() => { diff --git a/apps/meteor/app/invites/server/functions/useInviteToken.ts b/apps/meteor/server/lib/rooms/invites/useInviteToken.ts similarity index 92% rename from apps/meteor/app/invites/server/functions/useInviteToken.ts rename to apps/meteor/server/lib/rooms/invites/useInviteToken.ts index e90c8c8f13338..837700a61a8b7 100644 --- a/apps/meteor/app/invites/server/functions/useInviteToken.ts +++ b/apps/meteor/server/lib/rooms/invites/useInviteToken.ts @@ -4,8 +4,8 @@ import { Meteor } from 'meteor/meteor'; import { validateInviteToken } from './validateInviteToken'; import { RoomMemberActions } from '../../../../definition/IRoomTypeConfig'; -import { addUserToRoom } from '../../../../server/lib/rooms/addUserToRoom'; -import { roomCoordinator } from '../../../../server/lib/rooms/roomCoordinator'; +import { addUserToRoom } from '../addUserToRoom'; +import { roomCoordinator } from '../roomCoordinator'; export const useInviteToken = async (userId: string, token: string) => { if (!userId) { diff --git a/apps/meteor/app/invites/server/functions/validateInviteToken.ts b/apps/meteor/server/lib/rooms/invites/validateInviteToken.ts similarity index 96% rename from apps/meteor/app/invites/server/functions/validateInviteToken.ts rename to apps/meteor/server/lib/rooms/invites/validateInviteToken.ts index 22517643fd800..9b071ea8539a1 100644 --- a/apps/meteor/app/invites/server/functions/validateInviteToken.ts +++ b/apps/meteor/server/lib/rooms/invites/validateInviteToken.ts @@ -1,7 +1,7 @@ import { Invites, Rooms } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../settings/server'; +import { settings } from '../../../settings'; export const validateInviteToken = async (token: string) => { if (!token || typeof token !== 'string') { diff --git a/apps/meteor/server/lib/rooms/relinquishRoomOwnerships.ts b/apps/meteor/server/lib/rooms/relinquishRoomOwnerships.ts index d03dd0698a932..cdfd1bb214fca 100644 --- a/apps/meteor/server/lib/rooms/relinquishRoomOwnerships.ts +++ b/apps/meteor/server/lib/rooms/relinquishRoomOwnerships.ts @@ -2,9 +2,9 @@ import type { IRoom } from '@rocket.chat/core-typings'; import { Messages, Rooms, Subscriptions, ReadReceipts, ReadReceiptsArchive, Team } from '@rocket.chat/models'; import type { SubscribedRoomsForUserWithDetails } from './getRoomsWithSingleOwner'; -import { notifyOnSubscriptionChanged } from '../../../app/lib/server/lib/notifyListener'; import { eraseRoomLooseValidation, eraseTeamOnRelinquishRoomOwnerships } from '../../api/lib/eraseTeam'; import { FileUpload } from '../media/file-upload'; +import { notifyOnSubscriptionChanged } from '../notifyListener'; import { addUserRolesAsync } from '../roles/addUserRoles'; const bulkTeamCleanup = async (rids: IRoom['_id'][]) => { diff --git a/apps/meteor/server/lib/rooms/removeUserFromRoom.ts b/apps/meteor/server/lib/rooms/removeUserFromRoom.ts index cc2c11172b1d3..58da007bf3f32 100644 --- a/apps/meteor/server/lib/rooms/removeUserFromRoom.ts +++ b/apps/meteor/server/lib/rooms/removeUserFromRoom.ts @@ -5,10 +5,10 @@ import type { IRoom, IUser, MessageTypesValues } from '@rocket.chat/core-typings import { Subscriptions, Rooms } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { notifyOnRoomChangedById, notifyOnSubscriptionChanged } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; import { afterLeaveRoomCallback } from '../callbacks/afterLeaveRoomCallback'; import { beforeLeaveRoomCallback } from '../callbacks/beforeLeaveRoomCallback'; +import { notifyOnRoomChangedById, notifyOnSubscriptionChanged } from '../notifyListener'; /** * Removes a user from a room when triggered by federation or other external events. diff --git a/apps/meteor/app/retention-policy/server/cronPruneMessages.ts b/apps/meteor/server/lib/rooms/retention/cronPruneMessages.ts similarity index 95% rename from apps/meteor/app/retention-policy/server/cronPruneMessages.ts rename to apps/meteor/server/lib/rooms/retention/cronPruneMessages.ts index db8d137db7667..dedec14c23512 100644 --- a/apps/meteor/app/retention-policy/server/cronPruneMessages.ts +++ b/apps/meteor/server/lib/rooms/retention/cronPruneMessages.ts @@ -2,9 +2,9 @@ import type { IRoomWithRetentionPolicy } from '@rocket.chat/core-typings'; import { cronJobs } from '@rocket.chat/cron'; import { Rooms } from '@rocket.chat/models'; -import { getCronAdvancedTimerFromPrecisionSetting } from '../../../lib/getCronAdvancedTimerFromPrecisionSetting'; -import { cleanRoomHistory } from '../../../server/lib/rooms/cleanRoomHistory'; -import { settings } from '../../settings/server'; +import { getCronAdvancedTimerFromPrecisionSetting } from '../../../../lib/getCronAdvancedTimerFromPrecisionSetting'; +import { settings } from '../../../settings'; +import { cleanRoomHistory } from '../cleanRoomHistory'; type RetentionRoomTypes = 'c' | 'p' | 'd'; diff --git a/apps/meteor/app/retention-policy/server/index.ts b/apps/meteor/server/lib/rooms/retention/index.ts similarity index 100% rename from apps/meteor/app/retention-policy/server/index.ts rename to apps/meteor/server/lib/rooms/retention/index.ts diff --git a/apps/meteor/server/lib/rooms/roomCoordinator.ts b/apps/meteor/server/lib/rooms/roomCoordinator.ts index b258ef2513d5f..dbec195abed4c 100644 --- a/apps/meteor/server/lib/rooms/roomCoordinator.ts +++ b/apps/meteor/server/lib/rooms/roomCoordinator.ts @@ -2,9 +2,9 @@ import { getUserDisplayName } from '@rocket.chat/core-typings'; import type { IRoom, RoomType, IUser, IMessage, ValueOf, AtLeast, IUpload } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; -import { settings } from '../../../app/settings/server'; import type { IRoomTypeConfig, IRoomTypeServerDirectives, RoomSettingsEnum, RoomMemberActions } from '../../../definition/IRoomTypeConfig'; import { RoomCoordinator } from '../../../lib/rooms/coordinator'; +import { settings } from '../../settings'; class RoomCoordinatorServer extends RoomCoordinator { add(roomConfig: IRoomTypeConfig, directives: Partial): void { diff --git a/apps/meteor/server/lib/rooms/roomTypes/direct.ts b/apps/meteor/server/lib/rooms/roomTypes/direct.ts index a4f68b85a898b..7ae02a131521b 100644 --- a/apps/meteor/server/lib/rooms/roomTypes/direct.ts +++ b/apps/meteor/server/lib/rooms/roomTypes/direct.ts @@ -2,11 +2,11 @@ import type { AtLeast } from '@rocket.chat/core-typings'; import { isRoomFederated, isRoomNativeFederated } from '@rocket.chat/core-typings'; import { Subscriptions } from '@rocket.chat/models'; -import { settings } from '../../../../app/settings/server'; import type { IRoomTypeServerDirectives } from '../../../../definition/IRoomTypeConfig'; import { RoomSettingsEnum, RoomMemberActions } from '../../../../definition/IRoomTypeConfig'; import { getDirectMessageRoomType } from '../../../../lib/rooms/roomTypes/direct'; import { isFederationEnabled } from '../../../services/federation/utils'; +import { settings } from '../../../settings'; import { roomCoordinator } from '../roomCoordinator'; const DirectMessageRoomType = getDirectMessageRoomType(roomCoordinator); diff --git a/apps/meteor/server/lib/rooms/roomTypes/private.ts b/apps/meteor/server/lib/rooms/roomTypes/private.ts index 5349c1da133d2..926d1e3ba7a2d 100644 --- a/apps/meteor/server/lib/rooms/roomTypes/private.ts +++ b/apps/meteor/server/lib/rooms/roomTypes/private.ts @@ -1,10 +1,10 @@ import type { IRoom } from '@rocket.chat/core-typings'; import { isRoomFederated, isRoomNativeFederated } from '@rocket.chat/core-typings'; -import { settings } from '../../../../app/settings/server'; import { RoomSettingsEnum, RoomMemberActions } from '../../../../definition/IRoomTypeConfig'; import { getPrivateRoomType } from '../../../../lib/rooms/roomTypes/private'; import { isFederationEnabled } from '../../../services/federation/utils'; +import { settings } from '../../../settings'; import { roomCoordinator } from '../roomCoordinator'; const PrivateRoomType = getPrivateRoomType(roomCoordinator); diff --git a/apps/meteor/server/lib/rooms/roomTypes/public.ts b/apps/meteor/server/lib/rooms/roomTypes/public.ts index ead4609c11c8d..ad5eaf2d75607 100644 --- a/apps/meteor/server/lib/rooms/roomTypes/public.ts +++ b/apps/meteor/server/lib/rooms/roomTypes/public.ts @@ -2,11 +2,11 @@ import { Team } from '@rocket.chat/core-services'; import type { AtLeast, IRoom } from '@rocket.chat/core-typings'; import { isRoomFederated, isRoomNativeFederated, TeamType } from '@rocket.chat/core-typings'; -import { settings } from '../../../../app/settings/server'; import type { IRoomTypeServerDirectives } from '../../../../definition/IRoomTypeConfig'; import { RoomSettingsEnum, RoomMemberActions } from '../../../../definition/IRoomTypeConfig'; import { getPublicRoomType } from '../../../../lib/rooms/roomTypes/public'; import { isFederationEnabled } from '../../../services/federation/utils'; +import { settings } from '../../../settings'; import { roomCoordinator } from '../roomCoordinator'; const PublicRoomType = getPublicRoomType(roomCoordinator); diff --git a/apps/meteor/server/lib/rooms/settings/index.ts b/apps/meteor/server/lib/rooms/settings/index.ts new file mode 100644 index 0000000000000..9e963fdace55c --- /dev/null +++ b/apps/meteor/server/lib/rooms/settings/index.ts @@ -0,0 +1,2 @@ +export { saveRoomTopic } from './saveRoomTopic'; +export { saveRoomName } from './saveRoomName'; diff --git a/apps/meteor/app/channel-settings/server/functions/saveReactWhenReadOnly.ts b/apps/meteor/server/lib/rooms/settings/saveReactWhenReadOnly.ts similarity index 100% rename from apps/meteor/app/channel-settings/server/functions/saveReactWhenReadOnly.ts rename to apps/meteor/server/lib/rooms/settings/saveReactWhenReadOnly.ts diff --git a/apps/meteor/app/channel-settings/server/functions/saveRoomAnnouncement.ts b/apps/meteor/server/lib/rooms/settings/saveRoomAnnouncement.ts similarity index 100% rename from apps/meteor/app/channel-settings/server/functions/saveRoomAnnouncement.ts rename to apps/meteor/server/lib/rooms/settings/saveRoomAnnouncement.ts diff --git a/apps/meteor/app/channel-settings/server/functions/saveRoomCustomFields.ts b/apps/meteor/server/lib/rooms/settings/saveRoomCustomFields.ts similarity index 91% rename from apps/meteor/app/channel-settings/server/functions/saveRoomCustomFields.ts rename to apps/meteor/server/lib/rooms/settings/saveRoomCustomFields.ts index ef70ff65c0675..b39129fb422b2 100644 --- a/apps/meteor/app/channel-settings/server/functions/saveRoomCustomFields.ts +++ b/apps/meteor/server/lib/rooms/settings/saveRoomCustomFields.ts @@ -3,7 +3,7 @@ import { Match } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; import type { UpdateResult } from 'mongodb'; -import { notifyOnSubscriptionChangedByRoomId } from '../../../lib/server/lib/notifyListener'; +import { notifyOnSubscriptionChangedByRoomId } from '../../notifyListener'; export const saveRoomCustomFields = async function (rid: string, roomCustomFields: Record): Promise { if (!Match.test(rid, String)) { diff --git a/apps/meteor/app/channel-settings/server/functions/saveRoomDescription.ts b/apps/meteor/server/lib/rooms/settings/saveRoomDescription.ts similarity index 100% rename from apps/meteor/app/channel-settings/server/functions/saveRoomDescription.ts rename to apps/meteor/server/lib/rooms/settings/saveRoomDescription.ts diff --git a/apps/meteor/app/channel-settings/server/functions/saveRoomEncrypted.ts b/apps/meteor/server/lib/rooms/settings/saveRoomEncrypted.ts similarity index 92% rename from apps/meteor/app/channel-settings/server/functions/saveRoomEncrypted.ts rename to apps/meteor/server/lib/rooms/settings/saveRoomEncrypted.ts index c1a441463a98b..c025bcd0d1687 100644 --- a/apps/meteor/app/channel-settings/server/functions/saveRoomEncrypted.ts +++ b/apps/meteor/server/lib/rooms/settings/saveRoomEncrypted.ts @@ -6,7 +6,7 @@ import { Match } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; import type { UpdateResult } from 'mongodb'; -import { notifyOnSubscriptionChangedByRoomId } from '../../../lib/server/lib/notifyListener'; +import { notifyOnSubscriptionChangedByRoomId } from '../../notifyListener'; export const saveRoomEncrypted = async function (rid: string, encrypted: boolean, user: IUser, sendMessage = true): Promise { if (!Match.test(rid, String)) { diff --git a/apps/meteor/app/channel-settings/server/functions/saveRoomName.ts b/apps/meteor/server/lib/rooms/settings/saveRoomName.ts similarity index 88% rename from apps/meteor/app/channel-settings/server/functions/saveRoomName.ts rename to apps/meteor/server/lib/rooms/settings/saveRoomName.ts index 0d54426bffdf7..6116e0b4bde97 100644 --- a/apps/meteor/app/channel-settings/server/functions/saveRoomName.ts +++ b/apps/meteor/server/lib/rooms/settings/saveRoomName.ts @@ -5,11 +5,11 @@ import { Integrations, Rooms, Subscriptions } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; import type { Document, UpdateResult } from 'mongodb'; -import { callbacks } from '../../../../server/lib/callbacks'; -import { roomCoordinator } from '../../../../server/lib/rooms/roomCoordinator'; -import { checkUsernameAvailability } from '../../../../server/lib/users/checkUsernameAvailability'; -import { notifyOnIntegrationChangedByChannels, notifyOnSubscriptionChangedByRoomId } from '../../../lib/server/lib/notifyListener'; -import { getValidRoomName } from '../../../utils/server/lib/getValidRoomName'; +import { callbacks } from '../../callbacks'; +import { notifyOnIntegrationChangedByChannels, notifyOnSubscriptionChangedByRoomId } from '../../notifyListener'; +import { checkUsernameAvailability } from '../../users/checkUsernameAvailability'; +import { getValidRoomName } from '../../utils/lib/getValidRoomName'; +import { roomCoordinator } from '../roomCoordinator'; const updateFName = async (rid: string, displayName: string): Promise<(UpdateResult | Document)[]> => { const responses = await Promise.all([Rooms.setFnameById(rid, displayName), Subscriptions.updateFnameByRoomId(rid, displayName)]); diff --git a/apps/meteor/app/channel-settings/server/functions/saveRoomReadOnly.ts b/apps/meteor/server/lib/rooms/settings/saveRoomReadOnly.ts similarity index 100% rename from apps/meteor/app/channel-settings/server/functions/saveRoomReadOnly.ts rename to apps/meteor/server/lib/rooms/settings/saveRoomReadOnly.ts diff --git a/apps/meteor/app/channel-settings/server/functions/saveRoomSystemMessages.ts b/apps/meteor/server/lib/rooms/settings/saveRoomSystemMessages.ts similarity index 96% rename from apps/meteor/app/channel-settings/server/functions/saveRoomSystemMessages.ts rename to apps/meteor/server/lib/rooms/settings/saveRoomSystemMessages.ts index 6ebd643afeb04..946d563e5caec 100644 --- a/apps/meteor/app/channel-settings/server/functions/saveRoomSystemMessages.ts +++ b/apps/meteor/server/lib/rooms/settings/saveRoomSystemMessages.ts @@ -3,7 +3,7 @@ import { Rooms } from '@rocket.chat/models'; import { Match } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { MessageTypesValues as messageTypesValues } from '../../../lib/lib/MessageTypes'; +import { MessageTypesValues as messageTypesValues } from '../../../../app/lib/lib/MessageTypes'; export const saveRoomSystemMessages = async function (rid: string, systemMessages: MessageTypesValues[]) { if (!Match.test(rid, String)) { diff --git a/apps/meteor/app/channel-settings/server/functions/saveRoomTopic.ts b/apps/meteor/server/lib/rooms/settings/saveRoomTopic.ts similarity index 93% rename from apps/meteor/app/channel-settings/server/functions/saveRoomTopic.ts rename to apps/meteor/server/lib/rooms/settings/saveRoomTopic.ts index f916259c03364..fa4c32690748b 100644 --- a/apps/meteor/app/channel-settings/server/functions/saveRoomTopic.ts +++ b/apps/meteor/server/lib/rooms/settings/saveRoomTopic.ts @@ -4,7 +4,7 @@ import { Rooms } from '@rocket.chat/models'; import { Match } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { callbacks } from '../../../../server/lib/callbacks'; +import { callbacks } from '../../callbacks'; export const saveRoomTopic = async ( rid: string, diff --git a/apps/meteor/app/channel-settings/server/functions/saveRoomType.ts b/apps/meteor/server/lib/rooms/settings/saveRoomType.ts similarity index 88% rename from apps/meteor/app/channel-settings/server/functions/saveRoomType.ts rename to apps/meteor/server/lib/rooms/settings/saveRoomType.ts index 1f0ad3f29192c..3db3aaf9ee59f 100644 --- a/apps/meteor/app/channel-settings/server/functions/saveRoomType.ts +++ b/apps/meteor/server/lib/rooms/settings/saveRoomType.ts @@ -6,10 +6,10 @@ import { Meteor } from 'meteor/meteor'; import type { UpdateResult, Document } from 'mongodb'; import { RoomSettingsEnum } from '../../../../definition/IRoomTypeConfig'; -import { i18n } from '../../../../server/lib/i18n'; -import { roomCoordinator } from '../../../../server/lib/rooms/roomCoordinator'; -import { notifyOnSubscriptionChangedByRoomId } from '../../../lib/server/lib/notifyListener'; -import { settings } from '../../../settings/server'; +import { settings } from '../../../settings'; +import { i18n } from '../../i18n'; +import { notifyOnSubscriptionChangedByRoomId } from '../../notifyListener'; +import { roomCoordinator } from '../roomCoordinator'; export const saveRoomType = async function ( rid: string, diff --git a/apps/meteor/server/lib/rooms/unarchiveRoom.ts b/apps/meteor/server/lib/rooms/unarchiveRoom.ts index a93ab77873d59..233ad38eb9e85 100644 --- a/apps/meteor/server/lib/rooms/unarchiveRoom.ts +++ b/apps/meteor/server/lib/rooms/unarchiveRoom.ts @@ -2,7 +2,7 @@ import { Message } from '@rocket.chat/core-services'; import type { IMessage } from '@rocket.chat/core-typings'; import { Rooms, Subscriptions, Users } from '@rocket.chat/models'; -import { notifyOnRoomChangedById, notifyOnSubscriptionChangedByRoomId } from '../../../app/lib/server/lib/notifyListener'; +import { notifyOnRoomChangedById, notifyOnSubscriptionChangedByRoomId } from '../notifyListener'; const BATCH_SIZE = 100_000; diff --git a/apps/meteor/server/lib/rooms/updateGroupDMsName.ts b/apps/meteor/server/lib/rooms/updateGroupDMsName.ts index e51f75f0addd3..844b63126f1e9 100644 --- a/apps/meteor/server/lib/rooms/updateGroupDMsName.ts +++ b/apps/meteor/server/lib/rooms/updateGroupDMsName.ts @@ -3,7 +3,7 @@ import { isNotUndefined } from '@rocket.chat/core-typings'; import { Rooms, Subscriptions, Users } from '@rocket.chat/models'; import type { ClientSession } from 'mongodb'; -import { notifyOnSubscriptionChangedByRoomId } from '../../../app/lib/server/lib/notifyListener'; +import { notifyOnSubscriptionChangedByRoomId } from '../notifyListener'; const getFname = (members: IUser[]): string => members.map(({ name, username }) => name || username).join(', '); const getName = (members: IUser[]): string => members.map(({ username }) => username).join(','); diff --git a/apps/meteor/app/meteor-accounts-saml/CHANGELOG.md b/apps/meteor/server/lib/saml/CHANGELOG.md similarity index 100% rename from apps/meteor/app/meteor-accounts-saml/CHANGELOG.md rename to apps/meteor/server/lib/saml/CHANGELOG.md diff --git a/apps/meteor/app/meteor-accounts-saml/README.md b/apps/meteor/server/lib/saml/README.md similarity index 100% rename from apps/meteor/app/meteor-accounts-saml/README.md rename to apps/meteor/server/lib/saml/README.md diff --git a/apps/meteor/server/lib/saml/lib/SAML.ts b/apps/meteor/server/lib/saml/lib/SAML.ts index 7fc20a0f6af8e..e6bb386498e7d 100644 --- a/apps/meteor/server/lib/saml/lib/SAML.ts +++ b/apps/meteor/server/lib/saml/lib/SAML.ts @@ -10,9 +10,9 @@ import { Meteor } from 'meteor/meteor'; import { SAMLServiceProvider } from './ServiceProvider'; import { SAMLUtils } from './Utils'; import { getSAMLEnvelope } from './getSAMLEnvelope'; -import { settings } from '../../../../app/settings/server'; import { i18n } from '../../../../app/utils/lib/i18n'; import { ensureArray } from '../../../../lib/utils/arrayUtils'; +import { settings } from '../../../settings'; import { SystemLogger } from '../../logger/system'; import { addUserToRoom } from '../../rooms/addUserToRoom'; import { createRoom } from '../../rooms/createRoom'; diff --git a/apps/meteor/server/lib/saml/lib/settings.ts b/apps/meteor/server/lib/saml/lib/settings.ts index ce24a426f6e55..5819add8bc295 100644 --- a/apps/meteor/server/lib/saml/lib/settings.ts +++ b/apps/meteor/server/lib/saml/lib/settings.ts @@ -14,12 +14,9 @@ import { defaultMetadataTemplate, defaultMetadataCertificateTemplate, } from './constants'; -import { - notifyOnLoginServiceConfigurationChanged, - notifyOnLoginServiceConfigurationChangedByService, -} from '../../../../app/lib/server/lib/notifyListener'; -import { settings, settingsRegistry } from '../../../../app/settings/server'; +import { settings, settingsRegistry } from '../../../settings'; import { SystemLogger } from '../../logger/system'; +import { notifyOnLoginServiceConfigurationChanged, notifyOnLoginServiceConfigurationChangedByService } from '../../notifyListener'; import type { IServiceProviderOptions } from '../definition/IServiceProviderOptions'; const getSamlConfigs = function (service: string): SAMLConfiguration { diff --git a/apps/meteor/server/lib/saml/startup.ts b/apps/meteor/server/lib/saml/startup.ts index 6a4e3fa0afd3d..ff09d46065246 100644 --- a/apps/meteor/server/lib/saml/startup.ts +++ b/apps/meteor/server/lib/saml/startup.ts @@ -4,7 +4,7 @@ import { Meteor } from 'meteor/meteor'; import { SAMLUtils } from './lib/Utils'; import { loadSamlServiceProviders, addSettings } from './lib/settings'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; const logger = new Logger('steffo:meteor-accounts-saml'); SAMLUtils.setLoggerInstance(logger); diff --git a/apps/meteor/server/lib/search/events/index.ts b/apps/meteor/server/lib/search/events/index.ts index ab34129292a92..1fddb9578b3e3 100644 --- a/apps/meteor/server/lib/search/events/index.ts +++ b/apps/meteor/server/lib/search/events/index.ts @@ -1,7 +1,7 @@ import type { IMessage } from '@rocket.chat/core-typings'; import { EventService } from './EventService'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; import { callbacks } from '../../callbacks'; import { searchProviderService } from '../service'; diff --git a/apps/meteor/server/lib/search/model/Setting.ts b/apps/meteor/server/lib/search/model/Setting.ts index 71b0d762a5a2d..ec71a63264f07 100644 --- a/apps/meteor/server/lib/search/model/Setting.ts +++ b/apps/meteor/server/lib/search/model/Setting.ts @@ -1,6 +1,6 @@ import type { SettingValue } from '@rocket.chat/core-typings'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; /** * Setting Object in order to manage settings loading for providers and admin ui display diff --git a/apps/meteor/server/lib/search/search.internalService.ts b/apps/meteor/server/lib/search/search.internalService.ts index 837fbd6e14d33..3e28e6c9a9d35 100644 --- a/apps/meteor/server/lib/search/search.internalService.ts +++ b/apps/meteor/server/lib/search/search.internalService.ts @@ -3,7 +3,7 @@ import { Users } from '@rocket.chat/models'; import { searchEventService } from './events'; import { searchProviderService } from './service'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; class Search extends ServiceClassInternal { protected name = 'search'; diff --git a/apps/meteor/server/lib/search/service/SearchProviderService.ts b/apps/meteor/server/lib/search/service/SearchProviderService.ts index 9217c2bbcb20d..8ce02c77c0588 100644 --- a/apps/meteor/server/lib/search/service/SearchProviderService.ts +++ b/apps/meteor/server/lib/search/service/SearchProviderService.ts @@ -1,5 +1,5 @@ -import { settings, settingsRegistry } from '../../../../app/settings/server'; import { withDebouncing } from '../../../../lib/utils/highOrderFunctions'; +import { settings, settingsRegistry } from '../../../settings'; import { SearchLogger } from '../logger/logger'; import type { SearchProvider } from '../model/SearchProvider'; diff --git a/apps/meteor/server/lib/search/service/SearchResultValidationService.ts b/apps/meteor/server/lib/search/service/SearchResultValidationService.ts index 5762e258e3bd8..d46ac0af463c9 100644 --- a/apps/meteor/server/lib/search/service/SearchResultValidationService.ts +++ b/apps/meteor/server/lib/search/service/SearchResultValidationService.ts @@ -4,7 +4,7 @@ import { isTruthy } from '@rocket.chat/tools'; import mem from 'mem'; import { Meteor } from 'meteor/meteor'; -import { canAccessRoomAsync } from '../../../../app/authorization/server'; +import { canAccessRoomAsync } from '../../authorization'; import { SearchLogger } from '../logger/logger'; import type { IRawSearchResult, ISearchResult } from '../model/ISearchResult'; diff --git a/apps/meteor/server/lib/sendMessagesToAdmins.ts b/apps/meteor/server/lib/sendMessagesToAdmins.ts index 71ffbada1de89..0cff402d2f45a 100644 --- a/apps/meteor/server/lib/sendMessagesToAdmins.ts +++ b/apps/meteor/server/lib/sendMessagesToAdmins.ts @@ -2,7 +2,7 @@ import type { IUser, IMessage } from '@rocket.chat/core-typings'; import { Roles, Users } from '@rocket.chat/models'; import { SystemLogger } from './logger/system'; -import { notifyOnUserChangeAsync } from '../../app/lib/server/lib/notifyListener'; +import { notifyOnUserChangeAsync } from './notifyListener'; import { createDirectMessage } from '../meteor-methods/messages/createDirectMessage'; import { executeSendMessage } from '../meteor-methods/messages/sendMessage'; diff --git a/apps/meteor/server/lib/shared/validateName.ts b/apps/meteor/server/lib/shared/validateName.ts index da5d90ac2362c..c9adeaf9f32b4 100644 --- a/apps/meteor/server/lib/shared/validateName.ts +++ b/apps/meteor/server/lib/shared/validateName.ts @@ -1,4 +1,4 @@ -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; export const validateName = function (name: string): boolean { const blockedNames = settings.get('Accounts_SystemBlockedUsernameList'); diff --git a/apps/meteor/server/lib/shouldBreakInVersion.ts b/apps/meteor/server/lib/shouldBreakInVersion.ts index 596e047a0d3ad..c839e12592158 100644 --- a/apps/meteor/server/lib/shouldBreakInVersion.ts +++ b/apps/meteor/server/lib/shouldBreakInVersion.ts @@ -1,6 +1,6 @@ import semver from 'semver'; -import type { DeprecationLoggerNextPlannedVersion } from '../../app/lib/server/lib/deprecationWarningLogger'; +import type { DeprecationLoggerNextPlannedVersion } from './deprecationWarningLogger'; import { Info } from '../../app/utils/rocketchat.info'; export const shouldBreakInVersion = (version: DeprecationLoggerNextPlannedVersion) => semver.gte(Info.version, version); diff --git a/apps/meteor/server/lib/spotlight.js b/apps/meteor/server/lib/spotlight.js index 32226fb82cdd7..6a3e1bb43dee4 100644 --- a/apps/meteor/server/lib/spotlight.js +++ b/apps/meteor/server/lib/spotlight.js @@ -2,12 +2,12 @@ import { Team } from '@rocket.chat/core-services'; import { Users, Subscriptions as SubscriptionsRaw, Rooms } from '@rocket.chat/models'; import { escapeRegExp } from '@rocket.chat/string-helpers'; +import { canAccessRoomAsync, roomAccessAttributes } from './authorization'; import { hasPermissionAsync, hasAllPermissionAsync } from './authorization/hasPermission'; -import { canAccessRoomAsync, roomAccessAttributes } from '../../app/authorization/server'; -import { settings } from '../../app/settings/server'; +import { roomCoordinator } from './rooms/roomCoordinator'; import { trim } from '../../lib/utils/stringUtils'; import { readSecondaryPreferred } from '../database/readSecondaryPreferred'; -import { roomCoordinator } from './rooms/roomCoordinator'; +import { settings } from '../settings'; export class Spotlight { async fetchRooms(userId, rooms) { diff --git a/apps/meteor/server/lib/statistics/functions/updateStatsCounter.ts b/apps/meteor/server/lib/statistics/functions/updateStatsCounter.ts index 0a62de93eb911..7999d717bd5c5 100644 --- a/apps/meteor/server/lib/statistics/functions/updateStatsCounter.ts +++ b/apps/meteor/server/lib/statistics/functions/updateStatsCounter.ts @@ -1,6 +1,6 @@ import { Settings } from '@rocket.chat/models'; -import { notifyOnSettingChanged } from '../../../../app/lib/server/lib/notifyListener'; +import { notifyOnSettingChanged } from '../../notifyListener'; import telemetryEvent from '../lib/telemetryEvents'; type updateCounterDataType = { settingsId: string }; diff --git a/apps/meteor/server/lib/statistics/getSettingsStatistics.ts b/apps/meteor/server/lib/statistics/getSettingsStatistics.ts index 8463ac814c3c6..fdec8c9646b76 100644 --- a/apps/meteor/server/lib/statistics/getSettingsStatistics.ts +++ b/apps/meteor/server/lib/statistics/getSettingsStatistics.ts @@ -1,6 +1,6 @@ import type { ISettingStatistics, ISettingStatisticsObject } from '@rocket.chat/core-typings'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; const setSettingsStatistics = async (settings: ISettingStatistics): Promise => { const { diff --git a/apps/meteor/server/lib/statistics/lib/getContactVerificationStatistics.ts b/apps/meteor/server/lib/statistics/lib/getContactVerificationStatistics.ts index 7c36feaf00b26..300f8f7779781 100644 --- a/apps/meteor/server/lib/statistics/lib/getContactVerificationStatistics.ts +++ b/apps/meteor/server/lib/statistics/lib/getContactVerificationStatistics.ts @@ -1,7 +1,7 @@ import type { IStats } from '@rocket.chat/core-typings'; import { LivechatContacts } from '@rocket.chat/models'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; export async function getContactVerificationStatistics(): Promise { const [ diff --git a/apps/meteor/server/lib/statistics/lib/getImporterStatistics.ts b/apps/meteor/server/lib/statistics/lib/getImporterStatistics.ts index 3964cabd91cbc..381b4fd46ce7a 100644 --- a/apps/meteor/server/lib/statistics/lib/getImporterStatistics.ts +++ b/apps/meteor/server/lib/statistics/lib/getImporterStatistics.ts @@ -1,4 +1,4 @@ -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; export function getImporterStatistics(): Record { return { diff --git a/apps/meteor/server/lib/statistics/lib/getServicesStatistics.ts b/apps/meteor/server/lib/statistics/lib/getServicesStatistics.ts index 661cd54d690e9..ef415704c86b4 100644 --- a/apps/meteor/server/lib/statistics/lib/getServicesStatistics.ts +++ b/apps/meteor/server/lib/statistics/lib/getServicesStatistics.ts @@ -1,8 +1,8 @@ import { Users } from '@rocket.chat/models'; import { MongoInternals } from 'meteor/mongo'; -import { settings } from '../../../../app/settings/server'; import { readSecondaryPreferred } from '../../../database/readSecondaryPreferred'; +import { settings } from '../../../settings'; const { db } = MongoInternals.defaultRemoteCollectionDriver().mongo; diff --git a/apps/meteor/server/lib/statistics/lib/statistics.ts b/apps/meteor/server/lib/statistics/lib/statistics.ts index 3fb332d5c689d..61c61641b5e29 100644 --- a/apps/meteor/server/lib/statistics/lib/statistics.ts +++ b/apps/meteor/server/lib/statistics/lib/statistics.ts @@ -36,13 +36,13 @@ import { getContactVerificationStatistics } from './getContactVerificationStatis import { getStatistics as getEnterpriseStatistics } from './getEEStatistics'; import { getImporterStatistics } from './getImporterStatistics'; import { getServicesStatistics } from './getServicesStatistics'; -import { settings } from '../../../../app/settings/server'; import { Info } from '../../../../app/utils/rocketchat.info'; -import { getMongoInfo } from '../../../../app/utils/server/functions/getMongoInfo'; import { readSecondaryPreferred } from '../../../database/readSecondaryPreferred'; import { getMatrixFederationStatistics } from '../../../services/federation/infrastructure/rocket-chat/adapters/Statistics'; +import { settings } from '../../../settings'; import { isRunningMs } from '../../isRunningMs'; import { getControl } from '../../migrations'; +import { getMongoInfo } from '../../utils/functions/getMongoInfo'; import { getSettingsStatistics } from '../getSettingsStatistics'; const getUserLanguages = async (totalUsers: number): Promise<{ [key: string]: number }> => { diff --git a/apps/meteor/server/lib/statistics/startup/monitor.ts b/apps/meteor/server/lib/statistics/startup/monitor.ts index 1ddcbf5cb125d..02adfc272bbc1 100644 --- a/apps/meteor/server/lib/statistics/startup/monitor.ts +++ b/apps/meteor/server/lib/statistics/startup/monitor.ts @@ -1,6 +1,6 @@ import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; import { SAUMonitorClass } from '../lib/SAUMonitor'; const SAUMonitor = new SAUMonitorClass(); diff --git a/apps/meteor/app/ui-master/server/index.ts b/apps/meteor/server/lib/ui-master/index.ts similarity index 98% rename from apps/meteor/app/ui-master/server/index.ts rename to apps/meteor/server/lib/ui-master/index.ts index 24a673b3b9b85..209a908dc9088 100644 --- a/apps/meteor/app/ui-master/server/index.ts +++ b/apps/meteor/server/lib/ui-master/index.ts @@ -8,8 +8,8 @@ import { Tracker } from 'meteor/tracker'; import { applyHeadInjections, headInjections, injectIntoBody, injectIntoHead } from './inject'; import { getMessageMaxParseLength } from '../../../lib/getMessageMaxParseLength'; import { withDebouncing } from '../../../lib/utils/highOrderFunctions'; -import { settings } from '../../settings/server'; -import { getURL } from '../../utils/server/getURL'; +import { settings } from '../../settings'; +import { getURL } from '../utils/getURL'; import './scripts'; diff --git a/apps/meteor/app/ui-master/server/inject.ts b/apps/meteor/server/lib/ui-master/inject.ts similarity index 98% rename from apps/meteor/app/ui-master/server/inject.ts rename to apps/meteor/server/lib/ui-master/inject.ts index 07423bc8ac5c7..15632b67e2237 100644 --- a/apps/meteor/app/ui-master/server/inject.ts +++ b/apps/meteor/server/lib/ui-master/inject.ts @@ -6,7 +6,7 @@ import { ReactiveDict } from 'meteor/reactive-dict'; import { WebApp } from 'meteor/webapp'; import parseRequest from 'parseurl'; -import { getURL } from '../../utils/server/getURL'; +import { getURL } from '../utils/getURL'; type Injection = | string diff --git a/apps/meteor/app/ui-master/server/scripts.ts b/apps/meteor/server/lib/ui-master/scripts.ts similarity index 95% rename from apps/meteor/app/ui-master/server/scripts.ts rename to apps/meteor/server/lib/ui-master/scripts.ts index 485a4636a8da8..a4267f78f3e01 100644 --- a/apps/meteor/app/ui-master/server/scripts.ts +++ b/apps/meteor/server/lib/ui-master/scripts.ts @@ -1,5 +1,5 @@ import { addScript } from './inject'; -import { settings } from '../../settings/server'; +import { settings } from '../../settings'; const getContent = (): string => ` diff --git a/apps/meteor/server/lib/unbanUserFromRoom.ts b/apps/meteor/server/lib/unbanUserFromRoom.ts index 7fa1244ff71d0..435fb4d191561 100644 --- a/apps/meteor/server/lib/unbanUserFromRoom.ts +++ b/apps/meteor/server/lib/unbanUserFromRoom.ts @@ -1,9 +1,9 @@ import { Rooms, Users } from '@rocket.chat/models'; +import { canAccessRoomAsync } from './authorization'; import { hasPermissionAsync } from './authorization/hasPermission'; import { executeUnbanUserFromRoom } from './rooms/executeUnbanUserFromRoom'; import { roomCoordinator } from './rooms/roomCoordinator'; -import { canAccessRoomAsync } from '../../app/authorization/server'; import { RoomMemberActions } from '../../definition/IRoomTypeConfig'; export const unbanUserFromRoom = async (fromId: string, data: { rid: string; username: string }): Promise => { diff --git a/apps/meteor/server/lib/users/blockUser.ts b/apps/meteor/server/lib/users/blockUser.ts index 2300397581170..30b8224a7806c 100644 --- a/apps/meteor/server/lib/users/blockUser.ts +++ b/apps/meteor/server/lib/users/blockUser.ts @@ -1,8 +1,8 @@ import { Subscriptions, Rooms } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { notifyOnSubscriptionChangedByRoomIdAndUserIds } from '../../../app/lib/server/lib/notifyListener'; import { RoomMemberActions } from '../../../definition/IRoomTypeConfig'; +import { notifyOnSubscriptionChangedByRoomIdAndUserIds } from '../notifyListener'; import { roomCoordinator } from '../rooms/roomCoordinator'; export const blockUserMethod = async (userId: string, { rid, blocked }: { rid: string; blocked: string }): Promise => { diff --git a/apps/meteor/server/lib/users/checkUsernameAvailability.ts b/apps/meteor/server/lib/users/checkUsernameAvailability.ts index 3c2cdaf7114d1..6d32e16fef244 100644 --- a/apps/meteor/server/lib/users/checkUsernameAvailability.ts +++ b/apps/meteor/server/lib/users/checkUsernameAvailability.ts @@ -4,7 +4,7 @@ import { escapeRegExp } from '@rocket.chat/string-helpers'; import { Meteor } from 'meteor/meteor'; import _ from 'underscore'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; import { validateName } from '../shared/validateName'; let usernameBlackList: RegExp[] = []; diff --git a/apps/meteor/server/lib/users/deleteUser.ts b/apps/meteor/server/lib/users/deleteUser.ts index 37ba25640c71d..c35542205c239 100644 --- a/apps/meteor/server/lib/users/deleteUser.ts +++ b/apps/meteor/server/lib/users/deleteUser.ts @@ -17,16 +17,16 @@ import { import { Meteor } from 'meteor/meteor'; import { getUserSingleOwnedRooms } from './getUserSingleOwnedRooms'; +import { settings } from '../../settings'; +import { callbacks } from '../callbacks'; +import { i18n } from '../i18n'; +import { FileUpload } from '../media/file-upload'; import { notifyOnRoomChangedById, notifyOnIntegrationChangedByUserId, notifyOnLivechatDepartmentAgentChanged, notifyOnUserChange, -} from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; -import { callbacks } from '../callbacks'; -import { i18n } from '../i18n'; -import { FileUpload } from '../media/file-upload'; +} from '../notifyListener'; import { getSubscribedRoomsForUserWithDetails, shouldRemoveOrChangeOwner } from '../rooms/getRoomsWithSingleOwner'; import { relinquishRoomOwnerships } from '../rooms/relinquishRoomOwnerships'; import { updateGroupDMsName } from '../rooms/updateGroupDMsName'; diff --git a/apps/meteor/server/lib/users/getAvatarSuggestionForUser.ts b/apps/meteor/server/lib/users/getAvatarSuggestionForUser.ts index 2b186d5fce2e8..32d522c2f7d49 100644 --- a/apps/meteor/server/lib/users/getAvatarSuggestionForUser.ts +++ b/apps/meteor/server/lib/users/getAvatarSuggestionForUser.ts @@ -4,7 +4,7 @@ import Gravatar from 'gravatar'; import { check } from 'meteor/check'; import { ServiceConfiguration } from 'meteor/service-configuration'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; const avatarProviders = { facebook(user: IUser) { diff --git a/apps/meteor/server/lib/users/getFullUserData.ts b/apps/meteor/server/lib/users/getFullUserData.ts index 094c72c75ead4..7cf17e5df9c81 100644 --- a/apps/meteor/server/lib/users/getFullUserData.ts +++ b/apps/meteor/server/lib/users/getFullUserData.ts @@ -2,7 +2,7 @@ import type { IUser, IUserEmail } from '@rocket.chat/core-typings'; import { Logger } from '@rocket.chat/logger'; import { Users } from '@rocket.chat/models'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; import { hasPermissionAsync } from '../authorization/hasPermission'; const logger = new Logger('getFullUserData'); diff --git a/apps/meteor/server/lib/users/getUsernameSuggestion.ts b/apps/meteor/server/lib/users/getUsernameSuggestion.ts index 41803351ef8a4..373bd6b2a4cf6 100644 --- a/apps/meteor/server/lib/users/getUsernameSuggestion.ts +++ b/apps/meteor/server/lib/users/getUsernameSuggestion.ts @@ -2,7 +2,7 @@ import type { IUser } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; import limax from 'limax'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; function slug(text: string): string { return limax(text, { replacement: '.' }).replace(/[^0-9a-z-_.]/g, ''); diff --git a/apps/meteor/server/lib/users/saveCustomFields.ts b/apps/meteor/server/lib/users/saveCustomFields.ts index bc8c286235765..1df74c54f4a1f 100644 --- a/apps/meteor/server/lib/users/saveCustomFields.ts +++ b/apps/meteor/server/lib/users/saveCustomFields.ts @@ -4,8 +4,8 @@ import type { ClientSession } from 'mongodb'; import { saveCustomFieldsWithoutValidation } from './saveCustomFieldsWithoutValidation'; import { validateCustomFields } from './validateCustomFields'; -import { settings } from '../../../app/settings/server'; import { trim } from '../../../lib/utils/stringUtils'; +import { settings } from '../../settings'; export const saveCustomFields = async function ( userId: string, diff --git a/apps/meteor/server/lib/users/saveCustomFieldsWithoutValidation.ts b/apps/meteor/server/lib/users/saveCustomFieldsWithoutValidation.ts index f103a3a8c8285..78f9c6051b02f 100644 --- a/apps/meteor/server/lib/users/saveCustomFieldsWithoutValidation.ts +++ b/apps/meteor/server/lib/users/saveCustomFieldsWithoutValidation.ts @@ -4,10 +4,10 @@ import { Subscriptions, Users } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; import type { ClientSession } from 'mongodb'; -import { notifyOnSubscriptionChangedByUserIdAndRoomType } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; import { trim } from '../../../lib/utils/stringUtils'; import { onceTransactionCommitedSuccessfully } from '../../database/utils'; +import { settings } from '../../settings'; +import { notifyOnSubscriptionChangedByUserIdAndRoomType } from '../notifyListener'; const getCustomFieldsMeta = function (customFieldsMeta: string) { try { diff --git a/apps/meteor/server/lib/users/saveUser/saveNewUser.ts b/apps/meteor/server/lib/users/saveUser/saveNewUser.ts index 6bdf87f547e5a..d20e02ee043d1 100644 --- a/apps/meteor/server/lib/users/saveUser/saveNewUser.ts +++ b/apps/meteor/server/lib/users/saveUser/saveNewUser.ts @@ -3,15 +3,15 @@ import { Users } from '@rocket.chat/models'; import Gravatar from 'gravatar'; import { Accounts } from 'meteor/accounts-base'; -import { notifyOnUserChangeById } from '../../../../app/lib/server/lib/notifyListener'; -import { validateEmailDomain } from '../../../../app/lib/server/lib/validateEmailDomain'; +import { notifyOnUserChangeById } from '../../notifyListener'; +import { validateEmailDomain } from '../../validateEmailDomain'; import { setUserAvatar } from '../setUserAvatar'; import { handleBio } from './handleBio'; import { handleNickname } from './handleNickname'; import type { SaveUserData } from './saveUser'; import { sendPasswordEmail, sendWelcomeEmail } from './sendUserEmail'; -import { settings } from '../../../../app/settings/server'; import { getNewUserRoles } from '../../../services/user/lib/getNewUserRoles'; +import { settings } from '../../../settings'; export const saveNewUser = async function (userData: SaveUserData, sendPassword: boolean, performedBy: IUser) { await validateEmailDomain(userData.email); diff --git a/apps/meteor/server/lib/users/saveUser/saveUser.ts b/apps/meteor/server/lib/users/saveUser/saveUser.ts index 40c5abfb5e886..0b2430c71df6e 100644 --- a/apps/meteor/server/lib/users/saveUser/saveUser.ts +++ b/apps/meteor/server/lib/users/saveUser/saveUser.ts @@ -13,13 +13,13 @@ import { sendPasswordEmail } from './sendUserEmail'; import { setPasswordUpdater } from './setPasswordUpdater'; import { validateUserData } from './validateUserData'; import { validateUserEditing } from './validateUserEditing'; -import { generatePassword } from '../../../../app/lib/server/lib/generatePassword'; -import { notifyOnUserChange } from '../../../../app/lib/server/lib/notifyListener'; -import { passwordPolicy } from '../../../../app/lib/server/lib/passwordPolicy'; import { wrapInSessionTransaction, onceTransactionCommitedSuccessfully } from '../../../database/utils'; import type { UserChangedAuditStore } from '../../auditServerEvents/userChanged'; +import { generatePassword } from '../../auth/generatePassword'; +import { passwordPolicy } from '../../auth/passwordPolicy'; import { hasPermissionAsync } from '../../authorization/hasPermission'; import { callbacks } from '../../callbacks'; +import { notifyOnUserChange } from '../../notifyListener'; import { shouldBreakInVersion } from '../../shouldBreakInVersion'; import { saveCustomFields } from '../saveCustomFields'; import { saveUserIdentity } from '../saveUserIdentity'; diff --git a/apps/meteor/server/lib/users/saveUser/sendUserEmail.ts b/apps/meteor/server/lib/users/saveUser/sendUserEmail.ts index e4d991c55aa7b..5a9f71b1faafd 100644 --- a/apps/meteor/server/lib/users/saveUser/sendUserEmail.ts +++ b/apps/meteor/server/lib/users/saveUser/sendUserEmail.ts @@ -2,7 +2,7 @@ import { MeteorError } from '@rocket.chat/core-services'; import { Meteor } from 'meteor/meteor'; import type { SaveUserData } from './saveUser'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; import * as Mailer from '../../notifications/email/api'; let html = ''; diff --git a/apps/meteor/server/lib/users/saveUser/validateUserData.ts b/apps/meteor/server/lib/users/saveUser/validateUserData.ts index 1473eeb4f0fad..d604f05496cac 100644 --- a/apps/meteor/server/lib/users/saveUser/validateUserData.ts +++ b/apps/meteor/server/lib/users/saveUser/validateUserData.ts @@ -5,8 +5,8 @@ import escape from 'lodash.escape'; import type { SaveUserData } from './saveUser'; import { isUpdateUserData } from './saveUser'; -import { settings } from '../../../../app/settings/server'; import { trim } from '../../../../lib/utils/stringUtils'; +import { settings } from '../../../settings'; import { getRoleIds } from '../../authorization/getRoles'; import { hasPermissionAsync } from '../../authorization/hasPermission'; import { checkEmailAvailability } from '../checkEmailAvailability'; diff --git a/apps/meteor/server/lib/users/saveUser/validateUserEditing.ts b/apps/meteor/server/lib/users/saveUser/validateUserEditing.ts index d8b3d9e5027ff..8257db4a32ce2 100644 --- a/apps/meteor/server/lib/users/saveUser/validateUserEditing.ts +++ b/apps/meteor/server/lib/users/saveUser/validateUserEditing.ts @@ -4,7 +4,7 @@ import type { IUser } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; import type { UpdateUserData } from './saveUser'; -import { settings } from '../../../../app/settings/server'; +import { settings } from '../../../settings'; import { hasPermissionAsync } from '../../authorization/hasPermission'; const isEditingUserRoles = (previousRoles: IUser['roles'], newRoles?: IUser['roles']) => diff --git a/apps/meteor/server/lib/users/saveUserIdentity.ts b/apps/meteor/server/lib/users/saveUserIdentity.ts index d8613e3cf891b..1c4304223d14e 100644 --- a/apps/meteor/server/lib/users/saveUserIdentity.ts +++ b/apps/meteor/server/lib/users/saveUserIdentity.ts @@ -5,14 +5,14 @@ import type { ClientSession } from 'mongodb'; import { setRealName } from './setRealName'; import { _setUsername } from './setUsername'; +import { onceTransactionCommitedSuccessfully } from '../../database/utils'; +import { SystemLogger } from '../logger/system'; +import { FileUpload } from '../media/file-upload'; import { notifyOnRoomChangedByUsernamesOrUids, notifyOnSubscriptionChangedByUserId, notifyOnSubscriptionChangedByNameAndRoomType, -} from '../../../app/lib/server/lib/notifyListener'; -import { onceTransactionCommitedSuccessfully } from '../../database/utils'; -import { SystemLogger } from '../logger/system'; -import { FileUpload } from '../media/file-upload'; +} from '../notifyListener'; import { updateGroupDMsName } from '../rooms/updateGroupDMsName'; import { validateName } from '../shared/validateName'; diff --git a/apps/meteor/server/lib/users/setEmail.ts b/apps/meteor/server/lib/users/setEmail.ts index 1e20d94031f2e..8fd5de388a117 100644 --- a/apps/meteor/server/lib/users/setEmail.ts +++ b/apps/meteor/server/lib/users/setEmail.ts @@ -6,11 +6,11 @@ import { Meteor } from 'meteor/meteor'; import type { ClientSession } from 'mongodb'; import { checkEmailAvailability } from './checkEmailAvailability'; -import { validateEmailDomain } from '../../../app/lib/server/lib'; -import { settings } from '../../../app/settings/server'; import { onceTransactionCommitedSuccessfully } from '../../database/utils'; import { sendConfirmationEmail } from '../../meteor-methods/auth/sendConfirmationEmail'; +import { settings } from '../../settings'; import * as Mailer from '../notifications/email/api'; +import { validateEmailDomain } from '../validateEmailDomain'; let html = ''; Meteor.startup(() => { diff --git a/apps/meteor/server/lib/users/setRealName.ts b/apps/meteor/server/lib/users/setRealName.ts index ffe05e6560e7d..b5b4543e9ec79 100644 --- a/apps/meteor/server/lib/users/setRealName.ts +++ b/apps/meteor/server/lib/users/setRealName.ts @@ -4,8 +4,8 @@ import type { Updater } from '@rocket.chat/models'; import { Users } from '@rocket.chat/models'; import type { ClientSession } from 'mongodb'; -import { settings } from '../../../app/settings/server'; import { onceTransactionCommitedSuccessfully } from '../../database/utils'; +import { settings } from '../../settings'; export const setRealName = async function ( userId: string, diff --git a/apps/meteor/server/lib/users/setUserActiveStatus.ts b/apps/meteor/server/lib/users/setUserActiveStatus.ts index f8f1991938bf0..53fe21c09bc6b 100644 --- a/apps/meteor/server/lib/users/setUserActiveStatus.ts +++ b/apps/meteor/server/lib/users/setUserActiveStatus.ts @@ -6,15 +6,15 @@ import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; import { getUserSingleOwnedRooms } from './getUserSingleOwnedRooms'; +import { settings } from '../../settings'; +import { callbacks } from '../callbacks'; +import * as Mailer from '../notifications/email/api'; import { notifyOnRoomChangedById, notifyOnRoomChangedByUserDM, notifyOnSubscriptionChangedByNameAndRoomType, notifyOnUserChange, -} from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; -import { callbacks } from '../callbacks'; -import * as Mailer from '../notifications/email/api'; +} from '../notifyListener'; import { closeOmnichannelConversations } from '../omnichannel/closeOmnichannelConversations'; import { shouldRemoveOrChangeOwner, getSubscribedRoomsForUserWithDetails } from '../rooms/getRoomsWithSingleOwner'; import { relinquishRoomOwnerships } from '../rooms/relinquishRoomOwnerships'; diff --git a/apps/meteor/server/lib/users/setUserAvatar.ts b/apps/meteor/server/lib/users/setUserAvatar.ts index e1e44c496b683..56d085c0ff74d 100644 --- a/apps/meteor/server/lib/users/setUserAvatar.ts +++ b/apps/meteor/server/lib/users/setUserAvatar.ts @@ -7,9 +7,9 @@ import { serverFetch as fetch } from '@rocket.chat/server-fetch'; import { Meteor } from 'meteor/meteor'; import type { ClientSession } from 'mongodb'; -import { settings } from '../../../app/settings/server'; import { isRenderableImageType } from '../../../lib/renderableImageTypes'; import { onceTransactionCommitedSuccessfully } from '../../database/utils'; +import { settings } from '../../settings'; import { hasPermissionAsync } from '../authorization/hasPermission'; import { SystemLogger } from '../logger/system'; import { RocketChatFile } from '../media/file'; diff --git a/apps/meteor/server/lib/users/setUsername.ts b/apps/meteor/server/lib/users/setUsername.ts index be50c3491d66e..e80a528675b2d 100644 --- a/apps/meteor/server/lib/users/setUsername.ts +++ b/apps/meteor/server/lib/users/setUsername.ts @@ -13,11 +13,11 @@ import { getAvatarSuggestionForUser } from './getAvatarSuggestionForUser'; import { saveUserIdentity } from './saveUserIdentity'; import { setUserAvatar } from './setUserAvatar'; import { validateUsername } from './validateUsername'; -import { notifyOnUserChange } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; import { onceTransactionCommitedSuccessfully } from '../../database/utils'; +import { settings } from '../../settings'; import { callbacks } from '../callbacks'; import { SystemLogger } from '../logger/system'; +import { notifyOnUserChange } from '../notifyListener'; import { addUserToRoom } from '../rooms/addUserToRoom'; import { joinDefaultChannels } from '../rooms/joinDefaultChannels'; diff --git a/apps/meteor/server/lib/users/unblockUser.ts b/apps/meteor/server/lib/users/unblockUser.ts index 72186b05da99e..b47b1053bcb45 100644 --- a/apps/meteor/server/lib/users/unblockUser.ts +++ b/apps/meteor/server/lib/users/unblockUser.ts @@ -1,7 +1,7 @@ import { Subscriptions } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { notifyOnSubscriptionChangedByRoomIdAndUserIds } from '../../../app/lib/server/lib/notifyListener'; +import { notifyOnSubscriptionChangedByRoomIdAndUserIds } from '../notifyListener'; export const unblockUserMethod = async (userId: string, { rid, blocked }: { rid: string; blocked: string }): Promise => { const [blockedUser, blockerUser] = await Promise.all([ diff --git a/apps/meteor/server/lib/users/validateCustomFields.js b/apps/meteor/server/lib/users/validateCustomFields.js index 6e65fcd45fac7..306955f943cb2 100644 --- a/apps/meteor/server/lib/users/validateCustomFields.js +++ b/apps/meteor/server/lib/users/validateCustomFields.js @@ -1,7 +1,7 @@ import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../app/settings/server'; import { trim } from '../../../lib/utils/stringUtils'; +import { settings } from '../../settings'; export const validateCustomFields = function (fields) { // Special Case: diff --git a/apps/meteor/server/lib/users/validateUsername.ts b/apps/meteor/server/lib/users/validateUsername.ts index 71eaf0f665f30..6dd934aba6dcf 100644 --- a/apps/meteor/server/lib/users/validateUsername.ts +++ b/apps/meteor/server/lib/users/validateUsername.ts @@ -1,4 +1,4 @@ -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; export const validateUsername = (username: string): boolean => { const settingsRegExp = settings.get('UTF8_User_Names_Validation'); diff --git a/apps/meteor/app/utils/server/functions/getBaseUserFields.ts b/apps/meteor/server/lib/utils/functions/getBaseUserFields.ts similarity index 100% rename from apps/meteor/app/utils/server/functions/getBaseUserFields.ts rename to apps/meteor/server/lib/utils/functions/getBaseUserFields.ts diff --git a/apps/meteor/app/utils/server/functions/getDefaultUserFields.ts b/apps/meteor/server/lib/utils/functions/getDefaultUserFields.ts similarity index 100% rename from apps/meteor/app/utils/server/functions/getDefaultUserFields.ts rename to apps/meteor/server/lib/utils/functions/getDefaultUserFields.ts diff --git a/apps/meteor/app/utils/server/functions/getMongoInfo.ts b/apps/meteor/server/lib/utils/functions/getMongoInfo.ts similarity index 100% rename from apps/meteor/app/utils/server/functions/getMongoInfo.ts rename to apps/meteor/server/lib/utils/functions/getMongoInfo.ts diff --git a/apps/meteor/app/utils/server/functions/isDocker.ts b/apps/meteor/server/lib/utils/functions/isDocker.ts similarity index 100% rename from apps/meteor/app/utils/server/functions/isDocker.ts rename to apps/meteor/server/lib/utils/functions/isDocker.ts diff --git a/apps/meteor/app/utils/server/functions/isSMTPConfigured.ts b/apps/meteor/server/lib/utils/functions/isSMTPConfigured.ts similarity index 80% rename from apps/meteor/app/utils/server/functions/isSMTPConfigured.ts rename to apps/meteor/server/lib/utils/functions/isSMTPConfigured.ts index fa300cb37ee20..e4ca9b69753c6 100644 --- a/apps/meteor/app/utils/server/functions/isSMTPConfigured.ts +++ b/apps/meteor/server/lib/utils/functions/isSMTPConfigured.ts @@ -1,4 +1,4 @@ -import { settings } from '../../../settings/server'; +import { settings } from '../../../settings'; export const isSMTPConfigured = (): boolean => { const isMailURLSet = !(process.env.MAIL_URL === 'undefined' || process.env.MAIL_URL === undefined); diff --git a/apps/meteor/app/utils/server/functions/normalizeMessageFileUpload.ts b/apps/meteor/server/lib/utils/functions/normalizeMessageFileUpload.ts similarity index 92% rename from apps/meteor/app/utils/server/functions/normalizeMessageFileUpload.ts rename to apps/meteor/server/lib/utils/functions/normalizeMessageFileUpload.ts index 086e29f60e3e6..00d0484ce6942 100644 --- a/apps/meteor/app/utils/server/functions/normalizeMessageFileUpload.ts +++ b/apps/meteor/server/lib/utils/functions/normalizeMessageFileUpload.ts @@ -1,7 +1,7 @@ import type { IMessage } from '@rocket.chat/core-typings'; import { Uploads } from '@rocket.chat/models'; -import { FileUpload } from '../../../../server/lib/media/file-upload'; +import { FileUpload } from '../../media/file-upload'; import { getURL } from '../getURL'; export const normalizeMessageFileUpload = async (message: Omit): Promise> => { diff --git a/apps/meteor/app/utils/server/getAvatarURL.ts b/apps/meteor/server/lib/utils/getAvatarURL.ts similarity index 100% rename from apps/meteor/app/utils/server/getAvatarURL.ts rename to apps/meteor/server/lib/utils/getAvatarURL.ts diff --git a/apps/meteor/app/utils/server/getURL.ts b/apps/meteor/server/lib/utils/getURL.ts similarity index 81% rename from apps/meteor/app/utils/server/getURL.ts rename to apps/meteor/server/lib/utils/getURL.ts index 4703569736add..97199c3537413 100644 --- a/apps/meteor/app/utils/server/getURL.ts +++ b/apps/meteor/server/lib/utils/getURL.ts @@ -1,5 +1,5 @@ -import { settings } from '../../settings/server'; -import { getURLWithoutSettings } from '../lib/getURL'; +import { getURLWithoutSettings } from '../../../app/utils/lib/getURL'; +import { settings } from '../../settings'; export const getURL = function ( path: string, // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/app/utils/server/getUserAvatarURL.ts b/apps/meteor/server/lib/utils/getUserAvatarURL.ts similarity index 100% rename from apps/meteor/app/utils/server/getUserAvatarURL.ts rename to apps/meteor/server/lib/utils/getUserAvatarURL.ts diff --git a/apps/meteor/app/utils/server/getUserNotificationPreference.ts b/apps/meteor/server/lib/utils/getUserNotificationPreference.ts similarity index 95% rename from apps/meteor/app/utils/server/getUserNotificationPreference.ts rename to apps/meteor/server/lib/utils/getUserNotificationPreference.ts index c93eb199294b3..c38e86b9738bf 100644 --- a/apps/meteor/app/utils/server/getUserNotificationPreference.ts +++ b/apps/meteor/server/lib/utils/getUserNotificationPreference.ts @@ -1,7 +1,7 @@ import type { IUser } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; -import { settings } from '../../settings/server'; +import { settings } from '../../settings'; export const getUserNotificationPreference = async (user: IUser | string, pref: string) => { if (typeof user === 'string') { diff --git a/apps/meteor/app/utils/server/lib/JWTHelper.spec.ts b/apps/meteor/server/lib/utils/lib/JWTHelper.spec.ts similarity index 100% rename from apps/meteor/app/utils/server/lib/JWTHelper.spec.ts rename to apps/meteor/server/lib/utils/lib/JWTHelper.spec.ts diff --git a/apps/meteor/app/utils/server/lib/JWTHelper.ts b/apps/meteor/server/lib/utils/lib/JWTHelper.ts similarity index 100% rename from apps/meteor/app/utils/server/lib/JWTHelper.ts rename to apps/meteor/server/lib/utils/lib/JWTHelper.ts diff --git a/apps/meteor/app/utils/lib/getAvatarColor.ts b/apps/meteor/server/lib/utils/lib/getAvatarColor.ts similarity index 100% rename from apps/meteor/app/utils/lib/getAvatarColor.ts rename to apps/meteor/server/lib/utils/lib/getAvatarColor.ts diff --git a/apps/meteor/app/utils/lib/getDefaultSubscriptionPref.ts b/apps/meteor/server/lib/utils/lib/getDefaultSubscriptionPref.ts similarity index 100% rename from apps/meteor/app/utils/lib/getDefaultSubscriptionPref.ts rename to apps/meteor/server/lib/utils/lib/getDefaultSubscriptionPref.ts diff --git a/apps/meteor/app/utils/server/lib/getTimezone.ts b/apps/meteor/server/lib/utils/lib/getTimezone.ts similarity index 94% rename from apps/meteor/app/utils/server/lib/getTimezone.ts rename to apps/meteor/server/lib/utils/lib/getTimezone.ts index 8cbc5056783da..76ef6af9595cd 100644 --- a/apps/meteor/app/utils/server/lib/getTimezone.ts +++ b/apps/meteor/server/lib/utils/lib/getTimezone.ts @@ -1,6 +1,6 @@ import moment from 'moment-timezone'; -import { settings } from '../../../settings/server'; +import { settings } from '../../../settings'; const padOffset = (offset: string | number): string => { const numberOffset = Number(offset); diff --git a/apps/meteor/app/utils/server/lib/getUserPreference.ts b/apps/meteor/server/lib/utils/lib/getUserPreference.ts similarity index 94% rename from apps/meteor/app/utils/server/lib/getUserPreference.ts rename to apps/meteor/server/lib/utils/lib/getUserPreference.ts index 683985e5626f1..91c2e4f5193ab 100644 --- a/apps/meteor/app/utils/server/lib/getUserPreference.ts +++ b/apps/meteor/server/lib/utils/lib/getUserPreference.ts @@ -1,7 +1,7 @@ import type { IUser } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; -import { settings } from '../../../settings/server'; +import { settings } from '../../../settings'; /** * @summary Get a user preference diff --git a/apps/meteor/app/utils/server/lib/getValidRoomName.ts b/apps/meteor/server/lib/utils/lib/getValidRoomName.ts similarity index 95% rename from apps/meteor/app/utils/server/lib/getValidRoomName.ts rename to apps/meteor/server/lib/utils/lib/getValidRoomName.ts index a1f4b457b237a..597d761cfac5c 100644 --- a/apps/meteor/app/utils/server/lib/getValidRoomName.ts +++ b/apps/meteor/server/lib/utils/lib/getValidRoomName.ts @@ -3,8 +3,8 @@ import { escapeHTML } from '@rocket.chat/string-helpers'; import limax from 'limax'; import { Meteor } from 'meteor/meteor'; -import { validateName } from '../../../../server/lib/shared/validateName'; -import { settings } from '../../../settings/server'; +import { settings } from '../../../settings'; +import { validateName } from '../../shared/validateName'; export const getValidRoomName = async (displayName: string, rid = '', options: { allowDuplicates?: boolean } = {}) => { let slugifiedName = displayName; diff --git a/apps/meteor/app/utils/server/lib/normalizeMessagesForUser.ts b/apps/meteor/server/lib/utils/lib/normalizeMessagesForUser.ts similarity index 97% rename from apps/meteor/app/utils/server/lib/normalizeMessagesForUser.ts rename to apps/meteor/server/lib/utils/lib/normalizeMessagesForUser.ts index 3b34fe3aacec3..b612c2397c86b 100644 --- a/apps/meteor/app/utils/server/lib/normalizeMessagesForUser.ts +++ b/apps/meteor/server/lib/utils/lib/normalizeMessagesForUser.ts @@ -1,7 +1,7 @@ import type { IMessage } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; -import { settings } from '../../../settings/server'; +import { settings } from '../../../settings'; const filterStarred = (message: T, uid?: string): T => { // if Allow_anonymous_read is enabled, uid will be undefined diff --git a/apps/meteor/app/utils/lib/templateVarHandler.ts b/apps/meteor/server/lib/utils/lib/templateVarHandler.ts similarity index 100% rename from apps/meteor/app/utils/lib/templateVarHandler.ts rename to apps/meteor/server/lib/utils/lib/templateVarHandler.ts diff --git a/apps/meteor/app/utils/server/placeholders.ts b/apps/meteor/server/lib/utils/placeholders.ts similarity index 95% rename from apps/meteor/app/utils/server/placeholders.ts rename to apps/meteor/server/lib/utils/placeholders.ts index bbc36e49be7be..e717eed08c647 100644 --- a/apps/meteor/app/utils/server/placeholders.ts +++ b/apps/meteor/server/lib/utils/placeholders.ts @@ -1,5 +1,5 @@ import { strLeft, strRightBack } from '../../../lib/utils/stringUtils'; -import { settings } from '../../settings/server'; +import { settings } from '../../settings'; export const placeholders = { replace: ( diff --git a/apps/meteor/app/utils/server/restrictions.ts b/apps/meteor/server/lib/utils/restrictions.ts similarity index 72% rename from apps/meteor/app/utils/server/restrictions.ts rename to apps/meteor/server/lib/utils/restrictions.ts index 6eb1c9a655d4a..1604101abec2f 100644 --- a/apps/meteor/app/utils/server/restrictions.ts +++ b/apps/meteor/server/lib/utils/restrictions.ts @@ -1,5 +1,5 @@ -import { settings } from '../../settings/server'; -import { fileUploadIsValidContentTypeFromSettings } from '../lib/restrictions'; +import { fileUploadIsValidContentTypeFromSettings } from '../../../app/utils/lib/restrictions'; +import { settings } from '../../settings'; export const fileUploadIsValidContentType = function (type: string | undefined, customWhiteList?: string): boolean { const blackList = settings.get('FileUpload_MediaTypeBlackList'); diff --git a/apps/meteor/app/utils/server/slashCommand.ts b/apps/meteor/server/lib/utils/slashCommand.ts similarity index 97% rename from apps/meteor/app/utils/server/slashCommand.ts rename to apps/meteor/server/lib/utils/slashCommand.ts index faa9f0606650f..e3ce3aed19e81 100644 --- a/apps/meteor/app/utils/server/slashCommand.ts +++ b/apps/meteor/server/lib/utils/slashCommand.ts @@ -10,7 +10,7 @@ import type { import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../lib/server/lib/deprecationWarningLogger'; +import { methodDeprecationLogger } from '../deprecationWarningLogger'; interface ISlashCommandAddParams { command: string; diff --git a/apps/meteor/app/lib/server/lib/validateEmailDomain.js b/apps/meteor/server/lib/validateEmailDomain.js similarity index 97% rename from apps/meteor/app/lib/server/lib/validateEmailDomain.js rename to apps/meteor/server/lib/validateEmailDomain.js index fbf17b8511b51..8cd8ea9d3c1ef 100644 --- a/apps/meteor/app/lib/server/lib/validateEmailDomain.js +++ b/apps/meteor/server/lib/validateEmailDomain.js @@ -5,7 +5,7 @@ import { validateEmail } from '@rocket.chat/tools'; import { Meteor } from 'meteor/meteor'; import { emailDomainDefaultBlackList } from './defaultBlockedDomainsList'; -import { settings } from '../../../settings/server'; +import { settings } from '../settings'; const dnsResolveMx = util.promisify(dns.resolveMx); diff --git a/apps/meteor/server/lib/videoConfProviders.ts b/apps/meteor/server/lib/videoConfProviders.ts index 74374822e0527..4c753c15fe2bf 100644 --- a/apps/meteor/server/lib/videoConfProviders.ts +++ b/apps/meteor/server/lib/videoConfProviders.ts @@ -1,6 +1,6 @@ import type { VideoConferenceCapabilities } from '@rocket.chat/core-typings'; -import { settings } from '../../app/settings/server'; +import { settings } from '../settings'; const providers = new Map(); diff --git a/apps/meteor/server/main.ts b/apps/meteor/server/main.ts index fbf3855941020..17f2557a4e4f8 100644 --- a/apps/meteor/server/main.ts +++ b/apps/meteor/server/main.ts @@ -5,18 +5,19 @@ import './models'; * ./settings uses top level await, in theory the settings creation * and the startup should be done in parallel */ -import './settings'; +import './settings/definitions'; import { startRestAPI } from './api/api'; import { configureServer } from './configuration'; import { registerServices } from './services/startup'; +import { settings } from './settings'; import { startup } from './startup'; -import { settings } from '../app/settings/server'; import { startupApp } from '../ee/server'; import { startRocketChat } from '../startRocketChat'; import './routes'; -import '../app/lib/server/startup'; +import './startup/rateLimiter'; +import './startup/robots'; import './importPackages'; import './meteor-methods'; import './publications'; diff --git a/apps/meteor/server/meteor-methods/auth/addPermissionToRole.ts b/apps/meteor/server/meteor-methods/auth/addPermissionToRole.ts index f9578ab4f9fe2..195af72c8c1d7 100644 --- a/apps/meteor/server/meteor-methods/auth/addPermissionToRole.ts +++ b/apps/meteor/server/meteor-methods/auth/addPermissionToRole.ts @@ -1,8 +1,8 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; import { addPermissionToRoleMethod } from '../../lib/authorization/permissionRole'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/auth/addUserToRole.ts b/apps/meteor/server/meteor-methods/auth/addUserToRole.ts index 1629f2834c573..cefb9c41d834c 100644 --- a/apps/meteor/server/meteor-methods/auth/addUserToRole.ts +++ b/apps/meteor/server/meteor-methods/auth/addUserToRole.ts @@ -3,9 +3,9 @@ import type { IRole, IUser } from '@rocket.chat/core-typings'; import { Roles, Users } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../app/settings/server'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { addUserRolesAsync } from '../../lib/roles/addUserRoles'; +import { settings } from '../../settings'; export const addUserToRole = async (userId: string, roleId: string, username: IUser['username'], scope?: string): Promise => { if (!(await hasPermissionAsync(userId, 'access-permissions'))) { diff --git a/apps/meteor/server/meteor-methods/auth/afterVerifyEmail.ts b/apps/meteor/server/meteor-methods/auth/afterVerifyEmail.ts index 26e352ed511f7..dd7dc0cf2d2f5 100644 --- a/apps/meteor/server/meteor-methods/auth/afterVerifyEmail.ts +++ b/apps/meteor/server/meteor-methods/auth/afterVerifyEmail.ts @@ -1,7 +1,7 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { runAfterVerifyEmail } from '../../lib/users/runAfterVerifyEmail'; declare module '@rocket.chat/ddp-client' { diff --git a/apps/meteor/server/meteor-methods/auth/checkRegistrationSecretURL.ts b/apps/meteor/server/meteor-methods/auth/checkRegistrationSecretURL.ts index acc90af3b9908..4dfcd404a2a47 100644 --- a/apps/meteor/server/meteor-methods/auth/checkRegistrationSecretURL.ts +++ b/apps/meteor/server/meteor-methods/auth/checkRegistrationSecretURL.ts @@ -2,7 +2,7 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; Meteor.methods({ checkRegistrationSecretURL(hash) { diff --git a/apps/meteor/server/meteor-methods/auth/crowd.ts b/apps/meteor/server/meteor-methods/auth/crowd.ts index a7b7b683ad745..7babe2fa5239f 100644 --- a/apps/meteor/server/meteor-methods/auth/crowd.ts +++ b/apps/meteor/server/meteor-methods/auth/crowd.ts @@ -2,10 +2,10 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import type { TranslationKey } from '@rocket.chat/ui-contexts'; import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../app/settings/server'; import { CROWD } from '../../lib/auth-providers/crowd/crowd'; import { logger } from '../../lib/auth-providers/crowd/logger'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/app/oauth2-server-config/server/admin/methods/deleteOAuthApp.ts b/apps/meteor/server/meteor-methods/auth/deleteOAuthApp.ts similarity index 88% rename from apps/meteor/app/oauth2-server-config/server/admin/methods/deleteOAuthApp.ts rename to apps/meteor/server/meteor-methods/auth/deleteOAuthApp.ts index fb3f10e9b6d43..142b78fc3b588 100644 --- a/apps/meteor/app/oauth2-server-config/server/admin/methods/deleteOAuthApp.ts +++ b/apps/meteor/server/meteor-methods/auth/deleteOAuthApp.ts @@ -3,8 +3,8 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { OAuthAccessTokens, OAuthApps, OAuthAuthCodes } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { hasPermissionAsync } from '../../../../../server/lib/authorization/hasPermission'; -import { methodDeprecationLogger } from '../../../../lib/server/lib/deprecationWarningLogger'; +import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/auth/disable.ts b/apps/meteor/server/meteor-methods/auth/disable.ts index 8d943a76a5db4..22426f60a5595 100644 --- a/apps/meteor/server/meteor-methods/auth/disable.ts +++ b/apps/meteor/server/meteor-methods/auth/disable.ts @@ -2,8 +2,8 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Users } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { notifyOnUserChange } from '../../../app/lib/server/lib/notifyListener'; import { TOTP } from '../../lib/2fa/lib/totp'; +import { notifyOnUserChange } from '../../lib/notifyListener'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/auth/logoutCleanUp.ts b/apps/meteor/server/meteor-methods/auth/logoutCleanUp.ts index 803adf743a81c..6bf50784993cf 100644 --- a/apps/meteor/server/meteor-methods/auth/logoutCleanUp.ts +++ b/apps/meteor/server/meteor-methods/auth/logoutCleanUp.ts @@ -4,8 +4,8 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; import { afterLogoutCleanUpCallback } from '../../lib/callbacks/afterLogoutCleanUpCallback'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/auth/removeOAuthService.ts b/apps/meteor/server/meteor-methods/auth/removeOAuthService.ts index 89ad498543e7c..ccbd90e721837 100644 --- a/apps/meteor/server/meteor-methods/auth/removeOAuthService.ts +++ b/apps/meteor/server/meteor-methods/auth/removeOAuthService.ts @@ -4,8 +4,8 @@ import { capitalize } from '@rocket.chat/string-helpers'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { notifyOnSettingChangedById } from '../../../app/lib/server/lib/notifyListener'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { notifyOnSettingChangedById } from '../../lib/notifyListener'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/auth/removeRoleFromPermission.ts b/apps/meteor/server/meteor-methods/auth/removeRoleFromPermission.ts index 647e1ea128774..ef083d3feefd1 100644 --- a/apps/meteor/server/meteor-methods/auth/removeRoleFromPermission.ts +++ b/apps/meteor/server/meteor-methods/auth/removeRoleFromPermission.ts @@ -1,8 +1,8 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; import { removeRoleFromPermissionMethod } from '../../lib/authorization/permissionRole'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/auth/removeUserFromRole.ts b/apps/meteor/server/meteor-methods/auth/removeUserFromRole.ts index 54bb2910dc80d..bc64cc0f92f25 100644 --- a/apps/meteor/server/meteor-methods/auth/removeUserFromRole.ts +++ b/apps/meteor/server/meteor-methods/auth/removeUserFromRole.ts @@ -3,9 +3,9 @@ import type { IRole, IUser } from '@rocket.chat/core-typings'; import { Roles, Users } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../app/settings/server'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { removeUserFromRolesAsync } from '../../lib/roles/removeUserFromRoles'; +import { settings } from '../../settings'; export const removeUserFromRole = async (userId: string, roleId: string, username: IUser['username'], scope?: string): Promise => { if (!(await hasPermissionAsync(userId, 'access-permissions'))) { diff --git a/apps/meteor/server/meteor-methods/auth/sendForgotPasswordEmail.ts b/apps/meteor/server/meteor-methods/auth/sendForgotPasswordEmail.ts index ecaf401b2862c..e49c1dce0da09 100644 --- a/apps/meteor/server/meteor-methods/auth/sendForgotPasswordEmail.ts +++ b/apps/meteor/server/meteor-methods/auth/sendForgotPasswordEmail.ts @@ -4,8 +4,8 @@ import { Accounts } from 'meteor/accounts-base'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../app/settings/server'; import { SystemLogger } from '../../lib/logger/system'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/app/oauth2-server-config/server/admin/methods/updateOAuthApp.ts b/apps/meteor/server/meteor-methods/auth/updateOAuthApp.ts similarity index 91% rename from apps/meteor/app/oauth2-server-config/server/admin/methods/updateOAuthApp.ts rename to apps/meteor/server/meteor-methods/auth/updateOAuthApp.ts index 3162a71802280..8aaefc3fdd5b0 100644 --- a/apps/meteor/app/oauth2-server-config/server/admin/methods/updateOAuthApp.ts +++ b/apps/meteor/server/meteor-methods/auth/updateOAuthApp.ts @@ -3,9 +3,9 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { OAuthApps, Users } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { hasPermissionAsync } from '../../../../../server/lib/authorization/hasPermission'; -import { methodDeprecationLogger } from '../../../../lib/server/lib/deprecationWarningLogger'; -import { parseUriList } from '../functions/parseUriList'; +import { parseUriList } from '../../lib/auth/oauth2-server/parseUriList'; +import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/auth/validateTempToken.ts b/apps/meteor/server/meteor-methods/auth/validateTempToken.ts index 083a597154264..2bf1e0954885d 100644 --- a/apps/meteor/server/meteor-methods/auth/validateTempToken.ts +++ b/apps/meteor/server/meteor-methods/auth/validateTempToken.ts @@ -3,8 +3,8 @@ import { Users } from '@rocket.chat/models'; import { Accounts } from 'meteor/accounts-base'; import { Meteor } from 'meteor/meteor'; -import { notifyOnUserChange, notifyOnUserChangeAsync } from '../../../app/lib/server/lib/notifyListener'; import { TOTP } from '../../lib/2fa/lib/totp'; +import { notifyOnUserChange, notifyOnUserChangeAsync } from '../../lib/notifyListener'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/import/downloadPublicImportFile.ts b/apps/meteor/server/meteor-methods/import/downloadPublicImportFile.ts index 439613c3ec556..ac2086b49b506 100644 --- a/apps/meteor/server/meteor-methods/import/downloadPublicImportFile.ts +++ b/apps/meteor/server/meteor-methods/import/downloadPublicImportFile.ts @@ -8,8 +8,8 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Meteor } from 'meteor/meteor'; import { ProgressStep } from '../../../app/importer/lib/ImporterProgressStep'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { Importers } from '../../lib/import'; import { RocketChatImportFileInstance } from '../../lib/import/startup/store'; diff --git a/apps/meteor/server/meteor-methods/import/getImportFileData.ts b/apps/meteor/server/meteor-methods/import/getImportFileData.ts index 063628334eca5..7f4a03e13ede8 100644 --- a/apps/meteor/server/meteor-methods/import/getImportFileData.ts +++ b/apps/meteor/server/meteor-methods/import/getImportFileData.ts @@ -7,8 +7,8 @@ import { Imports } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; import { ProgressStep } from '../../../app/importer/lib/ImporterProgressStep'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { Importers } from '../../lib/import'; import { RocketChatImportFileInstance } from '../../lib/import/startup/store'; diff --git a/apps/meteor/server/meteor-methods/import/getImportProgress.ts b/apps/meteor/server/meteor-methods/import/getImportProgress.ts index e86b9b8eaddd3..88027519a268c 100644 --- a/apps/meteor/server/meteor-methods/import/getImportProgress.ts +++ b/apps/meteor/server/meteor-methods/import/getImportProgress.ts @@ -3,8 +3,8 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Imports } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { Importers } from '../../lib/import'; export const executeGetImportProgress = async (): Promise => { diff --git a/apps/meteor/server/meteor-methods/import/getLatestImportOperations.ts b/apps/meteor/server/meteor-methods/import/getLatestImportOperations.ts index 9203028711b15..3537edd0279c3 100644 --- a/apps/meteor/server/meteor-methods/import/getLatestImportOperations.ts +++ b/apps/meteor/server/meteor-methods/import/getLatestImportOperations.ts @@ -3,8 +3,8 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Imports } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; export const executeGetLatestImportOperations = async () => { const data = Imports.find( diff --git a/apps/meteor/server/meteor-methods/import/startImport.ts b/apps/meteor/server/meteor-methods/import/startImport.ts index 26fb6892df705..3ad56c8efeef5 100644 --- a/apps/meteor/server/meteor-methods/import/startImport.ts +++ b/apps/meteor/server/meteor-methods/import/startImport.ts @@ -4,8 +4,8 @@ import { Imports } from '@rocket.chat/models'; import { isStartImportParamsPOST, type StartImportParamsPOST } from '@rocket.chat/rest-typings'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { Importers } from '../../lib/import'; export const executeStartImport = async ({ input }: StartImportParamsPOST, startedByUserId: IUser['_id']) => { diff --git a/apps/meteor/server/meteor-methods/import/uploadImportFile.ts b/apps/meteor/server/meteor-methods/import/uploadImportFile.ts index d0bef121b9c6e..afa243d1f2c57 100644 --- a/apps/meteor/server/meteor-methods/import/uploadImportFile.ts +++ b/apps/meteor/server/meteor-methods/import/uploadImportFile.ts @@ -4,8 +4,8 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Meteor } from 'meteor/meteor'; import { ProgressStep } from '../../../app/importer/lib/ImporterProgressStep'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { Importers } from '../../lib/import'; import { RocketChatImportFileInstance } from '../../lib/import/startup/store'; import { RocketChatFile } from '../../lib/media/file'; diff --git a/apps/meteor/server/meteor-methods/index.ts b/apps/meteor/server/meteor-methods/index.ts index 107db7b1c562b..1dd0b3cd2104e 100644 --- a/apps/meteor/server/meteor-methods/index.ts +++ b/apps/meteor/server/meteor-methods/index.ts @@ -124,11 +124,15 @@ import './settings/saveSetting'; import './settings/saveSettings'; import './settings/sendSMTPTestEmail'; import './users/blockUser'; +import './users/deleteCustomUserStatus'; import './users/deleteUser'; import './users/deleteUserOwnAccount'; import './users/getUsernameSuggestion'; import './users/getUsersOfRoom'; +import './users/getUserStatusText'; import './users/ignoreUser'; +import './users/insertOrUpdateUserStatus'; +import './users/listCustomUserStatus'; import './users/registerUser'; import './users/resetAvatar'; import './users/saveNotificationSettings'; @@ -138,6 +142,7 @@ import './users/setAvatarFromService'; import './users/setEmail'; import './users/setRealName'; import './users/setUserActiveStatus'; +import './users/setUserStatus'; import './users/unblockUser'; import './users/userPresence'; import './users/userSetUtcOffset'; diff --git a/apps/meteor/server/meteor-methods/integrations/clearIntegrationHistory.ts b/apps/meteor/server/meteor-methods/integrations/clearIntegrationHistory.ts index 09ada3bf5acac..3c19390e7a3ff 100644 --- a/apps/meteor/server/meteor-methods/integrations/clearIntegrationHistory.ts +++ b/apps/meteor/server/meteor-methods/integrations/clearIntegrationHistory.ts @@ -1,7 +1,7 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { clearIntegrationHistoryMethod } from '../../lib/integrations/functions/clearIntegrationHistory'; declare module '@rocket.chat/ddp-client' { diff --git a/apps/meteor/server/meteor-methods/integrations/incoming/addIncomingIntegration.ts b/apps/meteor/server/meteor-methods/integrations/incoming/addIncomingIntegration.ts index fd42eae90a396..a42a9d4af8c7b 100644 --- a/apps/meteor/server/meteor-methods/integrations/incoming/addIncomingIntegration.ts +++ b/apps/meteor/server/meteor-methods/integrations/incoming/addIncomingIntegration.ts @@ -6,11 +6,11 @@ import { removeEmpty } from '@rocket.chat/tools'; import { Match, check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../../app/lib/server/lib/deprecationWarningLogger'; -import { notifyOnIntegrationChanged } from '../../../../app/lib/server/lib/notifyListener'; import { hasPermissionAsync, hasAllPermissionAsync } from '../../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../../lib/deprecationWarningLogger'; import { compileIntegrationScript } from '../../../lib/integrations/lib/compileIntegrationScript'; import { validateScriptEngine, isScriptEngineFrozen } from '../../../lib/integrations/lib/validateScriptEngine'; +import { notifyOnIntegrationChanged } from '../../../lib/notifyListener'; const validChannelChars = ['@', '#']; diff --git a/apps/meteor/server/meteor-methods/integrations/incoming/deleteIncomingIntegration.ts b/apps/meteor/server/meteor-methods/integrations/incoming/deleteIncomingIntegration.ts index ca648b6e3f0e6..57435c6e216e0 100644 --- a/apps/meteor/server/meteor-methods/integrations/incoming/deleteIncomingIntegration.ts +++ b/apps/meteor/server/meteor-methods/integrations/incoming/deleteIncomingIntegration.ts @@ -2,9 +2,9 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Integrations } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../../app/lib/server/lib/deprecationWarningLogger'; -import { notifyOnIntegrationChanged } from '../../../../app/lib/server/lib/notifyListener'; import { hasPermissionAsync } from '../../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../../lib/deprecationWarningLogger'; +import { notifyOnIntegrationChanged } from '../../../lib/notifyListener'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/integrations/incoming/updateIncomingIntegration.ts b/apps/meteor/server/meteor-methods/integrations/incoming/updateIncomingIntegration.ts index f662564f49515..663a1c9858a70 100644 --- a/apps/meteor/server/meteor-methods/integrations/incoming/updateIncomingIntegration.ts +++ b/apps/meteor/server/meteor-methods/integrations/incoming/updateIncomingIntegration.ts @@ -4,11 +4,11 @@ import { Integrations, Subscriptions, Users, Rooms } from '@rocket.chat/models'; import { wrapExceptions } from '@rocket.chat/tools'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../../app/lib/server/lib/deprecationWarningLogger'; -import { notifyOnIntegrationChanged } from '../../../../app/lib/server/lib/notifyListener'; import { hasAllPermissionAsync, hasPermissionAsync } from '../../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../../lib/deprecationWarningLogger'; import { compileIntegrationScript } from '../../../lib/integrations/lib/compileIntegrationScript'; import { isScriptEngineFrozen, validateScriptEngine } from '../../../lib/integrations/lib/validateScriptEngine'; +import { notifyOnIntegrationChanged } from '../../../lib/notifyListener'; const validChannelChars = ['@', '#']; diff --git a/apps/meteor/server/meteor-methods/integrations/outgoing/addOutgoingIntegration.ts b/apps/meteor/server/meteor-methods/integrations/outgoing/addOutgoingIntegration.ts index ac64ca256c02e..9c899cb5afc50 100644 --- a/apps/meteor/server/meteor-methods/integrations/outgoing/addOutgoingIntegration.ts +++ b/apps/meteor/server/meteor-methods/integrations/outgoing/addOutgoingIntegration.ts @@ -5,11 +5,11 @@ import { removeEmpty } from '@rocket.chat/tools'; import { Match, check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../../app/lib/server/lib/deprecationWarningLogger'; -import { notifyOnIntegrationChanged } from '../../../../app/lib/server/lib/notifyListener'; import { hasPermissionAsync } from '../../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../../lib/deprecationWarningLogger'; import { validateOutgoingIntegration } from '../../../lib/integrations/lib/validateOutgoingIntegration'; import { validateScriptEngine } from '../../../lib/integrations/lib/validateScriptEngine'; +import { notifyOnIntegrationChanged } from '../../../lib/notifyListener'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/integrations/outgoing/deleteOutgoingIntegration.ts b/apps/meteor/server/meteor-methods/integrations/outgoing/deleteOutgoingIntegration.ts index c6aceae90150f..ff04326575b23 100644 --- a/apps/meteor/server/meteor-methods/integrations/outgoing/deleteOutgoingIntegration.ts +++ b/apps/meteor/server/meteor-methods/integrations/outgoing/deleteOutgoingIntegration.ts @@ -2,9 +2,9 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Integrations, IntegrationHistory } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../../app/lib/server/lib/deprecationWarningLogger'; -import { notifyOnIntegrationChanged } from '../../../../app/lib/server/lib/notifyListener'; import { hasPermissionAsync } from '../../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../../lib/deprecationWarningLogger'; +import { notifyOnIntegrationChanged } from '../../../lib/notifyListener'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/integrations/outgoing/replayOutgoingIntegration.ts b/apps/meteor/server/meteor-methods/integrations/outgoing/replayOutgoingIntegration.ts index 01c488b8c86a1..589a6e587b7b7 100644 --- a/apps/meteor/server/meteor-methods/integrations/outgoing/replayOutgoingIntegration.ts +++ b/apps/meteor/server/meteor-methods/integrations/outgoing/replayOutgoingIntegration.ts @@ -1,7 +1,7 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../../app/lib/server/lib/deprecationWarningLogger'; +import { methodDeprecationLogger } from '../../../lib/deprecationWarningLogger'; import { replayOutgoingIntegrationMethod } from '../../../lib/integrations/functions/clearIntegrationHistory'; declare module '@rocket.chat/ddp-client' { diff --git a/apps/meteor/server/meteor-methods/integrations/outgoing/updateOutgoingIntegration.ts b/apps/meteor/server/meteor-methods/integrations/outgoing/updateOutgoingIntegration.ts index fbc2d4841eb8f..7fb5ddf91be61 100644 --- a/apps/meteor/server/meteor-methods/integrations/outgoing/updateOutgoingIntegration.ts +++ b/apps/meteor/server/meteor-methods/integrations/outgoing/updateOutgoingIntegration.ts @@ -4,11 +4,11 @@ import { Integrations, Users } from '@rocket.chat/models'; import { wrapExceptions } from '@rocket.chat/tools'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../../app/lib/server/lib/deprecationWarningLogger'; -import { notifyOnIntegrationChanged } from '../../../../app/lib/server/lib/notifyListener'; import { hasPermissionAsync } from '../../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../../lib/deprecationWarningLogger'; import { validateOutgoingIntegration } from '../../../lib/integrations/lib/validateOutgoingIntegration'; import { isScriptEngineFrozen, validateScriptEngine } from '../../../lib/integrations/lib/validateScriptEngine'; +import { notifyOnIntegrationChanged } from '../../../lib/notifyListener'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/media/deleteCustomSound.ts b/apps/meteor/server/meteor-methods/media/deleteCustomSound.ts index 3f79f45c3ddad..065b2b01d591d 100644 --- a/apps/meteor/server/meteor-methods/media/deleteCustomSound.ts +++ b/apps/meteor/server/meteor-methods/media/deleteCustomSound.ts @@ -3,8 +3,8 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { deleteCustomSound } from '../../lib/media/custom-sounds/lib/deleteCustomSound'; declare module '@rocket.chat/ddp-client' { diff --git a/apps/meteor/server/meteor-methods/media/deleteEmojiCustom.ts b/apps/meteor/server/meteor-methods/media/deleteEmojiCustom.ts index fcaf627b061cc..0bb4372aec97f 100644 --- a/apps/meteor/server/meteor-methods/media/deleteEmojiCustom.ts +++ b/apps/meteor/server/meteor-methods/media/deleteEmojiCustom.ts @@ -4,8 +4,8 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { EmojiCustom } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { RocketChatFileEmojiCustomInstance } from '../../lib/media/emoji-custom/startup/emoji-custom'; declare module '@rocket.chat/ddp-client' { diff --git a/apps/meteor/server/meteor-methods/media/getS3FileUrl.ts b/apps/meteor/server/meteor-methods/media/getS3FileUrl.ts index cf56e466495f5..14317192543b4 100644 --- a/apps/meteor/server/meteor-methods/media/getS3FileUrl.ts +++ b/apps/meteor/server/meteor-methods/media/getS3FileUrl.ts @@ -3,8 +3,8 @@ import { Rooms, Uploads } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { canAccessRoomAsync } from '../../../app/authorization/server'; -import { settings } from '../../../app/settings/server'; +import { canAccessRoomAsync } from '../../lib/authorization'; +import { settings } from '../../settings'; import { UploadFS } from '../../ufs'; declare module '@rocket.chat/ddp-client' { diff --git a/apps/meteor/server/meteor-methods/media/insertOrUpdateEmoji.ts b/apps/meteor/server/meteor-methods/media/insertOrUpdateEmoji.ts index e7fca91ef819e..fd8cdc0a456ec 100644 --- a/apps/meteor/server/meteor-methods/media/insertOrUpdateEmoji.ts +++ b/apps/meteor/server/meteor-methods/media/insertOrUpdateEmoji.ts @@ -1,7 +1,7 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { insertOrUpdateEmoji } from '../../lib/media/emoji-custom/lib/insertOrUpdateEmoji'; declare module '@rocket.chat/ddp-client' { diff --git a/apps/meteor/server/meteor-methods/media/insertOrUpdateSound.ts b/apps/meteor/server/meteor-methods/media/insertOrUpdateSound.ts index 96f92f258eebc..31525b2529d9b 100644 --- a/apps/meteor/server/meteor-methods/media/insertOrUpdateSound.ts +++ b/apps/meteor/server/meteor-methods/media/insertOrUpdateSound.ts @@ -2,8 +2,8 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { insertOrUpdateSound } from '../../lib/media/custom-sounds/lib/insertOrUpdateSound'; export type ICustomSoundData = { diff --git a/apps/meteor/server/meteor-methods/media/listCustomSounds.ts b/apps/meteor/server/meteor-methods/media/listCustomSounds.ts index ac3386783a8be..14f4b81624ff8 100644 --- a/apps/meteor/server/meteor-methods/media/listCustomSounds.ts +++ b/apps/meteor/server/meteor-methods/media/listCustomSounds.ts @@ -3,7 +3,7 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { CustomSounds } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/media/uploadCustomSound.ts b/apps/meteor/server/meteor-methods/media/uploadCustomSound.ts index a5a23a031d62c..ee0027448b5c0 100644 --- a/apps/meteor/server/meteor-methods/media/uploadCustomSound.ts +++ b/apps/meteor/server/meteor-methods/media/uploadCustomSound.ts @@ -3,8 +3,8 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Meteor } from 'meteor/meteor'; import type { ICustomSoundData } from './insertOrUpdateSound'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { uploadCustomSound } from '../../lib/media/custom-sounds/lib/uploadCustomSound'; declare module '@rocket.chat/ddp-client' { diff --git a/apps/meteor/server/meteor-methods/media/uploadEmojiCustom.ts b/apps/meteor/server/meteor-methods/media/uploadEmojiCustom.ts index f67ec2dea80e0..231cdbb7a19df 100644 --- a/apps/meteor/server/meteor-methods/media/uploadEmojiCustom.ts +++ b/apps/meteor/server/meteor-methods/media/uploadEmojiCustom.ts @@ -1,7 +1,7 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { uploadEmojiCustom } from '../../lib/media/emoji-custom/lib/uploadEmojiCustom'; declare module '@rocket.chat/ddp-client' { diff --git a/apps/meteor/server/meteor-methods/messages/createDirectMessage.ts b/apps/meteor/server/meteor-methods/messages/createDirectMessage.ts index d3f8b3bccaa0a..bfbe7f244e160 100644 --- a/apps/meteor/server/meteor-methods/messages/createDirectMessage.ts +++ b/apps/meteor/server/meteor-methods/messages/createDirectMessage.ts @@ -5,11 +5,11 @@ import { Rooms, Users } from '@rocket.chat/models'; import { check, Match } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { RateLimiterClass as RateLimiter } from '../../../app/lib/server/lib/RateLimiter'; -import { settings } from '../../../app/settings/server'; +import { RateLimiterClass as RateLimiter } from '../../lib/RateLimiter'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { callbacks } from '../../lib/callbacks'; import { createRoom } from '../../lib/rooms/createRoom'; +import { settings } from '../../settings'; export async function createDirectMessage( usernames: IUser['username'][], diff --git a/apps/meteor/server/meteor-methods/messages/createDiscussion.ts b/apps/meteor/server/meteor-methods/messages/createDiscussion.ts index e68ef0a0d0be2..3d45e4842a6fa 100644 --- a/apps/meteor/server/meteor-methods/messages/createDiscussion.ts +++ b/apps/meteor/server/meteor-methods/messages/createDiscussion.ts @@ -6,17 +6,17 @@ import { Random } from '@rocket.chat/random'; import { check, Match } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { settings } from '../../../app/settings/server'; import { afterSaveMessageAsync } from '../../hooks/messages/afterSaveMessage'; import { canSendMessageAsync } from '../../lib/authorization/canSendMessage'; import { hasAtLeastOnePermissionAsync } from '../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { i18n } from '../../lib/i18n'; import { attachMessage } from '../../lib/messages/attachMessage'; import { sendMessage } from '../../lib/messages/sendMessage'; import { addUserToRoom } from '../../lib/rooms/addUserToRoom'; import { createRoom } from '../../lib/rooms/createRoom'; import { roomCoordinator } from '../../lib/rooms/roomCoordinator'; +import { settings } from '../../settings'; const getParentRoom = async (rid: IRoom['_id']) => { const room = await Rooms.findOne(rid); diff --git a/apps/meteor/server/meteor-methods/messages/deleteFileMessage.ts b/apps/meteor/server/meteor-methods/messages/deleteFileMessage.ts index bde3279aea23c..75a04e525ecb2 100644 --- a/apps/meteor/server/meteor-methods/messages/deleteFileMessage.ts +++ b/apps/meteor/server/meteor-methods/messages/deleteFileMessage.ts @@ -5,7 +5,7 @@ import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; import type { DeleteResult } from 'mongodb'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { FileUpload } from '../../lib/media/file-upload'; import { deleteMessageValidatingPermission } from '../../lib/messages/deleteMessage'; diff --git a/apps/meteor/server/meteor-methods/messages/executeSlashCommandPreview.ts b/apps/meteor/server/meteor-methods/messages/executeSlashCommandPreview.ts index 9d7a64228fd68..e40bca4b49927 100644 --- a/apps/meteor/server/meteor-methods/messages/executeSlashCommandPreview.ts +++ b/apps/meteor/server/meteor-methods/messages/executeSlashCommandPreview.ts @@ -2,7 +2,7 @@ import type { IMessage, RequiredField, SlashCommandPreviewItem } from '@rocket.c import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Meteor } from 'meteor/meteor'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; +import { slashCommands } from '../../lib/utils/slashCommand'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/messages/followMessage.ts b/apps/meteor/server/meteor-methods/messages/followMessage.ts index 06c6e0150db85..a4c95aee46f0c 100644 --- a/apps/meteor/server/meteor-methods/messages/followMessage.ts +++ b/apps/meteor/server/meteor-methods/messages/followMessage.ts @@ -5,12 +5,12 @@ import { Messages } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { RateLimiter } from '../../../app/lib/server'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { notifyOnMessageChange } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; +import { RateLimiterClass as RateLimiter } from '../../lib/RateLimiter'; import { canAccessRoomIdAsync } from '../../lib/authorization/canAccessRoom'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { follow } from '../../lib/messaging/threads/functions'; +import { notifyOnMessageChange } from '../../lib/notifyListener'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/messages/getChannelHistory.ts b/apps/meteor/server/meteor-methods/messages/getChannelHistory.ts index 6efbde52888b8..71acf04e60bf2 100644 --- a/apps/meteor/server/meteor-methods/messages/getChannelHistory.ts +++ b/apps/meteor/server/meteor-methods/messages/getChannelHistory.ts @@ -5,10 +5,10 @@ import { Messages, Rooms } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { getHiddenSystemMessages } from '../../../app/lib/server/lib/getHiddenSystemMessages'; -import { settings } from '../../../app/settings/server/cached'; -import { normalizeMessagesForUser } from '../../../app/utils/server/lib/normalizeMessagesForUser'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; +import { getHiddenSystemMessages } from '../../lib/messaging/getHiddenSystemMessages'; +import { normalizeMessagesForUser } from '../../lib/utils/lib/normalizeMessagesForUser'; +import { settings } from '../../settings/cached'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/messages/getSlashCommandPreviews.ts b/apps/meteor/server/meteor-methods/messages/getSlashCommandPreviews.ts index 20dabba2cdf74..73f78a078cc2e 100644 --- a/apps/meteor/server/meteor-methods/messages/getSlashCommandPreviews.ts +++ b/apps/meteor/server/meteor-methods/messages/getSlashCommandPreviews.ts @@ -2,7 +2,7 @@ import type { IMessage, RequiredField, SlashCommandPreviews } from '@rocket.chat import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Meteor } from 'meteor/meteor'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; +import { slashCommands } from '../../lib/utils/slashCommand'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/messages/getThreadMessages.ts b/apps/meteor/server/meteor-methods/messages/getThreadMessages.ts index 492c18a436707..e1b99ca9e940d 100644 --- a/apps/meteor/server/meteor-methods/messages/getThreadMessages.ts +++ b/apps/meteor/server/meteor-methods/messages/getThreadMessages.ts @@ -3,10 +3,10 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Messages, Rooms } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { canAccessRoomAsync } from '../../../app/authorization/server'; -import { settings } from '../../../app/settings/server'; +import { canAccessRoomAsync } from '../../lib/authorization'; import { callbacks } from '../../lib/callbacks'; import { readThread } from '../../lib/messaging/threads/functions'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/messages/getThreadsList.ts b/apps/meteor/server/meteor-methods/messages/getThreadsList.ts index 2730a49648aec..67feb9690eade 100644 --- a/apps/meteor/server/meteor-methods/messages/getThreadsList.ts +++ b/apps/meteor/server/meteor-methods/messages/getThreadsList.ts @@ -3,9 +3,9 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Messages, Rooms } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { canAccessRoomAsync } from '../../../app/authorization/server'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { settings } from '../../../app/settings/server'; +import { canAccessRoomAsync } from '../../lib/authorization'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; +import { settings } from '../../settings'; const MAX_LIMIT = 100; diff --git a/apps/meteor/server/meteor-methods/messages/getUserMentionsByChannel.ts b/apps/meteor/server/meteor-methods/messages/getUserMentionsByChannel.ts index cdfb5eac81a86..47dd75b5b8e83 100644 --- a/apps/meteor/server/meteor-methods/messages/getUserMentionsByChannel.ts +++ b/apps/meteor/server/meteor-methods/messages/getUserMentionsByChannel.ts @@ -4,8 +4,8 @@ import { Messages, Users, Rooms } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { canAccessRoomAsync } from '../../../app/authorization/server'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; +import { canAccessRoomAsync } from '../../lib/authorization'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/messages/loadHistory.ts b/apps/meteor/server/meteor-methods/messages/loadHistory.ts index b59ef16c2c61b..31a5de0fd5464 100644 --- a/apps/meteor/server/meteor-methods/messages/loadHistory.ts +++ b/apps/meteor/server/meteor-methods/messages/loadHistory.ts @@ -4,10 +4,10 @@ import { Subscriptions, Rooms } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { canAccessRoomAsync, roomAccessAttributes } from '../../../app/authorization/server'; -import { settings } from '../../../app/settings/server'; +import { canAccessRoomAsync, roomAccessAttributes } from '../../lib/authorization'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { loadMessageHistory } from '../../lib/messages/loadMessageHistory'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/messages/loadNextMessages.ts b/apps/meteor/server/meteor-methods/messages/loadNextMessages.ts index a0ae85d5a17d3..beed2be900e6d 100644 --- a/apps/meteor/server/meteor-methods/messages/loadNextMessages.ts +++ b/apps/meteor/server/meteor-methods/messages/loadNextMessages.ts @@ -4,8 +4,8 @@ import { Messages } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { normalizeMessagesForUser } from '../../../app/utils/server/lib/normalizeMessagesForUser'; import { canAccessRoomIdAsync } from '../../lib/authorization/canAccessRoom'; +import { normalizeMessagesForUser } from '../../lib/utils/lib/normalizeMessagesForUser'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/messages/loadSurroundingMessages.ts b/apps/meteor/server/meteor-methods/messages/loadSurroundingMessages.ts index 990a4c19b643c..4e6beff65a748 100644 --- a/apps/meteor/server/meteor-methods/messages/loadSurroundingMessages.ts +++ b/apps/meteor/server/meteor-methods/messages/loadSurroundingMessages.ts @@ -5,8 +5,8 @@ import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; import type { FindOptions } from 'mongodb'; -import { normalizeMessagesForUser } from '../../../app/utils/server/lib/normalizeMessagesForUser'; import { canAccessRoomIdAsync } from '../../lib/authorization/canAccessRoom'; +import { normalizeMessagesForUser } from '../../lib/utils/lib/normalizeMessagesForUser'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/messages/messageSearch.ts b/apps/meteor/server/meteor-methods/messages/messageSearch.ts index da506b02695f3..b18b890dde3d7 100644 --- a/apps/meteor/server/meteor-methods/messages/messageSearch.ts +++ b/apps/meteor/server/meteor-methods/messages/messageSearch.ts @@ -5,12 +5,12 @@ import { Messages, Subscriptions, Users } from '@rocket.chat/models'; import { Match, check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { settings } from '../../../app/settings/server'; import { readSecondaryPreferred } from '../../database/readSecondaryPreferred'; import { canAccessRoomIdAsync } from '../../lib/authorization/canAccessRoom'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { parseMessageSearchQuery } from '../../lib/parseMessageSearchQuery'; import type { IRawSearchResult } from '../../lib/search/model/ISearchResult'; +import { settings } from '../../settings'; const logger = new Logger('MessageSearch'); diff --git a/apps/meteor/server/meteor-methods/messages/readMessages.ts b/apps/meteor/server/meteor-methods/messages/readMessages.ts index f5794f7591813..4f841262cdf25 100644 --- a/apps/meteor/server/meteor-methods/messages/readMessages.ts +++ b/apps/meteor/server/meteor-methods/messages/readMessages.ts @@ -4,7 +4,7 @@ import { Rooms } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { canAccessRoomAsync } from '../../../app/authorization/server'; +import { canAccessRoomAsync } from '../../lib/authorization'; import { readMessages } from '../../lib/readMessages'; declare module '@rocket.chat/ddp-client' { diff --git a/apps/meteor/server/meteor-methods/messages/readThreads.ts b/apps/meteor/server/meteor-methods/messages/readThreads.ts index f3f2a82f08ecc..c5064dbe80bcf 100644 --- a/apps/meteor/server/meteor-methods/messages/readThreads.ts +++ b/apps/meteor/server/meteor-methods/messages/readThreads.ts @@ -4,10 +4,10 @@ import { Messages, Rooms } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { canAccessRoomAsync } from '../../../app/authorization/server'; -import { settings } from '../../../app/settings/server'; +import { canAccessRoomAsync } from '../../lib/authorization'; import { callbacks } from '../../lib/callbacks'; import { readThread } from '../../lib/messaging/threads/functions'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/messages/sendFileMessage.ts b/apps/meteor/server/meteor-methods/messages/sendFileMessage.ts index 917cc14ca4531..122946f6490ea 100644 --- a/apps/meteor/server/meteor-methods/messages/sendFileMessage.ts +++ b/apps/meteor/server/meteor-methods/messages/sendFileMessage.ts @@ -14,10 +14,10 @@ import { Match, check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; import { executeSendMessage } from './sendMessage'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; import { getFileExtension } from '../../../lib/utils/getFileExtension'; import { canAccessRoomAsync } from '../../lib/authorization/canAccessRoom'; import { callbacks } from '../../lib/callbacks'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { SystemLogger } from '../../lib/logger/system'; import { isImagePreviewSupported } from '../../lib/media/file-upload/isImagePreviewSupported'; import { FileUpload } from '../../lib/media/file-upload/lib/FileUpload'; diff --git a/apps/meteor/server/meteor-methods/messages/sendMessage.ts b/apps/meteor/server/meteor-methods/messages/sendMessage.ts index 21c2bf937edb7..0fe3a238e4f5f 100644 --- a/apps/meteor/server/meteor-methods/messages/sendMessage.ts +++ b/apps/meteor/server/meteor-methods/messages/sendMessage.ts @@ -9,8 +9,7 @@ import { check, Match } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; import moment from 'moment'; -import { RateLimiter } from '../../../app/lib/server/lib'; -import { settings } from '../../../app/settings/server'; +import { RateLimiterClass as RateLimiter } from '../../lib/RateLimiter'; import { canSendMessageAsync } from '../../lib/authorization/canSendMessage'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { applyAirGappedRestrictionsValidation } from '../../lib/cloud/license/airGappedRestrictionsWrapper'; @@ -18,6 +17,7 @@ import { i18n } from '../../lib/i18n'; import { SystemLogger } from '../../lib/logger/system'; import { sendMessage } from '../../lib/messages/sendMessage'; import { metrics } from '../../lib/metrics'; +import { settings } from '../../settings'; /** * * @param uid diff --git a/apps/meteor/server/meteor-methods/messages/unfollowMessage.ts b/apps/meteor/server/meteor-methods/messages/unfollowMessage.ts index 20807000d5477..7224a2a6201da 100644 --- a/apps/meteor/server/meteor-methods/messages/unfollowMessage.ts +++ b/apps/meteor/server/meteor-methods/messages/unfollowMessage.ts @@ -5,12 +5,12 @@ import { Messages } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { RateLimiter } from '../../../app/lib/server'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { notifyOnMessageChange } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; +import { RateLimiterClass as RateLimiter } from '../../lib/RateLimiter'; import { canAccessRoomIdAsync } from '../../lib/authorization/canAccessRoom'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { unfollow } from '../../lib/messaging/threads/functions'; +import { notifyOnMessageChange } from '../../lib/notifyListener'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/messages/updateMessage.ts b/apps/meteor/server/meteor-methods/messages/updateMessage.ts index 20eb69d22672b..963befcf50774 100644 --- a/apps/meteor/server/meteor-methods/messages/updateMessage.ts +++ b/apps/meteor/server/meteor-methods/messages/updateMessage.ts @@ -5,11 +5,11 @@ import { Match, check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; import moment from 'moment'; -import { settings } from '../../../app/settings/server'; import { canSendMessageAsync } from '../../lib/authorization/canSendMessage'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { applyAirGappedRestrictionsValidation } from '../../lib/cloud/license/airGappedRestrictionsWrapper'; import { updateMessage } from '../../lib/messages/updateMessage'; +import { settings } from '../../settings'; const allowedEditedFields = ['tshow', 'alias', 'attachments', 'avatar', 'emoji', 'msg', 'customFields', 'content', 'e2eMentions']; diff --git a/apps/meteor/server/meteor-methods/omnichannel/sendMessageLivechat.ts b/apps/meteor/server/meteor-methods/omnichannel/sendMessageLivechat.ts index 0b0931e754827..d6166492b59b2 100644 --- a/apps/meteor/server/meteor-methods/omnichannel/sendMessageLivechat.ts +++ b/apps/meteor/server/meteor-methods/omnichannel/sendMessageLivechat.ts @@ -4,10 +4,10 @@ import { LivechatVisitors } from '@rocket.chat/models'; import { Match, check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import type { ILivechatMessage } from '../../../app/livechat/server/lib/localTypes'; -import { sendMessage } from '../../../app/livechat/server/lib/messages'; -import { settings } from '../../../app/settings/server'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; +import type { ILivechatMessage } from '../../lib/omnichannel/localTypes'; +import { sendMessage } from '../../lib/omnichannel/messages'; +import { settings } from '../../settings'; interface ILivechatMessageAgent { agentId: string; diff --git a/apps/meteor/server/meteor-methods/platform/OEmbedCacheCleanup.ts b/apps/meteor/server/meteor-methods/platform/OEmbedCacheCleanup.ts index 48eeeb09035db..4fac44851e865 100644 --- a/apps/meteor/server/meteor-methods/platform/OEmbedCacheCleanup.ts +++ b/apps/meteor/server/meteor-methods/platform/OEmbedCacheCleanup.ts @@ -2,8 +2,8 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { OEmbedCache } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../app/settings/server'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/platform/banner_dismiss.ts b/apps/meteor/server/meteor-methods/platform/banner_dismiss.ts index 8c3d9367193f0..b7048c2991c57 100644 --- a/apps/meteor/server/meteor-methods/platform/banner_dismiss.ts +++ b/apps/meteor/server/meteor-methods/platform/banner_dismiss.ts @@ -2,8 +2,8 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Users } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { notifyOnUserChange } from '../../../app/lib/server/lib/notifyListener'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; +import { notifyOnUserChange } from '../../lib/notifyListener'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/platform/cloud.ts b/apps/meteor/server/meteor-methods/platform/cloud.ts index 18d80fdeb4062..32763ff5328ba 100644 --- a/apps/meteor/server/meteor-methods/platform/cloud.ts +++ b/apps/meteor/server/meteor-methods/platform/cloud.ts @@ -2,7 +2,6 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { buildWorkspaceRegistrationData } from '../../lib/cloud/buildRegistrationData'; import { checkUserHasCloudLogin } from '../../lib/cloud/checkUserHasCloudLogin'; @@ -13,6 +12,7 @@ import { retrieveRegistrationStatus } from '../../lib/cloud/retrieveRegistration import { startRegisterWorkspace } from '../../lib/cloud/startRegisterWorkspace'; import { syncWorkspace } from '../../lib/cloud/syncWorkspace'; import { userLogout } from '../../lib/cloud/userLogout'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/platform/fetchMyKeys.ts b/apps/meteor/server/meteor-methods/platform/fetchMyKeys.ts index bc89ecb3e0b64..919edf139185c 100644 --- a/apps/meteor/server/meteor-methods/platform/fetchMyKeys.ts +++ b/apps/meteor/server/meteor-methods/platform/fetchMyKeys.ts @@ -2,7 +2,7 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Users } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/platform/getStatistics.ts b/apps/meteor/server/meteor-methods/platform/getStatistics.ts index 5fa9865217729..917ed85c88e64 100644 --- a/apps/meteor/server/meteor-methods/platform/getStatistics.ts +++ b/apps/meteor/server/meteor-methods/platform/getStatistics.ts @@ -2,7 +2,7 @@ import type { IStats } from '@rocket.chat/core-typings'; import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { getLastStatistics } from '../../lib/statistics/functions/getLastStatistics'; declare module '@rocket.chat/ddp-client' { diff --git a/apps/meteor/server/meteor-methods/platform/push.ts b/apps/meteor/server/meteor-methods/platform/push.ts index b32f3706f9935..b388d8849e4e9 100644 --- a/apps/meteor/server/meteor-methods/platform/push.ts +++ b/apps/meteor/server/meteor-methods/platform/push.ts @@ -6,7 +6,7 @@ import { Accounts } from 'meteor/accounts-base'; import { Match, check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { logger } from '../../lib/notifications/push/logger'; import { _matchToken } from '../../lib/notifications/push/push'; diff --git a/apps/meteor/server/meteor-methods/platform/requestDataDownload.ts b/apps/meteor/server/meteor-methods/platform/requestDataDownload.ts index ad51a5d4129cd..9f16d9994f165 100644 --- a/apps/meteor/server/meteor-methods/platform/requestDataDownload.ts +++ b/apps/meteor/server/meteor-methods/platform/requestDataDownload.ts @@ -7,9 +7,9 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { ExportOperations, UserDataFiles } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { settings } from '../../../app/settings/server'; import * as dataExport from '../../lib/dataExport'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/platform/requestSubscriptionKeys.ts b/apps/meteor/server/meteor-methods/platform/requestSubscriptionKeys.ts index 4ec947eb1b198..0d2e5c58da800 100644 --- a/apps/meteor/server/meteor-methods/platform/requestSubscriptionKeys.ts +++ b/apps/meteor/server/meteor-methods/platform/requestSubscriptionKeys.ts @@ -3,7 +3,7 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Subscriptions, Rooms } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/platform/resetOwnE2EKey.ts b/apps/meteor/server/meteor-methods/platform/resetOwnE2EKey.ts index 634c29a1e626a..f89e8c67d1f7c 100644 --- a/apps/meteor/server/meteor-methods/platform/resetOwnE2EKey.ts +++ b/apps/meteor/server/meteor-methods/platform/resetOwnE2EKey.ts @@ -2,8 +2,8 @@ import { MeteorError } from '@rocket.chat/core-services'; import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; import { twoFactorRequired } from '../../lib/2fa/twoFactorRequired'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { resetUserE2EEncriptionKey } from '../../lib/resetUserE2EKey'; declare module '@rocket.chat/ddp-client' { diff --git a/apps/meteor/server/meteor-methods/platform/saveSettings.ts b/apps/meteor/server/meteor-methods/platform/saveSettings.ts index b59a4fee69ef1..550bff4e5bec7 100644 --- a/apps/meteor/server/meteor-methods/platform/saveSettings.ts +++ b/apps/meteor/server/meteor-methods/platform/saveSettings.ts @@ -1,8 +1,8 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; import { saveAutoTranslateSettings } from '../../lib/autotranslate/functions/saveSettings'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/platform/setRoomKeyID.ts b/apps/meteor/server/meteor-methods/platform/setRoomKeyID.ts index 49c930096d806..daccfdb9bae6d 100644 --- a/apps/meteor/server/meteor-methods/platform/setRoomKeyID.ts +++ b/apps/meteor/server/meteor-methods/platform/setRoomKeyID.ts @@ -4,8 +4,8 @@ import { Rooms } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { notifyOnRoomChangedById } from '../../../app/lib/server/lib/notifyListener'; import { canAccessRoomIdAsync } from '../../lib/authorization/canAccessRoom'; +import { notifyOnRoomChangedById } from '../../lib/notifyListener'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/platform/setUserPublicAndPrivateKeys.ts b/apps/meteor/server/meteor-methods/platform/setUserPublicAndPrivateKeys.ts index 2b37c23d7ea97..56967c9c60b1b 100644 --- a/apps/meteor/server/meteor-methods/platform/setUserPublicAndPrivateKeys.ts +++ b/apps/meteor/server/meteor-methods/platform/setUserPublicAndPrivateKeys.ts @@ -2,8 +2,8 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Rooms, Users } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { notifyOnRoomChangedById } from '../../../app/lib/server/lib/notifyListener'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; +import { notifyOnRoomChangedById } from '../../lib/notifyListener'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/platform/translateMessage.ts b/apps/meteor/server/meteor-methods/platform/translateMessage.ts index ea3eb9fb10697..5d5043121d0aa 100644 --- a/apps/meteor/server/meteor-methods/platform/translateMessage.ts +++ b/apps/meteor/server/meteor-methods/platform/translateMessage.ts @@ -4,7 +4,7 @@ import { Messages, Rooms } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { canAccessRoomAsync } from '../../../app/authorization/server'; +import { canAccessRoomAsync } from '../../lib/authorization'; import { translateMessage } from '../../lib/autotranslate/functions/translateMessage'; declare module '@rocket.chat/ddp-client' { diff --git a/apps/meteor/server/meteor-methods/platform/updateGroupKey.ts b/apps/meteor/server/meteor-methods/platform/updateGroupKey.ts index fde6e704a2461..cb96088180d15 100644 --- a/apps/meteor/server/meteor-methods/platform/updateGroupKey.ts +++ b/apps/meteor/server/meteor-methods/platform/updateGroupKey.ts @@ -1,10 +1,6 @@ import { Subscriptions, Rooms } from '@rocket.chat/models'; -import { - notifyOnSubscriptionChangedById, - notifyOnSubscriptionChanged, - notifyOnRoomChangedById, -} from '../../../app/lib/server/lib/notifyListener'; +import { notifyOnSubscriptionChangedById, notifyOnSubscriptionChanged, notifyOnRoomChangedById } from '../../lib/notifyListener'; export async function updateGroupKey(rid: string, uid: string, key: string, callerUserId: string) { // I have a subscription to this room diff --git a/apps/meteor/server/meteor-methods/rooms/addAllUserToRoom.ts b/apps/meteor/server/meteor-methods/rooms/addAllUserToRoom.ts index b52032ce43fe6..828768129c135 100644 --- a/apps/meteor/server/meteor-methods/rooms/addAllUserToRoom.ts +++ b/apps/meteor/server/meteor-methods/rooms/addAllUserToRoom.ts @@ -5,14 +5,14 @@ import { Subscriptions, Rooms, Users } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { notifyOnSubscriptionChangedById } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; -import { getDefaultSubscriptionPref } from '../../../app/utils/lib/getDefaultSubscriptionPref'; import { beforeAddUserToRoom } from '../../hooks/rooms/beforeAddUserToRoom'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { callbacks } from '../../lib/callbacks'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { getSubscriptionAutotranslateDefaultConfig } from '../../lib/getSubscriptionAutotranslateDefaultConfig'; +import { notifyOnSubscriptionChangedById } from '../../lib/notifyListener'; +import { getDefaultSubscriptionPref } from '../../lib/utils/lib/getDefaultSubscriptionPref'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/rooms/addRoomLeader.ts b/apps/meteor/server/meteor-methods/rooms/addRoomLeader.ts index af5fd12451fb6..baeccabb74566 100644 --- a/apps/meteor/server/meteor-methods/rooms/addRoomLeader.ts +++ b/apps/meteor/server/meteor-methods/rooms/addRoomLeader.ts @@ -5,11 +5,11 @@ import { Subscriptions, Users } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { notifyOnSubscriptionChangedById } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; +import { notifyOnSubscriptionChangedById } from '../../lib/notifyListener'; import { syncRoomRolePriorityForUserAndRoom } from '../../lib/roles/syncRoomRolePriority'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/rooms/addRoomModerator.ts b/apps/meteor/server/meteor-methods/rooms/addRoomModerator.ts index e0b471c8781da..31faa724af841 100644 --- a/apps/meteor/server/meteor-methods/rooms/addRoomModerator.ts +++ b/apps/meteor/server/meteor-methods/rooms/addRoomModerator.ts @@ -6,13 +6,13 @@ import { Subscriptions, Rooms, Users } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { notifyOnSubscriptionChangedById } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { beforeChangeRoomRole } from '../../lib/callbacks/beforeChangeRoomRole'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; +import { notifyOnSubscriptionChangedById } from '../../lib/notifyListener'; import { syncRoomRolePriorityForUserAndRoom } from '../../lib/roles/syncRoomRolePriority'; import { isFederationEnabled, FederationMatrixInvalidConfigurationError } from '../../services/federation/utils'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/rooms/addRoomOwner.ts b/apps/meteor/server/meteor-methods/rooms/addRoomOwner.ts index 082f55072e6a5..bbb3fd064716c 100644 --- a/apps/meteor/server/meteor-methods/rooms/addRoomOwner.ts +++ b/apps/meteor/server/meteor-methods/rooms/addRoomOwner.ts @@ -6,13 +6,13 @@ import { Subscriptions, Rooms, Users } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { notifyOnSubscriptionChangedById } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { beforeChangeRoomRole } from '../../lib/callbacks/beforeChangeRoomRole'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; +import { notifyOnSubscriptionChangedById } from '../../lib/notifyListener'; import { syncRoomRolePriorityForUserAndRoom } from '../../lib/roles/syncRoomRolePriority'; import { isFederationEnabled, FederationMatrixInvalidConfigurationError } from '../../services/federation/utils'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/rooms/addUserToRoom.ts b/apps/meteor/server/meteor-methods/rooms/addUserToRoom.ts index c53d6df7da706..535f8ef4e2ccb 100644 --- a/apps/meteor/server/meteor-methods/rooms/addUserToRoom.ts +++ b/apps/meteor/server/meteor-methods/rooms/addUserToRoom.ts @@ -2,7 +2,7 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Meteor } from 'meteor/meteor'; import { addUsersToRoomMethod } from './addUsersToRoom'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/rooms/addUsersToRoom.ts b/apps/meteor/server/meteor-methods/rooms/addUsersToRoom.ts index 2168ea6536cb1..eac8bbbe40c33 100644 --- a/apps/meteor/server/meteor-methods/rooms/addUsersToRoom.ts +++ b/apps/meteor/server/meteor-methods/rooms/addUsersToRoom.ts @@ -5,9 +5,9 @@ import { Subscriptions, Users, Rooms } from '@rocket.chat/models'; import { Match } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { beforeAddUsersToRoom } from '../../lib/callbacks/beforeAddUserToRoom'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { i18n } from '../../lib/i18n'; import { addUserToRoom } from '../../lib/rooms/addUserToRoom'; diff --git a/apps/meteor/server/meteor-methods/rooms/archiveRoom.ts b/apps/meteor/server/meteor-methods/rooms/archiveRoom.ts index cad3b36d68c3d..041d6a6601d13 100644 --- a/apps/meteor/server/meteor-methods/rooms/archiveRoom.ts +++ b/apps/meteor/server/meteor-methods/rooms/archiveRoom.ts @@ -4,9 +4,9 @@ import { Users, Rooms } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; import { RoomMemberActions } from '../../../definition/IRoomTypeConfig'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { archiveRoom } from '../../lib/rooms/archiveRoom'; import { roomCoordinator } from '../../lib/rooms/roomCoordinator'; diff --git a/apps/meteor/server/meteor-methods/rooms/browseChannels.ts b/apps/meteor/server/meteor-methods/rooms/browseChannels.ts index 96cc20cba171a..d6ed8e03962a9 100644 --- a/apps/meteor/server/meteor-methods/rooms/browseChannels.ts +++ b/apps/meteor/server/meteor-methods/rooms/browseChannels.ts @@ -9,10 +9,10 @@ import { DDPRateLimiter } from 'meteor/ddp-rate-limiter'; import { Meteor } from 'meteor/meteor'; import type { FindOptions, SortDirection } from 'mongodb'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { settings } from '../../../app/settings/server'; import { trim } from '../../../lib/utils/stringUtils'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; +import { settings } from '../../settings'; const sortChannels = (field: string, direction: 'asc' | 'desc'): Record => { switch (field) { diff --git a/apps/meteor/server/meteor-methods/rooms/channelsList.ts b/apps/meteor/server/meteor-methods/rooms/channelsList.ts index d3ba17569322b..c71a12dd5b4ef 100644 --- a/apps/meteor/server/meteor-methods/rooms/channelsList.ts +++ b/apps/meteor/server/meteor-methods/rooms/channelsList.ts @@ -6,11 +6,11 @@ import { Meteor } from 'meteor/meteor'; import type { FindOptions } from 'mongodb'; import _ from 'underscore'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { settings } from '../../../app/settings/server'; -import { getUserPreference } from '../../../app/utils/server/lib/getUserPreference'; import { trim } from '../../../lib/utils/stringUtils'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; +import { getUserPreference } from '../../lib/utils/lib/getUserPreference'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/rooms/cleanRoomHistory.ts b/apps/meteor/server/meteor-methods/rooms/cleanRoomHistory.ts index 0a5d86e442040..161ace3eb3606 100644 --- a/apps/meteor/server/meteor-methods/rooms/cleanRoomHistory.ts +++ b/apps/meteor/server/meteor-methods/rooms/cleanRoomHistory.ts @@ -2,8 +2,8 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Match, check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { canAccessRoomAsync } from '../../../app/authorization/server'; import { findRoomByIdOrName } from '../../api/v1/rooms'; +import { canAccessRoomAsync } from '../../lib/authorization'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { cleanRoomHistory } from '../../lib/rooms/cleanRoomHistory'; diff --git a/apps/meteor/server/meteor-methods/rooms/createChannel.ts b/apps/meteor/server/meteor-methods/rooms/createChannel.ts index 6aaa29b01d651..8936dbcc28dff 100644 --- a/apps/meteor/server/meteor-methods/rooms/createChannel.ts +++ b/apps/meteor/server/meteor-methods/rooms/createChannel.ts @@ -4,8 +4,8 @@ import { Users, Team } from '@rocket.chat/models'; import { Match, check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { createRoom } from '../../lib/rooms/createRoom'; declare module '@rocket.chat/ddp-client' { diff --git a/apps/meteor/server/meteor-methods/rooms/getRoomById.ts b/apps/meteor/server/meteor-methods/rooms/getRoomById.ts index d360111e375d3..72cd1e4592c43 100644 --- a/apps/meteor/server/meteor-methods/rooms/getRoomById.ts +++ b/apps/meteor/server/meteor-methods/rooms/getRoomById.ts @@ -5,7 +5,7 @@ import { check } from 'meteor/check'; import { DDPRateLimiter } from 'meteor/ddp-rate-limiter'; import { Meteor } from 'meteor/meteor'; -import { canAccessRoomAsync } from '../../../app/authorization/server'; +import { canAccessRoomAsync } from '../../lib/authorization'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/rooms/getRoomIdByNameOrId.ts b/apps/meteor/server/meteor-methods/rooms/getRoomIdByNameOrId.ts index c7a1ccf95d8a4..4f2143d7189e5 100644 --- a/apps/meteor/server/meteor-methods/rooms/getRoomIdByNameOrId.ts +++ b/apps/meteor/server/meteor-methods/rooms/getRoomIdByNameOrId.ts @@ -4,8 +4,8 @@ import { Rooms } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { canAccessRoomAsync } from '../../../app/authorization/server'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; +import { canAccessRoomAsync } from '../../lib/authorization'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/rooms/getRoomNameById.ts b/apps/meteor/server/meteor-methods/rooms/getRoomNameById.ts index 1b99ffddbe3c7..b374b5dfa3b2d 100644 --- a/apps/meteor/server/meteor-methods/rooms/getRoomNameById.ts +++ b/apps/meteor/server/meteor-methods/rooms/getRoomNameById.ts @@ -4,8 +4,8 @@ import { Subscriptions, Rooms } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/rooms/getRoomRoles.ts b/apps/meteor/server/meteor-methods/rooms/getRoomRoles.ts index e08386a24716e..088068cafbcf3 100644 --- a/apps/meteor/server/meteor-methods/rooms/getRoomRoles.ts +++ b/apps/meteor/server/meteor-methods/rooms/getRoomRoles.ts @@ -3,10 +3,10 @@ import { Rooms } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { canAccessRoomAsync } from '../../../app/authorization/server'; -import { settings } from '../../../app/settings/server'; +import { canAccessRoomAsync } from '../../lib/authorization'; import type { RoomRoles } from '../../lib/roles/getRoomRoles'; import { getRoomRoles } from '../../lib/roles/getRoomRoles'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/rooms/getTotalChannels.ts b/apps/meteor/server/meteor-methods/rooms/getTotalChannels.ts index e342288b1b63f..393c78ce7170d 100644 --- a/apps/meteor/server/meteor-methods/rooms/getTotalChannels.ts +++ b/apps/meteor/server/meteor-methods/rooms/getTotalChannels.ts @@ -2,7 +2,7 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Rooms } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/rooms/hideRoom.ts b/apps/meteor/server/meteor-methods/rooms/hideRoom.ts index fd18a20339c1d..dc7d8b550acc1 100644 --- a/apps/meteor/server/meteor-methods/rooms/hideRoom.ts +++ b/apps/meteor/server/meteor-methods/rooms/hideRoom.ts @@ -3,8 +3,8 @@ import { Subscriptions } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { notifyOnSubscriptionChangedByRoomIdAndUserId } from '../../../app/lib/server/lib/notifyListener'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; +import { notifyOnSubscriptionChangedByRoomIdAndUserId } from '../../lib/notifyListener'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/rooms/joinRoom.ts b/apps/meteor/server/meteor-methods/rooms/joinRoom.ts index 855812cc693ae..412d78165dfbc 100644 --- a/apps/meteor/server/meteor-methods/rooms/joinRoom.ts +++ b/apps/meteor/server/meteor-methods/rooms/joinRoom.ts @@ -5,7 +5,7 @@ import { Rooms } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/rooms/leaveRoom.ts b/apps/meteor/server/meteor-methods/rooms/leaveRoom.ts index 5ef3d5f973605..c314763a4d032 100644 --- a/apps/meteor/server/meteor-methods/rooms/leaveRoom.ts +++ b/apps/meteor/server/meteor-methods/rooms/leaveRoom.ts @@ -4,10 +4,10 @@ import { Roles, Subscriptions, Rooms } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; import { RoomMemberActions } from '../../../definition/IRoomTypeConfig'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { hasRoleAsync } from '../../lib/authorization/hasRole'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { removeUserFromRoom } from '../../lib/rooms/removeUserFromRoom'; import { roomCoordinator } from '../../lib/rooms/roomCoordinator'; diff --git a/apps/meteor/server/meteor-methods/rooms/muteUserInRoom.ts b/apps/meteor/server/meteor-methods/rooms/muteUserInRoom.ts index 7aff3afd1383d..926d5cf9d1678 100644 --- a/apps/meteor/server/meteor-methods/rooms/muteUserInRoom.ts +++ b/apps/meteor/server/meteor-methods/rooms/muteUserInRoom.ts @@ -3,10 +3,10 @@ import type { IRoom } from '@rocket.chat/core-typings'; import { Rooms, Subscriptions, Users } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { notifyOnRoomChangedById } from '../../../app/lib/server/lib/notifyListener'; import { RoomMemberActions } from '../../../definition/IRoomTypeConfig'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { callbacks } from '../../lib/callbacks'; +import { notifyOnRoomChangedById } from '../../lib/notifyListener'; import { roomCoordinator } from '../../lib/rooms/roomCoordinator'; declare module '@rocket.chat/ddp-client' { diff --git a/apps/meteor/server/meteor-methods/rooms/removeRoomLeader.ts b/apps/meteor/server/meteor-methods/rooms/removeRoomLeader.ts index a3249c5cebdd7..eea33a97d0576 100644 --- a/apps/meteor/server/meteor-methods/rooms/removeRoomLeader.ts +++ b/apps/meteor/server/meteor-methods/rooms/removeRoomLeader.ts @@ -5,11 +5,11 @@ import { Subscriptions, Users } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { notifyOnSubscriptionChangedById } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; +import { notifyOnSubscriptionChangedById } from '../../lib/notifyListener'; import { syncRoomRolePriorityForUserAndRoom } from '../../lib/roles/syncRoomRolePriority'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/rooms/removeRoomModerator.ts b/apps/meteor/server/meteor-methods/rooms/removeRoomModerator.ts index ead0663ba472b..c622e48ac18aa 100644 --- a/apps/meteor/server/meteor-methods/rooms/removeRoomModerator.ts +++ b/apps/meteor/server/meteor-methods/rooms/removeRoomModerator.ts @@ -6,12 +6,12 @@ import { Subscriptions, Rooms, Users } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { notifyOnSubscriptionChangedById } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { beforeChangeRoomRole } from '../../lib/callbacks/beforeChangeRoomRole'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; +import { notifyOnSubscriptionChangedById } from '../../lib/notifyListener'; import { syncRoomRolePriorityForUserAndRoom } from '../../lib/roles/syncRoomRolePriority'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/rooms/removeRoomOwner.ts b/apps/meteor/server/meteor-methods/rooms/removeRoomOwner.ts index 5507b9054dabd..a1c562c4262cd 100644 --- a/apps/meteor/server/meteor-methods/rooms/removeRoomOwner.ts +++ b/apps/meteor/server/meteor-methods/rooms/removeRoomOwner.ts @@ -5,12 +5,12 @@ import { Subscriptions, Rooms, Users, Roles } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { notifyOnSubscriptionChangedById } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { beforeChangeRoomRole } from '../../lib/callbacks/beforeChangeRoomRole'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; +import { notifyOnSubscriptionChangedById } from '../../lib/notifyListener'; import { syncRoomRolePriorityForUserAndRoom } from '../../lib/roles/syncRoomRolePriority'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/rooms/removeUserFromRoom.ts b/apps/meteor/server/meteor-methods/rooms/removeUserFromRoom.ts index a2e1a54edfa5d..7d56846a8fecd 100644 --- a/apps/meteor/server/meteor-methods/rooms/removeUserFromRoom.ts +++ b/apps/meteor/server/meteor-methods/rooms/removeUserFromRoom.ts @@ -6,17 +6,17 @@ import { Subscriptions, Rooms, Users, Roles } from '@rocket.chat/models'; import { Match, check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { canAccessRoomAsync } from '../../../app/authorization/server'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { notifyOnRoomChanged, notifyOnSubscriptionChanged } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; import { RoomMemberActions } from '../../../definition/IRoomTypeConfig'; +import { canAccessRoomAsync } from '../../lib/authorization'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { hasRoleAsync } from '../../lib/authorization/hasRole'; import { callbacks } from '../../lib/callbacks'; import { afterRemoveFromRoomCallback } from '../../lib/callbacks/afterRemoveFromRoomCallback'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; +import { notifyOnRoomChanged, notifyOnSubscriptionChanged } from '../../lib/notifyListener'; import { removeUserFromRolesAsync } from '../../lib/roles/removeUserFromRoles'; import { roomCoordinator } from '../../lib/rooms/roomCoordinator'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/rooms/saveRoomSettings.ts b/apps/meteor/server/meteor-methods/rooms/saveRoomSettings.ts index 9d6657eb38c8c..be5af6280c90a 100644 --- a/apps/meteor/server/meteor-methods/rooms/saveRoomSettings.ts +++ b/apps/meteor/server/meteor-methods/rooms/saveRoomSettings.ts @@ -6,23 +6,23 @@ import { Rooms, Users } from '@rocket.chat/models'; import { Match } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { isABACManagedRoom } from '../../../app/authorization/server/lib/isABACManagedRoom'; -import { saveReactWhenReadOnly } from '../../../app/channel-settings/server/functions/saveReactWhenReadOnly'; -import { saveRoomAnnouncement } from '../../../app/channel-settings/server/functions/saveRoomAnnouncement'; -import { saveRoomCustomFields } from '../../../app/channel-settings/server/functions/saveRoomCustomFields'; -import { saveRoomDescription } from '../../../app/channel-settings/server/functions/saveRoomDescription'; -import { saveRoomEncrypted } from '../../../app/channel-settings/server/functions/saveRoomEncrypted'; -import { saveRoomName } from '../../../app/channel-settings/server/functions/saveRoomName'; -import { saveRoomReadOnly } from '../../../app/channel-settings/server/functions/saveRoomReadOnly'; -import { saveRoomSystemMessages } from '../../../app/channel-settings/server/functions/saveRoomSystemMessages'; -import { saveRoomTopic } from '../../../app/channel-settings/server/functions/saveRoomTopic'; -import { saveRoomType } from '../../../app/channel-settings/server/functions/saveRoomType'; -import { notifyOnRoomChangedById } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; import { RoomSettingsEnum } from '../../../definition/IRoomTypeConfig'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { isABACManagedRoom } from '../../lib/authorization/isABACManagedRoom'; +import { notifyOnRoomChangedById } from '../../lib/notifyListener'; import { roomCoordinator } from '../../lib/rooms/roomCoordinator'; import { setRoomAvatar } from '../../lib/rooms/setRoomAvatar'; +import { saveReactWhenReadOnly } from '../../lib/rooms/settings/saveReactWhenReadOnly'; +import { saveRoomAnnouncement } from '../../lib/rooms/settings/saveRoomAnnouncement'; +import { saveRoomCustomFields } from '../../lib/rooms/settings/saveRoomCustomFields'; +import { saveRoomDescription } from '../../lib/rooms/settings/saveRoomDescription'; +import { saveRoomEncrypted } from '../../lib/rooms/settings/saveRoomEncrypted'; +import { saveRoomName } from '../../lib/rooms/settings/saveRoomName'; +import { saveRoomReadOnly } from '../../lib/rooms/settings/saveRoomReadOnly'; +import { saveRoomSystemMessages } from '../../lib/rooms/settings/saveRoomSystemMessages'; +import { saveRoomTopic } from '../../lib/rooms/settings/saveRoomTopic'; +import { saveRoomType } from '../../lib/rooms/settings/saveRoomType'; +import { settings } from '../../settings'; type RoomSettings = { roomAvatar: string; diff --git a/apps/meteor/server/meteor-methods/rooms/toggleFavorite.ts b/apps/meteor/server/meteor-methods/rooms/toggleFavorite.ts index 1f0137200b989..1e8cd97194eb3 100644 --- a/apps/meteor/server/meteor-methods/rooms/toggleFavorite.ts +++ b/apps/meteor/server/meteor-methods/rooms/toggleFavorite.ts @@ -4,8 +4,8 @@ import { Subscriptions } from '@rocket.chat/models'; import { Match, check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { notifyOnSubscriptionChangedByRoomIdAndUserId } from '../../../app/lib/server/lib/notifyListener'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; +import { notifyOnSubscriptionChangedByRoomIdAndUserId } from '../../lib/notifyListener'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/rooms/unarchiveRoom.ts b/apps/meteor/server/meteor-methods/rooms/unarchiveRoom.ts index 23eebb980b2fd..19f0818e722d6 100644 --- a/apps/meteor/server/meteor-methods/rooms/unarchiveRoom.ts +++ b/apps/meteor/server/meteor-methods/rooms/unarchiveRoom.ts @@ -4,8 +4,8 @@ import { Users, Rooms } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { unarchiveRoom } from '../../lib/rooms/unarchiveRoom'; declare module '@rocket.chat/ddp-client' { diff --git a/apps/meteor/server/meteor-methods/rooms/unmuteUserInRoom.ts b/apps/meteor/server/meteor-methods/rooms/unmuteUserInRoom.ts index 78c0700bbcf0b..cf0da88ab10ee 100644 --- a/apps/meteor/server/meteor-methods/rooms/unmuteUserInRoom.ts +++ b/apps/meteor/server/meteor-methods/rooms/unmuteUserInRoom.ts @@ -3,10 +3,10 @@ import type { IRoom } from '@rocket.chat/core-typings'; import { Rooms, Subscriptions, Users } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { notifyOnRoomChangedById } from '../../../app/lib/server/lib/notifyListener'; import { RoomMemberActions } from '../../../definition/IRoomTypeConfig'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { callbacks } from '../../lib/callbacks'; +import { notifyOnRoomChangedById } from '../../lib/notifyListener'; import { roomCoordinator } from '../../lib/rooms/roomCoordinator'; declare module '@rocket.chat/ddp-client' { diff --git a/apps/meteor/server/meteor-methods/settings/getSetupWizardParameters.ts b/apps/meteor/server/meteor-methods/settings/getSetupWizardParameters.ts index 8f8defd34dc00..716f2459a9765 100644 --- a/apps/meteor/server/meteor-methods/settings/getSetupWizardParameters.ts +++ b/apps/meteor/server/meteor-methods/settings/getSetupWizardParameters.ts @@ -3,7 +3,7 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Settings } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/settings/saveSetting.ts b/apps/meteor/server/meteor-methods/settings/saveSetting.ts index b1e77354fe250..a39c594cb6822 100644 --- a/apps/meteor/server/meteor-methods/settings/saveSetting.ts +++ b/apps/meteor/server/meteor-methods/settings/saveSetting.ts @@ -5,10 +5,10 @@ import { Match, check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; import { getSettingPermissionId } from '../../../app/authorization/lib'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { notifyOnSettingChanged } from '../../../app/lib/server/lib/notifyListener'; import { twoFactorRequired } from '../../lib/2fa/twoFactorRequired'; import { hasPermissionAsync, hasAllPermissionAsync } from '../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; +import { notifyOnSettingChanged } from '../../lib/notifyListener'; import { disableCustomScripts } from '../../lib/shared/disableCustomScripts'; import { updateAuditedByUser } from '../../settings/lib/auditedSettingUpdates'; diff --git a/apps/meteor/server/meteor-methods/settings/saveSettings.ts b/apps/meteor/server/meteor-methods/settings/saveSettings.ts index 9e3507883f263..b574b4ab98ed1 100644 --- a/apps/meteor/server/meteor-methods/settings/saveSettings.ts +++ b/apps/meteor/server/meteor-methods/settings/saveSettings.ts @@ -2,9 +2,9 @@ import type { ISetting } from '@rocket.chat/core-typings'; import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Meteor } from 'meteor/meteor'; -import { saveSettingsBulk } from '../../../app/lib/server/functions/saveSettingsBulk'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; import { twoFactorRequired } from '../../lib/2fa/twoFactorRequired'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; +import { saveSettingsBulk } from '../../settings/lib/saveSettingsBulk'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/settings/sendSMTPTestEmail.ts b/apps/meteor/server/meteor-methods/settings/sendSMTPTestEmail.ts index c9aefa23efe4f..e03d98dc6e530 100644 --- a/apps/meteor/server/meteor-methods/settings/sendSMTPTestEmail.ts +++ b/apps/meteor/server/meteor-methods/settings/sendSMTPTestEmail.ts @@ -2,8 +2,8 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { DDPRateLimiter } from 'meteor/ddp-rate-limiter'; import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../app/settings/server'; import * as Mailer from '../../lib/notifications/email/api'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/users/blockUser.ts b/apps/meteor/server/meteor-methods/users/blockUser.ts index cc6c98d9fa026..617c2e1c7a46a 100644 --- a/apps/meteor/server/meteor-methods/users/blockUser.ts +++ b/apps/meteor/server/meteor-methods/users/blockUser.ts @@ -2,7 +2,7 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { blockUserMethod } from '../../lib/users/blockUser'; declare module '@rocket.chat/ddp-client' { diff --git a/apps/meteor/app/user-status/server/methods/deleteCustomUserStatus.ts b/apps/meteor/server/meteor-methods/users/deleteCustomUserStatus.ts similarity index 87% rename from apps/meteor/app/user-status/server/methods/deleteCustomUserStatus.ts rename to apps/meteor/server/meteor-methods/users/deleteCustomUserStatus.ts index ed2f6ee89dd86..7296cf829e155 100644 --- a/apps/meteor/app/user-status/server/methods/deleteCustomUserStatus.ts +++ b/apps/meteor/server/meteor-methods/users/deleteCustomUserStatus.ts @@ -3,8 +3,8 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { CustomUserStatus } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { hasPermissionAsync } from '../../../../server/lib/authorization/hasPermission'; -import { methodDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger'; +import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/users/deleteUser.ts b/apps/meteor/server/meteor-methods/users/deleteUser.ts index 8763f51e688bf..ab5fed472bb8e 100644 --- a/apps/meteor/server/meteor-methods/users/deleteUser.ts +++ b/apps/meteor/server/meteor-methods/users/deleteUser.ts @@ -4,8 +4,8 @@ import { Users } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { deleteUser } from '../../lib/users/deleteUser'; declare module '@rocket.chat/ddp-client' { diff --git a/apps/meteor/server/meteor-methods/users/deleteUserOwnAccount.ts b/apps/meteor/server/meteor-methods/users/deleteUserOwnAccount.ts index 6c09a74a14cfa..0ce89285d5e08 100644 --- a/apps/meteor/server/meteor-methods/users/deleteUserOwnAccount.ts +++ b/apps/meteor/server/meteor-methods/users/deleteUserOwnAccount.ts @@ -6,10 +6,10 @@ import { Accounts } from 'meteor/accounts-base'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { settings } from '../../../app/settings/server'; import { trim } from '../../../lib/utils/stringUtils'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { deleteUser } from '../../lib/users/deleteUser'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/app/user-status/server/methods/getUserStatusText.ts b/apps/meteor/server/meteor-methods/users/getUserStatusText.ts similarity index 80% rename from apps/meteor/app/user-status/server/methods/getUserStatusText.ts rename to apps/meteor/server/meteor-methods/users/getUserStatusText.ts index e1be661c4d808..91e3ddb80f91c 100644 --- a/apps/meteor/app/user-status/server/methods/getUserStatusText.ts +++ b/apps/meteor/server/meteor-methods/users/getUserStatusText.ts @@ -1,8 +1,8 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Meteor } from 'meteor/meteor'; -import { getStatusText } from '../../../../server/lib/users/getStatusText'; -import { methodDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; +import { getStatusText } from '../../lib/users/getStatusText'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/users/getUsernameSuggestion.ts b/apps/meteor/server/meteor-methods/users/getUsernameSuggestion.ts index 51e39557f9be2..d567b4ebcd8fe 100644 --- a/apps/meteor/server/meteor-methods/users/getUsernameSuggestion.ts +++ b/apps/meteor/server/meteor-methods/users/getUsernameSuggestion.ts @@ -1,7 +1,7 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { generateUsernameSuggestion } from '../../lib/users/getUsernameSuggestion'; declare module '@rocket.chat/ddp-client' { diff --git a/apps/meteor/server/meteor-methods/users/getUsersOfRoom.ts b/apps/meteor/server/meteor-methods/users/getUsersOfRoom.ts index da3304052f02a..c7a924c7eb3fa 100644 --- a/apps/meteor/server/meteor-methods/users/getUsersOfRoom.ts +++ b/apps/meteor/server/meteor-methods/users/getUsersOfRoom.ts @@ -5,7 +5,7 @@ import { Subscriptions, Rooms } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { canAccessRoomAsync, roomAccessAttributes } from '../../../app/authorization/server'; +import { canAccessRoomAsync, roomAccessAttributes } from '../../lib/authorization'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { findUsersOfRoom } from '../../lib/findUsersOfRoom'; diff --git a/apps/meteor/server/meteor-methods/users/ignoreUser.ts b/apps/meteor/server/meteor-methods/users/ignoreUser.ts index 3cccf4ec574eb..cbb65f615ac2c 100644 --- a/apps/meteor/server/meteor-methods/users/ignoreUser.ts +++ b/apps/meteor/server/meteor-methods/users/ignoreUser.ts @@ -3,8 +3,8 @@ import { Subscriptions } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { notifyOnSubscriptionChangedById } from '../../../app/lib/server/lib/notifyListener'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; +import { notifyOnSubscriptionChangedById } from '../../lib/notifyListener'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/app/user-status/server/methods/insertOrUpdateUserStatus.ts b/apps/meteor/server/meteor-methods/users/insertOrUpdateUserStatus.ts similarity index 93% rename from apps/meteor/app/user-status/server/methods/insertOrUpdateUserStatus.ts rename to apps/meteor/server/meteor-methods/users/insertOrUpdateUserStatus.ts index d9b69056519b2..9a6aba971f13c 100644 --- a/apps/meteor/app/user-status/server/methods/insertOrUpdateUserStatus.ts +++ b/apps/meteor/server/meteor-methods/users/insertOrUpdateUserStatus.ts @@ -5,9 +5,9 @@ import type { InsertionModel } from '@rocket.chat/model-typings'; import { CustomUserStatus } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { trim } from '../../../../lib/utils/stringUtils'; -import { hasPermissionAsync } from '../../../../server/lib/authorization/hasPermission'; -import { methodDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger'; +import { trim } from '../../../lib/utils/stringUtils'; +import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; type InsertOrUpdateUserStatus = { _id?: string; diff --git a/apps/meteor/app/user-status/server/methods/listCustomUserStatus.ts b/apps/meteor/server/meteor-methods/users/listCustomUserStatus.ts similarity index 100% rename from apps/meteor/app/user-status/server/methods/listCustomUserStatus.ts rename to apps/meteor/server/meteor-methods/users/listCustomUserStatus.ts diff --git a/apps/meteor/server/meteor-methods/users/registerUser.ts b/apps/meteor/server/meteor-methods/users/registerUser.ts index 81888713ae918..e8993e8890b4b 100644 --- a/apps/meteor/server/meteor-methods/users/registerUser.ts +++ b/apps/meteor/server/meteor-methods/users/registerUser.ts @@ -6,10 +6,12 @@ import { Match, check } from 'meteor/check'; import { DDPRateLimiter } from 'meteor/ddp-rate-limiter'; import { Meteor } from 'meteor/meteor'; -import { validateInviteToken } from '../../../app/invites/server/functions/validateInviteToken'; -import { validateEmailDomain, passwordPolicy, RateLimiter } from '../../../app/lib/server'; -import { settings } from '../../../app/settings/server'; import { trim } from '../../../lib/utils/stringUtils'; +import { RateLimiterClass as RateLimiter } from '../../lib/RateLimiter'; +import { passwordPolicy } from '../../lib/auth/passwordPolicy'; +import { validateInviteToken } from '../../lib/rooms/invites/validateInviteToken'; +import { validateEmailDomain } from '../../lib/validateEmailDomain'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/users/resetAvatar.ts b/apps/meteor/server/meteor-methods/users/resetAvatar.ts index ba9f00e3676c3..bbd1f6a14ea66 100644 --- a/apps/meteor/server/meteor-methods/users/resetAvatar.ts +++ b/apps/meteor/server/meteor-methods/users/resetAvatar.ts @@ -5,9 +5,9 @@ import { Users } from '@rocket.chat/models'; import { DDPRateLimiter } from 'meteor/ddp-rate-limiter'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { settings } from '../../../app/settings/server'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/users/saveNotificationSettings.ts b/apps/meteor/server/meteor-methods/users/saveNotificationSettings.ts index 21b730b07176c..bd7ad4d2d9319 100644 --- a/apps/meteor/server/meteor-methods/users/saveNotificationSettings.ts +++ b/apps/meteor/server/meteor-methods/users/saveNotificationSettings.ts @@ -4,9 +4,9 @@ import { Subscriptions } from '@rocket.chat/models'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { notifyOnSubscriptionChangedById } from '../../../app/lib/server/lib/notifyListener'; -import { getUserNotificationPreference } from '../../../app/utils/server/getUserNotificationPreference'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; +import { notifyOnSubscriptionChangedById } from '../../lib/notifyListener'; +import { getUserNotificationPreference } from '../../lib/utils/getUserNotificationPreference'; const saveAudioNotificationValue = (subId: ISubscription['_id'], value: string) => value === 'default' ? Subscriptions.clearAudioNotificationValueById(subId) : Subscriptions.updateAudioNotificationValueById(subId, value); diff --git a/apps/meteor/server/meteor-methods/users/saveUserPreferences.ts b/apps/meteor/server/meteor-methods/users/saveUserPreferences.ts index 2fa11610d89aa..46bf6ec3cc126 100644 --- a/apps/meteor/server/meteor-methods/users/saveUserPreferences.ts +++ b/apps/meteor/server/meteor-methods/users/saveUserPreferences.ts @@ -5,14 +5,14 @@ import type { FontSize } from '@rocket.chat/rest-typings'; import { Match, check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { notifyOnSubscriptionChangedByAutoTranslateAndUserId, notifyOnSubscriptionChangedByUserId, notifyOnSubscriptionChangedByUserPreferences, notifyOnUserChange, -} from '../../../app/lib/server/lib/notifyListener'; -import { settings as rcSettings } from '../../../app/settings/server'; +} from '../../lib/notifyListener'; +import { settings as rcSettings } from '../../settings'; type UserPreferences = { language: string; diff --git a/apps/meteor/server/meteor-methods/users/saveUserProfile.ts b/apps/meteor/server/meteor-methods/users/saveUserProfile.ts index 2902aa6f403a2..2d0df9372c207 100644 --- a/apps/meteor/server/meteor-methods/users/saveUserProfile.ts +++ b/apps/meteor/server/meteor-methods/users/saveUserProfile.ts @@ -7,18 +7,18 @@ import { Meteor } from 'meteor/meteor'; import type { UpdateFilter } from 'mongodb'; import { setEmailFunction } from './setEmail'; -import { notifyOnUserChange } from '../../../app/lib/server/lib/notifyListener'; -import { passwordPolicy } from '../../../app/lib/server/lib/passwordPolicy'; -import { settings as rcSettings } from '../../../app/settings/server'; -import { setUserStatusMethod } from '../../../app/user-status/server/methods/setUserStatus'; +import { setUserStatusMethod } from './setUserStatus'; import { getUserInfo } from '../../api/lib/getUserInfo'; import { type AuthenticatedContext, twoFactorRequired } from '../../lib/2fa/twoFactorRequired'; +import { passwordPolicy } from '../../lib/auth/passwordPolicy'; import { callbacks } from '../../lib/callbacks'; import { compareUserPassword } from '../../lib/compareUserPassword'; import { compareUserPasswordHistory } from '../../lib/compareUserPasswordHistory'; +import { notifyOnUserChange } from '../../lib/notifyListener'; import { saveCustomFields } from '../../lib/users/saveCustomFields'; import { validateUserEditing } from '../../lib/users/saveUser'; import { saveUserIdentity } from '../../lib/users/saveUserIdentity'; +import { settings as rcSettings } from '../../settings'; const MAX_BIO_LENGTH = 260; const MAX_NICKNAME_LENGTH = 120; diff --git a/apps/meteor/server/meteor-methods/users/setAvatarFromService.ts b/apps/meteor/server/meteor-methods/users/setAvatarFromService.ts index 3bb390fc5451c..4470f572466c7 100644 --- a/apps/meteor/server/meteor-methods/users/setAvatarFromService.ts +++ b/apps/meteor/server/meteor-methods/users/setAvatarFromService.ts @@ -3,7 +3,7 @@ import { Match, check } from 'meteor/check'; import { DDPRateLimiter } from 'meteor/ddp-rate-limiter'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { setAvatarFromServiceWithValidation } from '../../lib/users/setUserAvatar'; declare module '@rocket.chat/ddp-client' { diff --git a/apps/meteor/server/meteor-methods/users/setEmail.ts b/apps/meteor/server/meteor-methods/users/setEmail.ts index f8c9a16838670..7268514e79798 100644 --- a/apps/meteor/server/meteor-methods/users/setEmail.ts +++ b/apps/meteor/server/meteor-methods/users/setEmail.ts @@ -3,10 +3,10 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { RateLimiter } from '../../../app/lib/server/lib'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { settings } from '../../../app/settings/server'; +import { RateLimiterClass as RateLimiter } from '../../lib/RateLimiter'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { setEmail } from '../../lib/users/setEmail'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/users/setRealName.ts b/apps/meteor/server/meteor-methods/users/setRealName.ts index db73aacb2c3fe..62864aac58495 100644 --- a/apps/meteor/server/meteor-methods/users/setRealName.ts +++ b/apps/meteor/server/meteor-methods/users/setRealName.ts @@ -2,10 +2,10 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { RateLimiter } from '../../../app/lib/server/lib'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; -import { settings } from '../../../app/settings/server'; +import { RateLimiterClass as RateLimiter } from '../../lib/RateLimiter'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { setRealName } from '../../lib/users/setRealName'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/app/user-status/server/methods/setUserStatus.ts b/apps/meteor/server/meteor-methods/users/setUserStatus.ts similarity index 93% rename from apps/meteor/app/user-status/server/methods/setUserStatus.ts rename to apps/meteor/server/meteor-methods/users/setUserStatus.ts index 5ad743df9fb7b..a9f8a1b1113ca 100644 --- a/apps/meteor/app/user-status/server/methods/setUserStatus.ts +++ b/apps/meteor/server/meteor-methods/users/setUserStatus.ts @@ -3,8 +3,8 @@ import { UserStatus, type IUser } from '@rocket.chat/core-typings'; import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Meteor } from 'meteor/meteor'; -import { RateLimiter } from '../../../lib/server'; -import { settings } from '../../../settings/server'; +import { RateLimiterClass as RateLimiter } from '../../lib/RateLimiter'; +import { settings } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/users/unblockUser.ts b/apps/meteor/server/meteor-methods/users/unblockUser.ts index 59c0b8035c9f8..29ed93e5b2038 100644 --- a/apps/meteor/server/meteor-methods/users/unblockUser.ts +++ b/apps/meteor/server/meteor-methods/users/unblockUser.ts @@ -2,7 +2,7 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; import { unblockUserMethod } from '../../lib/users/unblockUser'; declare module '@rocket.chat/ddp-client' { diff --git a/apps/meteor/server/meteor-methods/users/userPresence.ts b/apps/meteor/server/meteor-methods/users/userPresence.ts index 3971529ac5ae4..aa3a2fbc9dbe5 100644 --- a/apps/meteor/server/meteor-methods/users/userPresence.ts +++ b/apps/meteor/server/meteor-methods/users/userPresence.ts @@ -3,7 +3,7 @@ import { UserStatus } from '@rocket.chat/core-typings'; import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/meteor-methods/users/userSetUtcOffset.ts b/apps/meteor/server/meteor-methods/users/userSetUtcOffset.ts index e3625443da148..4ccfcc1aac78b 100644 --- a/apps/meteor/server/meteor-methods/users/userSetUtcOffset.ts +++ b/apps/meteor/server/meteor-methods/users/userSetUtcOffset.ts @@ -4,7 +4,7 @@ import { check } from 'meteor/check'; import { DDPRateLimiter } from 'meteor/ddp-rate-limiter'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../../app/lib/server/lib/deprecationWarningLogger'; +import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/modules/core-apps/cloudAnnouncements.module.ts b/apps/meteor/server/modules/core-apps/cloudAnnouncements.module.ts index d32f4f7351377..560b250e52cbe 100644 --- a/apps/meteor/server/modules/core-apps/cloudAnnouncements.module.ts +++ b/apps/meteor/server/modules/core-apps/cloudAnnouncements.module.ts @@ -11,13 +11,13 @@ import { serverFetch as fetch } from '@rocket.chat/server-fetch'; import { isTruthy } from '@rocket.chat/tools'; import type * as UiKit from '@rocket.chat/ui-kit'; -import { settings } from '../../../app/settings/server'; import { CloudWorkspaceConnectionError } from '../../../lib/errors/CloudWorkspaceConnectionError'; import { InvalidCloudAnnouncementInteractionError } from '../../../lib/errors/InvalidCloudAnnouncementInteractionError'; import { InvalidCoreAppInteractionError } from '../../../lib/errors/InvalidCoreAppInteractionError'; import { getWorkspaceAccessToken } from '../../lib/cloud'; import { syncWorkspace } from '../../lib/cloud/syncWorkspace'; import { SystemLogger } from '../../lib/logger/system'; +import { settings } from '../../settings'; type CloudAnnouncementInteractant = | { diff --git a/apps/meteor/server/modules/core-apps/nps/createModal.ts b/apps/meteor/server/modules/core-apps/nps/createModal.ts index 5179cdecc5eaa..284690a227bc5 100644 --- a/apps/meteor/server/modules/core-apps/nps/createModal.ts +++ b/apps/meteor/server/modules/core-apps/nps/createModal.ts @@ -1,7 +1,7 @@ import type { IUser } from '@rocket.chat/core-typings'; -import { settings } from '../../../../app/settings/server'; import { i18n } from '../../../lib/i18n'; +import { settings } from '../../../settings'; type ModalParams = { id: string; diff --git a/apps/meteor/server/modules/listeners/listeners.module.ts b/apps/meteor/server/modules/listeners/listeners.module.ts index 7b221dd7781b8..40a9baeb467e1 100644 --- a/apps/meteor/server/modules/listeners/listeners.module.ts +++ b/apps/meteor/server/modules/listeners/listeners.module.ts @@ -8,7 +8,7 @@ import { Logger } from '@rocket.chat/logger'; import type { ServerMediaSignal } from '@rocket.chat/media-signaling'; import { parse } from '@rocket.chat/message-parser'; -import { settings } from '../../../app/settings/server/cached'; +import { settings } from '../../settings/cached'; import type { NotificationsModule } from '../notifications/notifications.module'; const isMessageParserDisabled = process.env.DISABLE_MESSAGE_PARSER === 'true'; diff --git a/apps/meteor/server/publications/room/index.ts b/apps/meteor/server/publications/room/index.ts index 7feba676a1c3d..40b30996a4025 100644 --- a/apps/meteor/server/publications/room/index.ts +++ b/apps/meteor/server/publications/room/index.ts @@ -4,11 +4,11 @@ import { Rooms } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; import _ from 'underscore'; -import { canAccessRoomAsync } from '../../../app/authorization/server'; -import { settings } from '../../../app/settings/server'; import { roomFields } from '../../../lib/publishFields'; +import { canAccessRoomAsync } from '../../lib/authorization'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { roomCoordinator } from '../../lib/rooms/roomCoordinator'; +import { settings } from '../../settings'; type PublicRoomField = keyof typeof roomFields; type PublicRoom = Pick & Pick; diff --git a/apps/meteor/server/publications/settings/index.ts b/apps/meteor/server/publications/settings/index.ts index 9bd5d949d60b6..48490d2f17eda 100644 --- a/apps/meteor/server/publications/settings/index.ts +++ b/apps/meteor/server/publications/settings/index.ts @@ -5,8 +5,8 @@ import { Meteor } from 'meteor/meteor'; import type { WithId } from 'mongodb'; import { getSettingPermissionId } from '../../../app/authorization/lib'; -import { SettingsEvents } from '../../../app/settings/server'; import { hasPermissionAsync, hasAtLeastOnePermissionAsync } from '../../lib/authorization/hasPermission'; +import { SettingsEvents } from '../../settings'; declare module '@rocket.chat/ddp-client' { // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/apps/meteor/server/publications/spotlight.ts b/apps/meteor/server/publications/spotlight.ts index 41caac4e5a710..2af19e8281833 100644 --- a/apps/meteor/server/publications/spotlight.ts +++ b/apps/meteor/server/publications/spotlight.ts @@ -2,7 +2,7 @@ import type { ServerMethods } from '@rocket.chat/ddp-client'; import { DDPRateLimiter } from 'meteor/ddp-rate-limiter'; import { Meteor } from 'meteor/meteor'; -import { methodDeprecationLogger } from '../../app/lib/server/lib/deprecationWarningLogger'; +import { methodDeprecationLogger } from '../lib/deprecationWarningLogger'; import { Spotlight } from '../lib/spotlight'; type SpotlightType = { diff --git a/apps/meteor/server/routes/avatar/middlewares/browserVersion.spec.ts b/apps/meteor/server/routes/avatar/middlewares/browserVersion.spec.ts index 6b627cb3b2243..8480480bf1a06 100644 --- a/apps/meteor/server/routes/avatar/middlewares/browserVersion.spec.ts +++ b/apps/meteor/server/routes/avatar/middlewares/browserVersion.spec.ts @@ -11,7 +11,7 @@ const { handleBrowserVersionCheck, isIEOlderThan11 } = proxyquire.noCallThru().l 'meteor/ostrio:cookies': { Cookies: CookiesMock, }, - '../../../../app/utils/server/getURL': { + '../../../lib/utils/getURL': { getURL: () => '', }, }); diff --git a/apps/meteor/server/routes/avatar/middlewares/browserVersion.ts b/apps/meteor/server/routes/avatar/middlewares/browserVersion.ts index 9eaf89e1445a2..82d3606fd906f 100644 --- a/apps/meteor/server/routes/avatar/middlewares/browserVersion.ts +++ b/apps/meteor/server/routes/avatar/middlewares/browserVersion.ts @@ -5,7 +5,7 @@ import type { NextFunction } from 'connect'; import { Cookies } from 'meteor/ostrio:cookies'; import parser from 'ua-parser-js'; -import { getURL } from '../../../../app/utils/server/getURL'; +import { getURL } from '../../../lib/utils/getURL'; const cookies = new Cookies(); diff --git a/apps/meteor/server/routes/avatar/room.spec.ts b/apps/meteor/server/routes/avatar/room.spec.ts index 1b2fd71e95d93..a7bd494d0ffe0 100644 --- a/apps/meteor/server/routes/avatar/room.spec.ts +++ b/apps/meteor/server/routes/avatar/room.spec.ts @@ -29,11 +29,6 @@ const { roomAvatar } = proxyquire.noCallThru().load('./room', { findOneByRoomId: mocks.avatarFindOneByRoomId, }, }, - '../../../app/settings/server': { - settings: { - get: mocks.settingsGet, - }, - }, './utils': mocks.utils, '../../lib/rooms/roomCoordinator': { roomCoordinator: { diff --git a/apps/meteor/server/routes/avatar/user.spec.ts b/apps/meteor/server/routes/avatar/user.spec.ts index 1604c545aa056..db7aa6c676c8d 100644 --- a/apps/meteor/server/routes/avatar/user.spec.ts +++ b/apps/meteor/server/routes/avatar/user.spec.ts @@ -30,7 +30,7 @@ const { userAvatarById, userAvatarByUsername } = proxyquire.noCallThru().load('. findOneByUserId: mocks.avatarFindOneByUserId, }, }, - '../../../app/settings/server': { + '../../settings': { settings: { get: mocks.settingsGet, }, diff --git a/apps/meteor/server/routes/avatar/user.ts b/apps/meteor/server/routes/avatar/user.ts index e31848ad9c018..165324ecc4ccf 100644 --- a/apps/meteor/server/routes/avatar/user.ts +++ b/apps/meteor/server/routes/avatar/user.ts @@ -7,7 +7,7 @@ import { serverFetch as fetch } from '@rocket.chat/server-fetch'; import type { NextFunction } from 'connect'; import { serveSvgAvatarInRequestedFormat, wasFallbackModified, setCacheAndDispositionHeaders, serveAvatarFile } from './utils'; -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; const handleExternalProvider = async (externalProviderUrl: string, username: string, res: ServerResponse): Promise => { const response = await fetch(externalProviderUrl.replace('{username}', username), { diff --git a/apps/meteor/server/routes/avatar/utils.spec.ts b/apps/meteor/server/routes/avatar/utils.spec.ts index db02daa19601b..9dbb104c46270 100644 --- a/apps/meteor/server/routes/avatar/utils.spec.ts +++ b/apps/meteor/server/routes/avatar/utils.spec.ts @@ -27,9 +27,6 @@ const { 'meteor/ostrio:cookies': { Cookies: CookiesMock, }, - '../../../../app/utils/server/getURL': { - getURL: () => '', - }, '@rocket.chat/models': { Users: { findOneByIdAndLoginToken: mocks.findOneByIdAndLoginToken, @@ -40,7 +37,7 @@ const { get: mocks.fileUploadGet, }, }, - '../../../app/settings/server': { + '../../settings': { settings: { get: mocks.settingsGet, }, diff --git a/apps/meteor/server/routes/avatar/utils.ts b/apps/meteor/server/routes/avatar/utils.ts index 795c9b594eaf3..d4509e4ec7fd4 100644 --- a/apps/meteor/server/routes/avatar/utils.ts +++ b/apps/meteor/server/routes/avatar/utils.ts @@ -9,9 +9,9 @@ import sanitizeHtml from 'sanitize-html'; import sharp from 'sharp'; import { throttle } from 'underscore'; -import { settings } from '../../../app/settings/server'; -import { getAvatarColor } from '../../../app/utils/lib/getAvatarColor'; import { FileUpload } from '../../lib/media/file-upload'; +import { getAvatarColor } from '../../lib/utils/lib/getAvatarColor'; +import { settings } from '../../settings'; const FALLBACK_LAST_MODIFIED = 'Thu, 01 Jan 2015 00:00:00 GMT'; diff --git a/apps/meteor/server/routes/userDataDownload.ts b/apps/meteor/server/routes/userDataDownload.ts index ca7437ec3ed03..cc4c02d3a1328 100644 --- a/apps/meteor/server/routes/userDataDownload.ts +++ b/apps/meteor/server/routes/userDataDownload.ts @@ -7,8 +7,8 @@ import { Cookies } from 'meteor/ostrio:cookies'; import { WebApp } from 'meteor/webapp'; import { match } from 'path-to-regexp'; -import { settings } from '../../app/settings/server'; import { FileUpload } from '../lib/media/file-upload'; +import { settings } from '../settings'; const cookies = new Cookies(); diff --git a/apps/meteor/server/services/calendar/service.ts b/apps/meteor/server/services/calendar/service.ts index 9e842397a5202..ffd17bf1813e3 100644 --- a/apps/meteor/server/services/calendar/service.ts +++ b/apps/meteor/server/services/calendar/service.ts @@ -9,9 +9,9 @@ import { CalendarEvent, Users } from '@rocket.chat/models'; import type { UpdateResult, DeleteResult } from 'mongodb'; import { getShiftedTime } from './utils/getShiftedTime'; -import { settings } from '../../../app/settings/server'; -import { getUserPreference } from '../../../app/utils/server/lib/getUserPreference'; import { i18n } from '../../lib/i18n'; +import { getUserPreference } from '../../lib/utils/lib/getUserPreference'; +import { settings } from '../../settings'; const logger = new Logger('Calendar'); diff --git a/apps/meteor/server/services/federation/Settings.ts b/apps/meteor/server/services/federation/Settings.ts index 464027f81b861..0d63f06d2d1e2 100644 --- a/apps/meteor/server/services/federation/Settings.ts +++ b/apps/meteor/server/services/federation/Settings.ts @@ -1,6 +1,6 @@ import crypto from 'node:crypto'; -import { settings, settingsRegistry } from '../../../app/settings/server'; +import { settings, settingsRegistry } from '../../settings'; export const addMatrixBridgeFederationSettings = async (): Promise => { await settingsRegistry.add('Federation_Matrix_enabled', false, { diff --git a/apps/meteor/server/services/federation/infrastructure/rocket-chat/adapters/Statistics.ts b/apps/meteor/server/services/federation/infrastructure/rocket-chat/adapters/Statistics.ts index 81a645329f8ee..1852e4e97cecf 100644 --- a/apps/meteor/server/services/federation/infrastructure/rocket-chat/adapters/Statistics.ts +++ b/apps/meteor/server/services/federation/infrastructure/rocket-chat/adapters/Statistics.ts @@ -1,7 +1,7 @@ import type { IMatrixFederationStatistics } from '@rocket.chat/core-typings'; import { Rooms, Users } from '@rocket.chat/models'; -import { settings } from '../../../../../../app/settings/server'; +import { settings } from '../../../../../settings'; class RocketChatStatisticsAdapter { async getBiggestRoomAvailable(): Promise<{ diff --git a/apps/meteor/server/services/federation/utils.ts b/apps/meteor/server/services/federation/utils.ts index dd9f0165b626a..591c5fca0a406 100644 --- a/apps/meteor/server/services/federation/utils.ts +++ b/apps/meteor/server/services/federation/utils.ts @@ -1,4 +1,4 @@ -import { settings } from '../../../app/settings/server'; +import { settings } from '../../settings'; export function isFederationEnabled(): boolean { return settings.get('Federation_Service_Enabled'); diff --git a/apps/meteor/server/services/import/service.spec.ts b/apps/meteor/server/services/import/service.spec.ts index 9e7f77eaa71fc..698b223dfd61f 100644 --- a/apps/meteor/server/services/import/service.spec.ts +++ b/apps/meteor/server/services/import/service.spec.ts @@ -41,7 +41,7 @@ jest.mock('../../lib/import', () => ({ })); const mockSettingsGet = jest.fn(); -jest.mock('../../../app/settings/server', () => ({ +jest.mock('../../settings', () => ({ settings: { get: (...args: unknown[]) => mockSettingsGet(...args), }, diff --git a/apps/meteor/server/services/import/service.ts b/apps/meteor/server/services/import/service.ts index f71f460bd3bab..772f936b9092c 100644 --- a/apps/meteor/server/services/import/service.ts +++ b/apps/meteor/server/services/import/service.ts @@ -4,9 +4,9 @@ import type { IImportUser, IImport, ImportStatus } from '@rocket.chat/core-typin import { Imports, ImportData } from '@rocket.chat/models'; import { ObjectId } from 'mongodb'; -import { settings } from '../../../app/settings/server'; import { Importers } from '../../lib/import'; import { validateRoleList } from '../../lib/roles/validateRoleList'; +import { settings } from '../../settings'; import { getNewUserRoles } from '../user/lib/getNewUserRoles'; export class ImportService extends ServiceClassInternal implements IImportService { diff --git a/apps/meteor/server/services/media-call/push/sendVoipPushNotification.ts b/apps/meteor/server/services/media-call/push/sendVoipPushNotification.ts index 5068dcbd3e1fb..3885ce03f2549 100644 --- a/apps/meteor/server/services/media-call/push/sendVoipPushNotification.ts +++ b/apps/meteor/server/services/media-call/push/sendVoipPushNotification.ts @@ -4,12 +4,12 @@ import { MediaCalls, Users } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; import { getPushNotificationType } from './getPushNotificationType'; -import { settings } from '../../../../app/settings/server'; -import { getUserAvatarURL } from '../../../../app/utils/server/getUserAvatarURL'; -import { getUserPreference } from '../../../../app/utils/server/lib/getUserPreference'; import { metrics } from '../../../lib/metrics/lib/metrics'; import { Push } from '../../../lib/notifications/push/push'; import PushNotification from '../../../lib/notifications/push-config/lib/PushNotification'; +import { getUserAvatarURL } from '../../../lib/utils/getUserAvatarURL'; +import { getUserPreference } from '../../../lib/utils/lib/getUserPreference'; +import { settings } from '../../../settings'; import { logger } from '../logger'; async function getActorUser(actor: MediaCallContact): Promise | null> { diff --git a/apps/meteor/server/services/media-call/service.ts b/apps/meteor/server/services/media-call/service.ts index 67b813befa9a0..3e740e43a36bf 100644 --- a/apps/meteor/server/services/media-call/service.ts +++ b/apps/meteor/server/services/media-call/service.ts @@ -23,10 +23,10 @@ import { callStateToTranslationKey, getHistoryMessagePayload } from '@rocket.cha import { logger } from './logger'; import { sendVoipPushNotification } from './push/sendVoipPushNotification'; -import { settings } from '../../../app/settings/server'; import { i18n } from '../../lib/i18n'; import { sendMessage } from '../../lib/messages/sendMessage'; import { createDirectMessage } from '../../meteor-methods/messages/createDirectMessage'; +import { settings } from '../../settings'; export class MediaCallService extends ServiceClassInternal implements IMediaCallService { protected name = 'media-call'; diff --git a/apps/meteor/server/services/messages/hooks/AfterSaveOEmbed.ts b/apps/meteor/server/services/messages/hooks/AfterSaveOEmbed.ts index 2c1144d1f6904..7bae3f97e36cb 100644 --- a/apps/meteor/server/services/messages/hooks/AfterSaveOEmbed.ts +++ b/apps/meteor/server/services/messages/hooks/AfterSaveOEmbed.ts @@ -17,8 +17,8 @@ import ipRangeCheck from 'ip-range-check'; import jschardet from 'jschardet'; import { camelCase } from 'lodash'; -import { settings } from '../../../../app/settings/server'; import { Info } from '../../../../app/utils/rocketchat.info'; +import { settings } from '../../../settings'; import { afterParseUrlContent, beforeGetUrlContent } from '../lib/oembed/providers'; const MAX_EXTERNAL_URL_PREVIEWS = 5; diff --git a/apps/meteor/server/services/messages/hooks/BeforeSaveMentions.ts b/apps/meteor/server/services/messages/hooks/BeforeSaveMentions.ts index 590815368be75..05e4355c6968e 100644 --- a/apps/meteor/server/services/messages/hooks/BeforeSaveMentions.ts +++ b/apps/meteor/server/services/messages/hooks/BeforeSaveMentions.ts @@ -2,9 +2,9 @@ import { api, Team, MeteorError } from '@rocket.chat/core-services'; import type { IMessage, IUser, IRoom } from '@rocket.chat/core-typings'; import { Subscriptions, Users, Rooms } from '@rocket.chat/models'; -import { settings } from '../../../../app/settings/server'; import { i18n } from '../../../lib/i18n'; import { MentionsServer } from '../../../lib/messaging/mentions/Mentions'; +import { settings } from '../../../settings'; class MentionQueries { async getUsers(usernames: string[]): Promise<{ type: 'team' | 'user'; _id: string; username?: string; name?: string }[]> { diff --git a/apps/meteor/server/services/messages/lib/oembed/providers.ts b/apps/meteor/server/services/messages/lib/oembed/providers.ts index 56a93f485cfe1..e6931b6bc92b3 100644 --- a/apps/meteor/server/services/messages/lib/oembed/providers.ts +++ b/apps/meteor/server/services/messages/lib/oembed/providers.ts @@ -1,9 +1,9 @@ import type { OEmbedMeta, OEmbedUrlContent, OEmbedProvider } from '@rocket.chat/core-typings'; import { camelCase } from 'change-case'; -import { settings } from '../../../../../app/settings/server'; import { Info } from '../../../../../app/utils/rocketchat.info'; import { SystemLogger } from '../../../../lib/logger/system'; +import { settings } from '../../../../settings'; class Providers { private providers: OEmbedProvider[]; diff --git a/apps/meteor/server/services/messages/service.ts b/apps/meteor/server/services/messages/service.ts index 7a3d9278e8494..0a1fe9946208c 100644 --- a/apps/meteor/server/services/messages/service.ts +++ b/apps/meteor/server/services/messages/service.ts @@ -6,8 +6,6 @@ import type { MessageUrl, IMessage, MessageTypesValues, IUser, IRoom, AtLeast } import { Messages, Rooms } from '@rocket.chat/models'; import { OEmbed } from './hooks/AfterSaveOEmbed'; -import { settings } from '../../../app/settings/server'; -import { getUserAvatarURL } from '../../../app/utils/server/getUserAvatarURL'; import { BeforeSaveCannedResponse } from '../../../ee/server/hooks/messages/BeforeSaveCannedResponse'; import { FederationMatrixInvalidConfigurationError } from '../federation/utils'; import { FederationActions } from './hooks/BeforeFederationActions'; @@ -18,7 +16,6 @@ import { BeforeSaveMarkdownParser } from './hooks/BeforeSaveMarkdownParser'; import { mentionServer } from './hooks/BeforeSaveMentions'; import { BeforeSavePreventMention } from './hooks/BeforeSavePreventMention'; import { BeforeSaveSpotify } from './hooks/BeforeSaveSpotify'; -import { notifyOnRoomChangedById, notifyOnMessageChange } from '../../../app/lib/server/lib/notifyListener'; import { closeUnclosedCodeBlock } from '../../../lib/utils/closeUnclosedCodeBlock'; import { notifyUsersOnSystemMessage } from '../../hooks/messages/notifyUsersOnMessage'; import { deleteMessage } from '../../lib/messages/deleteMessage'; @@ -26,8 +23,11 @@ import { parseUrlsInMessage } from '../../lib/messages/parseUrlsInMessage'; import { sendMessage } from '../../lib/messages/sendMessage'; import { updateMessage } from '../../lib/messages/updateMessage'; import { executeSetReaction } from '../../lib/messaging/reactions/setReaction'; +import { notifyOnRoomChangedById, notifyOnMessageChange } from '../../lib/notifyListener'; import { shouldBreakInVersion } from '../../lib/shouldBreakInVersion'; +import { getUserAvatarURL } from '../../lib/utils/getUserAvatarURL'; import { executeSendMessage } from '../../meteor-methods/messages/sendMessage'; +import { settings } from '../../settings'; const disableMarkdownParser = ['yes', 'true'].includes(String(process.env.DISABLE_MESSAGE_PARSER).toLowerCase()); diff --git a/apps/meteor/server/services/meteor/service.ts b/apps/meteor/server/services/meteor/service.ts index 0974e73a58629..b2bbf64ba4ec9 100644 --- a/apps/meteor/server/services/meteor/service.ts +++ b/apps/meteor/server/services/meteor/service.ts @@ -7,20 +7,20 @@ import { wrapExceptions } from '@rocket.chat/tools'; import { Meteor } from 'meteor/meteor'; import { processOnChange, serviceConfigCallbacks } from './userReactivity'; -import { notifyGuestStatusChanged } from '../../../app/livechat/server/lib/guests'; -import { onlineAgents, monitorAgents } from '../../../app/livechat/server/lib/stream/agentStatus'; -import { settings } from '../../../app/settings/server'; -import { use } from '../../../app/settings/server/Middleware'; -import { setValue, updateValue } from '../../../app/settings/server/raw'; -import { getURL } from '../../../app/utils/server/getURL'; import { configureEmailInboxes } from '../../features/EmailInbox/EmailInbox'; import { isOutgoingIntegration } from '../../lib/integrations/lib/definition'; import { triggerHandler } from '../../lib/integrations/lib/triggerHandler'; import { metrics } from '../../lib/metrics'; import notifications from '../../lib/notifications/core/lib/Notifications'; +import { notifyGuestStatusChanged } from '../../lib/omnichannel/guests'; +import { onlineAgents, monitorAgents } from '../../lib/omnichannel/stream/agentStatus'; import { roomCoordinator } from '../../lib/rooms/roomCoordinator'; +import { getURL } from '../../lib/utils/getURL'; import { ListenersModule } from '../../modules/listeners/listeners.module'; import { invalidate as invalidatePublicationUserCache } from '../../modules/streamer/publication-user-cache'; +import { settings } from '../../settings'; +import { use } from '../../settings/Middleware'; +import { setValue, updateValue } from '../../settings/raw'; const disableMsgRoundtripTracking = ['yes', 'true'].includes(String(process.env.DISABLE_MESSAGE_ROUNDTRIP_TRACKING).toLowerCase()); diff --git a/apps/meteor/server/services/nps/getAndCreateNpsSurvey.ts b/apps/meteor/server/services/nps/getAndCreateNpsSurvey.ts index cf07c2d5425ee..c85a47715a2af 100644 --- a/apps/meteor/server/services/nps/getAndCreateNpsSurvey.ts +++ b/apps/meteor/server/services/nps/getAndCreateNpsSurvey.ts @@ -3,9 +3,9 @@ import type { IBanner, BannerPlatform } from '@rocket.chat/core-typings'; import { serverFetch as fetch } from '@rocket.chat/server-fetch'; import type * as UiKit from '@rocket.chat/ui-kit'; -import { settings } from '../../../app/settings/server'; import { getWorkspaceAccessToken } from '../../lib/cloud'; import { SystemLogger } from '../../lib/logger/system'; +import { settings } from '../../settings'; type NpsSurveyData = { id: string; diff --git a/apps/meteor/server/services/nps/notification.ts b/apps/meteor/server/services/nps/notification.ts index e8e7e621d2c7e..1e2ef02d7a979 100644 --- a/apps/meteor/server/services/nps/notification.ts +++ b/apps/meteor/server/services/nps/notification.ts @@ -3,9 +3,9 @@ import { BannerPlatform } from '@rocket.chat/core-typings'; import { Random } from '@rocket.chat/random'; import moment from 'moment'; -import { settings } from '../../../app/settings/server'; import { i18n } from '../../lib/i18n'; import { sendMessagesToAdmins } from '../../lib/sendMessagesToAdmins'; +import { settings } from '../../settings'; export const getBannerForAdmins = (expireAt: Date): Omit => { const lng = settings.get('Language') || 'en'; diff --git a/apps/meteor/server/services/nps/sendNpsResults.ts b/apps/meteor/server/services/nps/sendNpsResults.ts index 8e93d41a7b89b..261f71810d8bc 100644 --- a/apps/meteor/server/services/nps/sendNpsResults.ts +++ b/apps/meteor/server/services/nps/sendNpsResults.ts @@ -1,9 +1,9 @@ import type { INpsVote } from '@rocket.chat/core-typings'; import { serverFetch as fetch } from '@rocket.chat/server-fetch'; -import { settings } from '../../../app/settings/server'; import { getWorkspaceAccessToken } from '../../lib/cloud'; import { SystemLogger } from '../../lib/logger/system'; +import { settings } from '../../settings'; type NPSResultPayload = { total: number; diff --git a/apps/meteor/server/services/omnichannel-analytics/service.ts b/apps/meteor/server/services/omnichannel-analytics/service.ts index 24ce8ded79f2a..46e9ff577bcb6 100644 --- a/apps/meteor/server/services/omnichannel-analytics/service.ts +++ b/apps/meteor/server/services/omnichannel-analytics/service.ts @@ -14,9 +14,9 @@ import { ChartData } from './ChartData'; import { OverviewData } from './OverviewData'; import { serviceLogger } from './logger'; import { dayIterator } from './utils'; -import { getTimezone } from '../../../app/utils/server/lib/getTimezone'; import { callbacks } from '../../lib/callbacks'; import { i18n } from '../../lib/i18n'; +import { getTimezone } from '../../lib/utils/lib/getTimezone'; const HOURS_IN_DAY = 24; diff --git a/apps/meteor/server/services/omnichannel-integrations/providers/twilio.ts b/apps/meteor/server/services/omnichannel-integrations/providers/twilio.ts index e9eb3cb1ca469..f08fe24f00fc3 100644 --- a/apps/meteor/server/services/omnichannel-integrations/providers/twilio.ts +++ b/apps/meteor/server/services/omnichannel-integrations/providers/twilio.ts @@ -4,10 +4,10 @@ import { Users } from '@rocket.chat/models'; import filesize from 'filesize'; import twilio from 'twilio'; -import { settings } from '../../../../app/settings/server'; -import { fileUploadIsValidContentType } from '../../../../app/utils/server/restrictions'; import { i18n } from '../../../lib/i18n'; import { SystemLogger } from '../../../lib/logger/system'; +import { fileUploadIsValidContentType } from '../../../lib/utils/restrictions'; +import { settings } from '../../../settings'; type TwilioData = { From: string; diff --git a/apps/meteor/server/services/omnichannel/queue.ts b/apps/meteor/server/services/omnichannel/queue.ts index 5511abcfd2680..ae253c6f54f87 100644 --- a/apps/meteor/server/services/omnichannel/queue.ts +++ b/apps/meteor/server/services/omnichannel/queue.ts @@ -5,13 +5,13 @@ import { LivechatInquiry, LivechatRooms } from '@rocket.chat/models'; import { tracerSpan } from '@rocket.chat/tracing'; import { queueLogger } from './logger'; -import { notifyOnLivechatInquiryChangedByRoom } from '../../../app/lib/server/lib/notifyListener'; import { getOmniChatSortQuery } from '../../../app/livechat/lib/inquiries'; -import { dispatchAgentDelegated } from '../../../app/livechat/server/lib/Helper'; -import { RoutingManager } from '../../../app/livechat/server/lib/RoutingManager'; -import { getInquirySortMechanismSetting } from '../../../app/livechat/server/lib/settings'; -import { settings } from '../../../app/settings/server'; import { metrics } from '../../lib/metrics'; +import { notifyOnLivechatInquiryChangedByRoom } from '../../lib/notifyListener'; +import { dispatchAgentDelegated } from '../../lib/omnichannel/Helper'; +import { RoutingManager } from '../../lib/omnichannel/RoutingManager'; +import { getInquirySortMechanismSetting } from '../../lib/omnichannel/settings'; +import { settings } from '../../settings'; const DEFAULT_RACE_TIMEOUT = 5000; diff --git a/apps/meteor/server/services/omnichannel/service.ts b/apps/meteor/server/services/omnichannel/service.ts index 067cd9474ce7d..fec46e997ed23 100644 --- a/apps/meteor/server/services/omnichannel/service.ts +++ b/apps/meteor/server/services/omnichannel/service.ts @@ -5,9 +5,9 @@ import { License } from '@rocket.chat/license'; import moment from 'moment'; import { OmnichannelQueue } from './queue'; -import { RoutingManager } from '../../../app/livechat/server/lib/RoutingManager'; -import { notifyAgentStatusChanged } from '../../../app/livechat/server/lib/omni-users'; -import { settings } from '../../../app/settings/server'; +import { RoutingManager } from '../../lib/omnichannel/RoutingManager'; +import { notifyAgentStatusChanged } from '../../lib/omnichannel/omni-users'; +import { settings } from '../../settings'; export class OmnichannelService extends ServiceClassInternal implements IOmnichannelService { protected name = 'omnichannel'; diff --git a/apps/meteor/server/services/room/service.ts b/apps/meteor/server/services/room/service.ts index bd73034b6b155..a1f0b97a5ce99 100644 --- a/apps/meteor/server/services/room/service.ts +++ b/apps/meteor/server/services/room/service.ts @@ -14,18 +14,14 @@ import { Rooms, Subscriptions, Users } from '@rocket.chat/models'; import { getNameForDMs } from './getNameForDMs'; import { FederationActions } from './hooks/BeforeFederationActions'; -import { saveRoomName } from '../../../app/channel-settings/server'; -import { saveRoomTopic } from '../../../app/channel-settings/server/functions/saveRoomTopic'; +import { RoomMemberActions } from '../../../definition/IRoomTypeConfig'; +import { getSubscriptionAutotranslateDefaultConfig } from '../../lib/getSubscriptionAutotranslateDefaultConfig'; +import { readThread } from '../../lib/messaging/threads/functions'; import { notifyOnSubscriptionChanged, notifyOnSubscriptionChangedById, notifyOnSubscriptionChangedByRoomIdAndUserId, -} from '../../../app/lib/server/lib/notifyListener'; -import { getDefaultSubscriptionPref } from '../../../app/utils/lib/getDefaultSubscriptionPref'; -import { getValidRoomName } from '../../../app/utils/server/lib/getValidRoomName'; -import { RoomMemberActions } from '../../../definition/IRoomTypeConfig'; -import { getSubscriptionAutotranslateDefaultConfig } from '../../lib/getSubscriptionAutotranslateDefaultConfig'; -import { readThread } from '../../lib/messaging/threads/functions'; +} from '../../lib/notifyListener'; import { readMessages } from '../../lib/readMessages'; import { performAcceptRoomInvite } from '../../lib/rooms/acceptRoomInvite'; import { addUserToRoom } from '../../lib/rooms/addUserToRoom'; @@ -34,6 +30,10 @@ import { createRoom } from '../../lib/rooms/createRoom'; // TODO remove this imp import { executeUnbanUserFromRoom } from '../../lib/rooms/executeUnbanUserFromRoom'; import { removeUserFromRoom, performUserRemoval } from '../../lib/rooms/removeUserFromRoom'; import { roomCoordinator } from '../../lib/rooms/roomCoordinator'; +import { saveRoomName } from '../../lib/rooms/settings'; +import { saveRoomTopic } from '../../lib/rooms/settings/saveRoomTopic'; +import { getDefaultSubscriptionPref } from '../../lib/utils/lib/getDefaultSubscriptionPref'; +import { getValidRoomName } from '../../lib/utils/lib/getValidRoomName'; import { createDirectMessage } from '../../meteor-methods/messages/createDirectMessage'; import { addRoomLeader } from '../../meteor-methods/rooms/addRoomLeader'; import { addRoomModerator } from '../../meteor-methods/rooms/addRoomModerator'; diff --git a/apps/meteor/server/services/settings/service.ts b/apps/meteor/server/services/settings/service.ts index 3efb51777dc24..2ba7ae34ce2cb 100644 --- a/apps/meteor/server/services/settings/service.ts +++ b/apps/meteor/server/services/settings/service.ts @@ -3,8 +3,8 @@ import { ServiceClassInternal } from '@rocket.chat/core-services'; import type { SettingValue } from '@rocket.chat/core-typings'; import { Settings } from '@rocket.chat/models'; -import { notifyOnSettingChangedById } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; +import { notifyOnSettingChangedById } from '../../lib/notifyListener'; +import { settings } from '../../settings'; import { verifyFingerPrint } from '../../settings/misc'; export class SettingsService extends ServiceClassInternal implements ISettingsService { diff --git a/apps/meteor/server/services/startup.ts b/apps/meteor/server/services/startup.ts index b0c14c2b49913..3078a3909356c 100644 --- a/apps/meteor/server/services/startup.ts +++ b/apps/meteor/server/services/startup.ts @@ -3,7 +3,6 @@ import { Logger } from '@rocket.chat/logger'; import { OmnichannelTranscript, QueueWorker } from '@rocket.chat/omnichannel-services'; import { MongoInternals } from 'meteor/mongo'; -import { AuthorizationLivechat } from '../../app/livechat/server/roomAccessValidator.internalService'; import { isRunningMs } from '../lib/isRunningMs'; import { AnalyticsService } from './analytics/service'; import { AppsEngineService } from './apps-engine/service'; @@ -31,6 +30,7 @@ import { UploadService } from './upload/service'; import { UserService } from './user/service'; import { VideoConfService } from './video-conference/service'; import { i18n } from '../lib/i18n'; +import { AuthorizationLivechat } from '../lib/omnichannel/roomAccessValidator.internalService'; export const registerServices = async (): Promise => { const { db } = MongoInternals.defaultRemoteCollectionDriver().mongo; diff --git a/apps/meteor/server/services/team/service.ts b/apps/meteor/server/services/team/service.ts index 551e264d0e968..27b442bcf6da0 100644 --- a/apps/meteor/server/services/team/service.ts +++ b/apps/meteor/server/services/team/service.ts @@ -27,14 +27,14 @@ import { Team, Rooms, Subscriptions, Users, TeamMember } from '@rocket.chat/mode import { escapeRegExp } from '@rocket.chat/string-helpers'; import type { Document, FindOptions, Filter } from 'mongodb'; -import { saveRoomName } from '../../../app/channel-settings/server'; -import { saveRoomType } from '../../../app/channel-settings/server/functions/saveRoomType'; -import { notifyOnSubscriptionChangedByRoomIdAndUserId, notifyOnRoomChangedById } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; +import { notifyOnSubscriptionChangedByRoomIdAndUserId, notifyOnRoomChangedById } from '../../lib/notifyListener'; import { addUserToRoom } from '../../lib/rooms/addUserToRoom'; import { getSubscribedRoomsForUserWithDetails } from '../../lib/rooms/getRoomsWithSingleOwner'; import { removeUserFromRoom } from '../../lib/rooms/removeUserFromRoom'; +import { saveRoomName } from '../../lib/rooms/settings'; +import { saveRoomType } from '../../lib/rooms/settings/saveRoomType'; import { checkUsernameAvailability } from '../../lib/users/checkUsernameAvailability'; +import { settings } from '../../settings'; export class TeamService extends ServiceClassInternal implements ITeamService { protected name = 'team'; diff --git a/apps/meteor/server/services/user/lib/getNewUserRoles.ts b/apps/meteor/server/services/user/lib/getNewUserRoles.ts index b0a14e1f34c62..39117acfd4ea2 100644 --- a/apps/meteor/server/services/user/lib/getNewUserRoles.ts +++ b/apps/meteor/server/services/user/lib/getNewUserRoles.ts @@ -1,7 +1,7 @@ import type { IRole } from '@rocket.chat/core-typings'; -import { settings } from '../../../../app/settings/server'; import { parseCSV } from '../../../../lib/utils/parseCSV'; +import { settings } from '../../../settings'; export function getNewUserRoles(previousRoles?: IRole['_id'][]): IRole['_id'][] { const currentRoles = previousRoles ?? []; diff --git a/apps/meteor/server/services/video-conference/service.ts b/apps/meteor/server/services/video-conference/service.ts index 9e64bc0dc1657..cefeb16eed4cd 100644 --- a/apps/meteor/server/services/video-conference/service.ts +++ b/apps/meteor/server/services/video-conference/service.ts @@ -40,10 +40,6 @@ import type * as UiKit from '@rocket.chat/ui-kit'; import { Meteor } from 'meteor/meteor'; import { MongoInternals } from 'meteor/mongo'; -import { notifyOnMessageChange } from '../../../app/lib/server/lib/notifyListener'; -import { settings } from '../../../app/settings/server'; -import { getUserAvatarURL } from '../../../app/utils/server/getUserAvatarURL'; -import { getUserPreference } from '../../../app/utils/server/lib/getUserPreference'; import { availabilityErrors } from '../../../lib/videoConference/constants'; import { readSecondaryPreferred } from '../../database/readSecondaryPreferred'; import { canAccessRoomIdAsync } from '../../lib/authorization/canAccessRoom'; @@ -55,11 +51,15 @@ import { sendMessage } from '../../lib/messages/sendMessage'; import { metrics } from '../../lib/metrics/lib/metrics'; import { Push } from '../../lib/notifications/push/push'; import PushNotification from '../../lib/notifications/push-config/lib/PushNotification'; +import { notifyOnMessageChange } from '../../lib/notifyListener'; import { createRoom } from '../../lib/rooms/createRoom'; import { roomCoordinator } from '../../lib/rooms/roomCoordinator'; import { updateCounter } from '../../lib/statistics/functions/updateStatsCounter'; +import { getUserAvatarURL } from '../../lib/utils/getUserAvatarURL'; +import { getUserPreference } from '../../lib/utils/lib/getUserPreference'; import { videoConfProviders } from '../../lib/videoConfProviders'; import { videoConfTypes } from '../../lib/videoConfTypes'; +import { settings } from '../../settings'; const { db } = MongoInternals.defaultRemoteCollectionDriver().mongo; diff --git a/apps/meteor/app/settings/server/CachedSettings.ts b/apps/meteor/server/settings/CachedSettings.ts similarity index 99% rename from apps/meteor/app/settings/server/CachedSettings.ts rename to apps/meteor/server/settings/CachedSettings.ts index 9a0c119182175..a1644f42ee489 100644 --- a/apps/meteor/app/settings/server/CachedSettings.ts +++ b/apps/meteor/server/settings/CachedSettings.ts @@ -2,7 +2,7 @@ import type { ISetting, SettingValue } from '@rocket.chat/core-typings'; import { Emitter } from '@rocket.chat/emitter'; import _ from 'underscore'; -import { SystemLogger } from '../../../server/lib/logger/system'; +import { SystemLogger } from '../lib/logger/system'; const warn = process.env.NODE_ENV === 'development' || process.env.TEST_MODE; diff --git a/apps/meteor/app/settings/server/Middleware.ts b/apps/meteor/server/settings/Middleware.ts similarity index 100% rename from apps/meteor/app/settings/server/Middleware.ts rename to apps/meteor/server/settings/Middleware.ts diff --git a/apps/meteor/app/lib/README.md b/apps/meteor/server/settings/README.md similarity index 100% rename from apps/meteor/app/lib/README.md rename to apps/meteor/server/settings/README.md diff --git a/apps/meteor/app/settings/server/SettingsRegistry.ts b/apps/meteor/server/settings/SettingsRegistry.ts similarity index 99% rename from apps/meteor/app/settings/server/SettingsRegistry.ts rename to apps/meteor/server/settings/SettingsRegistry.ts index 18c0906774fd0..15aeb88bfa89f 100644 --- a/apps/meteor/app/settings/server/SettingsRegistry.ts +++ b/apps/meteor/server/settings/SettingsRegistry.ts @@ -9,7 +9,7 @@ import { getSettingDefaults } from './functions/getSettingDefaults'; import { overrideSetting } from './functions/overrideSetting'; import { overwriteSetting } from './functions/overwriteSetting'; import { validateSetting } from './functions/validateSetting'; -import { SystemLogger } from '../../../server/lib/logger/system'; +import { SystemLogger } from '../lib/logger/system'; const blockedSettings = new Set(); const hiddenSettings = new Set(); diff --git a/apps/meteor/server/settings/accounts.ts b/apps/meteor/server/settings/accounts.ts index f62a8ac552568..0268e8f5c9be2 100644 --- a/apps/meteor/server/settings/accounts.ts +++ b/apps/meteor/server/settings/accounts.ts @@ -1,6 +1,6 @@ import { Random } from '@rocket.chat/random'; -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createAccountSettings = () => settingsRegistry.addGroup('Accounts', async function () { diff --git a/apps/meteor/server/settings/analytics.ts b/apps/meteor/server/settings/analytics.ts index 8e635114a1f23..ac809bbb2d23b 100644 --- a/apps/meteor/server/settings/analytics.ts +++ b/apps/meteor/server/settings/analytics.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createAnalyticsSettings = () => settingsRegistry.addGroup('Analytics', async function addSettings() { diff --git a/apps/meteor/app/settings/server/applyMiddlewares.ts b/apps/meteor/server/settings/applyMiddlewares.ts similarity index 100% rename from apps/meteor/app/settings/server/applyMiddlewares.ts rename to apps/meteor/server/settings/applyMiddlewares.ts diff --git a/apps/meteor/server/settings/assets.ts b/apps/meteor/server/settings/assets.ts index 14a85582adc31..40550b1006827 100644 --- a/apps/meteor/server/settings/assets.ts +++ b/apps/meteor/server/settings/assets.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createAssetsSettings = () => settingsRegistry.addGroup('Assets', async function () { diff --git a/apps/meteor/server/settings/bots.ts b/apps/meteor/server/settings/bots.ts index a3892aad036d7..346c2de1d9935 100644 --- a/apps/meteor/server/settings/bots.ts +++ b/apps/meteor/server/settings/bots.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createBotsSettings = () => settingsRegistry.addGroup('Bots', async function () { diff --git a/apps/meteor/app/settings/server/cached.ts b/apps/meteor/server/settings/cached.ts similarity index 100% rename from apps/meteor/app/settings/server/cached.ts rename to apps/meteor/server/settings/cached.ts diff --git a/apps/meteor/server/settings/cas.ts b/apps/meteor/server/settings/cas.ts index f8ae4e6ca65a1..c0d402a017146 100644 --- a/apps/meteor/server/settings/cas.ts +++ b/apps/meteor/server/settings/cas.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createCasSettings = () => settingsRegistry.addGroup('CAS', async function () { diff --git a/apps/meteor/app/lib/server/lib/checkSettingValueBonds.ts b/apps/meteor/server/settings/checkSettingValueBonds.ts similarity index 100% rename from apps/meteor/app/lib/server/lib/checkSettingValueBonds.ts rename to apps/meteor/server/settings/checkSettingValueBonds.ts diff --git a/apps/meteor/server/settings/crowd.ts b/apps/meteor/server/settings/crowd.ts index b1a2bd821ced7..21221c1c73020 100644 --- a/apps/meteor/server/settings/crowd.ts +++ b/apps/meteor/server/settings/crowd.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const crowdIntervalValuesToCronMap: Record = { every_10_minutes: '*/10 * * * *', diff --git a/apps/meteor/server/settings/custom-emoji.ts b/apps/meteor/server/settings/custom-emoji.ts index b60efbc839357..ebd896b988120 100644 --- a/apps/meteor/server/settings/custom-emoji.ts +++ b/apps/meteor/server/settings/custom-emoji.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createEmojiSettings = () => settingsRegistry.addGroup('EmojiCustomFilesystem', async function () { diff --git a/apps/meteor/server/settings/custom-sounds.ts b/apps/meteor/server/settings/custom-sounds.ts index 7a772d406dabc..87112b10ce671 100644 --- a/apps/meteor/server/settings/custom-sounds.ts +++ b/apps/meteor/server/settings/custom-sounds.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createSoundsSettings = () => settingsRegistry.addGroup('CustomSoundsFilesystem', async function () { diff --git a/apps/meteor/server/settings/definitions.ts b/apps/meteor/server/settings/definitions.ts new file mode 100644 index 0000000000000..83d341552e634 --- /dev/null +++ b/apps/meteor/server/settings/definitions.ts @@ -0,0 +1,81 @@ +import { createAccountSettings } from './accounts'; +import { createAnalyticsSettings } from './analytics'; +import { createAssetsSettings } from './assets'; +import { createBotsSettings } from './bots'; +import { createCasSettings } from './cas'; +import { createCrowdSettings } from './crowd'; +import { createEmojiSettings } from './custom-emoji'; +import { createSoundsSettings } from './custom-sounds'; +import { createDiscussionsSettings } from './discussions'; +import { createE2ESettings } from './e2e'; +import { createEmailSettings } from './email'; +import { createFederationSettings } from './federation'; +import { createFederationServiceSettings } from './federation-service'; +import { createFileUploadSettings } from './file-upload'; +import { createGeneralSettings } from './general'; +import { createIRCSettings } from './irc'; +import { createLayoutSettings } from './layout'; +import { createLdapSettings } from './ldap'; +import { createLogSettings } from './logs'; +import { createMessageSettings } from './message'; +import { createMetaSettings } from './meta'; +import { createMiscSettings } from './misc'; +import { createMobileSettings } from './mobile'; +import { createOauthSettings } from './oauth'; +import { createOmniSettings } from './omnichannel'; +import { createPushSettings } from './push'; +import { createRateLimitSettings } from './rate'; +import { createRetentionSettings } from './retention-policy'; +import { createSetupWSettings } from './setup-wizard'; +import { createSlackBridgeSettings } from './slackbridge'; +import { createSmarshSettings } from './smarsh'; +import { createThreadSettings } from './threads'; +import { createTroubleshootSettings } from './troubleshoot'; +import { createUserDataSettings } from './userDataDownload'; +import { createVConfSettings } from './video-conference'; +import { createWebDavSettings } from './webdav'; +import { addMatrixBridgeFederationSettings } from '../services/federation/Settings'; + +await Promise.all([ + createFederationServiceSettings(), + createAccountSettings(), + createAnalyticsSettings(), + createAssetsSettings(), + createBotsSettings(), + createCasSettings(), + createCrowdSettings(), + createEmojiSettings(), + createSoundsSettings(), + createDiscussionsSettings(), + createEmailSettings(), + createE2ESettings(), + createFileUploadSettings(), + createGeneralSettings(), + createIRCSettings(), + createLdapSettings(), + createLogSettings(), + createLayoutSettings(), + createMessageSettings(), + createMetaSettings(), + createMiscSettings(), + createMobileSettings(), + createOauthSettings(), + createOmniSettings(), + createPushSettings(), + createRateLimitSettings(), + createRetentionSettings(), + createSetupWSettings(), + createSlackBridgeSettings(), + createSmarshSettings(), + createThreadSettings(), + createTroubleshootSettings(), + createVConfSettings(), + createUserDataSettings(), + createWebDavSettings(), +]); + +// Run after all the other settings are created since it depends on some of them +await Promise.all([ + createFederationSettings(), // Deprecated and not used anymore. Kept for admin UI information purposes. Remove on 8.0 + addMatrixBridgeFederationSettings(), // Deprecated and not used anymore. Kept for admin UI information purposes. Remove on 8.0 +]); diff --git a/apps/meteor/server/settings/discussions.ts b/apps/meteor/server/settings/discussions.ts index afd5024a4c8ff..320da79e538f8 100644 --- a/apps/meteor/server/settings/discussions.ts +++ b/apps/meteor/server/settings/discussions.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createDiscussionsSettings = () => settingsRegistry.addGroup('Discussion', async function () { diff --git a/apps/meteor/server/settings/e2e.ts b/apps/meteor/server/settings/e2e.ts index b94bfc38d8c66..26441a2b1656b 100644 --- a/apps/meteor/server/settings/e2e.ts +++ b/apps/meteor/server/settings/e2e.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createE2ESettings = () => settingsRegistry.addGroup('End-to-end_encryption', async function () { diff --git a/apps/meteor/server/settings/email.ts b/apps/meteor/server/settings/email.ts index fdfd43c7557a4..c509404521ec8 100644 --- a/apps/meteor/server/settings/email.ts +++ b/apps/meteor/server/settings/email.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createEmailSettings = () => settingsRegistry.addGroup('Email', async function () { diff --git a/apps/meteor/server/settings/federation-service.ts b/apps/meteor/server/settings/federation-service.ts index 94e773c1c6e64..5a250b65484aa 100644 --- a/apps/meteor/server/settings/federation-service.ts +++ b/apps/meteor/server/settings/federation-service.ts @@ -1,6 +1,6 @@ import { generateEd25519RandomSecretKey } from '@rocket.chat/federation-matrix'; -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createFederationServiceSettings = async (): Promise => { await settingsRegistry.addGroup('Federation', async function () { diff --git a/apps/meteor/server/settings/federation.ts b/apps/meteor/server/settings/federation.ts index aa440b78fb6ef..354024d900fa7 100644 --- a/apps/meteor/server/settings/federation.ts +++ b/apps/meteor/server/settings/federation.ts @@ -1,6 +1,6 @@ import { FederationKeys } from '@rocket.chat/models'; -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createFederationSettings = () => settingsRegistry.addGroup('Federation', async function () { diff --git a/apps/meteor/server/settings/file-upload.ts b/apps/meteor/server/settings/file-upload.ts index a2cac6080d3fb..2f6f6ad37b42f 100644 --- a/apps/meteor/server/settings/file-upload.ts +++ b/apps/meteor/server/settings/file-upload.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createFileUploadSettings = () => settingsRegistry.addGroup('FileUpload', async function () { diff --git a/apps/meteor/app/settings/server/functions/convertValue.ts b/apps/meteor/server/settings/functions/convertValue.ts similarity index 100% rename from apps/meteor/app/settings/server/functions/convertValue.ts rename to apps/meteor/server/settings/functions/convertValue.ts diff --git a/apps/meteor/app/settings/server/functions/getSettingDefaults.ts b/apps/meteor/server/settings/functions/getSettingDefaults.ts similarity index 100% rename from apps/meteor/app/settings/server/functions/getSettingDefaults.ts rename to apps/meteor/server/settings/functions/getSettingDefaults.ts diff --git a/apps/meteor/app/settings/server/functions/overrideGenerator.ts b/apps/meteor/server/settings/functions/overrideGenerator.ts similarity index 100% rename from apps/meteor/app/settings/server/functions/overrideGenerator.ts rename to apps/meteor/server/settings/functions/overrideGenerator.ts diff --git a/apps/meteor/app/settings/server/functions/overrideSetting.ts b/apps/meteor/server/settings/functions/overrideSetting.ts similarity index 100% rename from apps/meteor/app/settings/server/functions/overrideSetting.ts rename to apps/meteor/server/settings/functions/overrideSetting.ts diff --git a/apps/meteor/app/settings/server/functions/overwriteSetting.ts b/apps/meteor/server/settings/functions/overwriteSetting.ts similarity index 100% rename from apps/meteor/app/settings/server/functions/overwriteSetting.ts rename to apps/meteor/server/settings/functions/overwriteSetting.ts diff --git a/apps/meteor/app/settings/server/functions/settings.mocks.ts b/apps/meteor/server/settings/functions/settings.mocks.ts similarity index 100% rename from apps/meteor/app/settings/server/functions/settings.mocks.ts rename to apps/meteor/server/settings/functions/settings.mocks.ts diff --git a/apps/meteor/app/settings/server/functions/validateSetting.ts b/apps/meteor/server/settings/functions/validateSetting.ts similarity index 100% rename from apps/meteor/app/settings/server/functions/validateSetting.ts rename to apps/meteor/server/settings/functions/validateSetting.ts diff --git a/apps/meteor/server/settings/general.ts b/apps/meteor/server/settings/general.ts index 2cda26f11a147..8dfa4eb436f37 100644 --- a/apps/meteor/server/settings/general.ts +++ b/apps/meteor/server/settings/general.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createGeneralSettings = async () => { await settingsRegistry.addGroup('General', async function () { diff --git a/apps/meteor/server/settings/index.ts b/apps/meteor/server/settings/index.ts index 83d341552e634..30a8c9fd6ba27 100644 --- a/apps/meteor/server/settings/index.ts +++ b/apps/meteor/server/settings/index.ts @@ -1,81 +1,24 @@ -import { createAccountSettings } from './accounts'; -import { createAnalyticsSettings } from './analytics'; -import { createAssetsSettings } from './assets'; -import { createBotsSettings } from './bots'; -import { createCasSettings } from './cas'; -import { createCrowdSettings } from './crowd'; -import { createEmojiSettings } from './custom-emoji'; -import { createSoundsSettings } from './custom-sounds'; -import { createDiscussionsSettings } from './discussions'; -import { createE2ESettings } from './e2e'; -import { createEmailSettings } from './email'; -import { createFederationSettings } from './federation'; -import { createFederationServiceSettings } from './federation-service'; -import { createFileUploadSettings } from './file-upload'; -import { createGeneralSettings } from './general'; -import { createIRCSettings } from './irc'; -import { createLayoutSettings } from './layout'; -import { createLdapSettings } from './ldap'; -import { createLogSettings } from './logs'; -import { createMessageSettings } from './message'; -import { createMetaSettings } from './meta'; -import { createMiscSettings } from './misc'; -import { createMobileSettings } from './mobile'; -import { createOauthSettings } from './oauth'; -import { createOmniSettings } from './omnichannel'; -import { createPushSettings } from './push'; -import { createRateLimitSettings } from './rate'; -import { createRetentionSettings } from './retention-policy'; -import { createSetupWSettings } from './setup-wizard'; -import { createSlackBridgeSettings } from './slackbridge'; -import { createSmarshSettings } from './smarsh'; -import { createThreadSettings } from './threads'; -import { createTroubleshootSettings } from './troubleshoot'; -import { createUserDataSettings } from './userDataDownload'; -import { createVConfSettings } from './video-conference'; -import { createWebDavSettings } from './webdav'; -import { addMatrixBridgeFederationSettings } from '../services/federation/Settings'; +/* eslint-disable react-hooks/rules-of-hooks */ +import { Settings } from '@rocket.chat/models'; -await Promise.all([ - createFederationServiceSettings(), - createAccountSettings(), - createAnalyticsSettings(), - createAssetsSettings(), - createBotsSettings(), - createCasSettings(), - createCrowdSettings(), - createEmojiSettings(), - createSoundsSettings(), - createDiscussionsSettings(), - createEmailSettings(), - createE2ESettings(), - createFileUploadSettings(), - createGeneralSettings(), - createIRCSettings(), - createLdapSettings(), - createLogSettings(), - createLayoutSettings(), - createMessageSettings(), - createMetaSettings(), - createMiscSettings(), - createMobileSettings(), - createOauthSettings(), - createOmniSettings(), - createPushSettings(), - createRateLimitSettings(), - createRetentionSettings(), - createSetupWSettings(), - createSlackBridgeSettings(), - createSmarshSettings(), - createThreadSettings(), - createTroubleshootSettings(), - createVConfSettings(), - createUserDataSettings(), - createWebDavSettings(), -]); +import { use } from './Middleware'; +import { SettingsRegistry } from './SettingsRegistry'; +import { settings } from './cached'; +import { initializeSettings } from './startup'; +import './applyMiddlewares'; -// Run after all the other settings are created since it depends on some of them -await Promise.all([ - createFederationSettings(), // Deprecated and not used anymore. Kept for admin UI information purposes. Remove on 8.0 - addMatrixBridgeFederationSettings(), // Deprecated and not used anymore. Kept for admin UI information purposes. Remove on 8.0 -]); +export { SettingsEvents } from './SettingsRegistry'; + +export { settings }; + +export const settingsRegistry = new SettingsRegistry({ store: settings, model: Settings }); + +settingsRegistry.add = use(settingsRegistry.add, async (context, next) => { + return next(...context) as any; +}); + +settingsRegistry.addGroup = use(settingsRegistry.addGroup, async (context, next) => { + return next(...context) as any; +}); + +await initializeSettings({ model: Settings, settings }); diff --git a/apps/meteor/server/settings/irc.ts b/apps/meteor/server/settings/irc.ts index 04dcd687f5b2f..d835a6513dd7f 100644 --- a/apps/meteor/server/settings/irc.ts +++ b/apps/meteor/server/settings/irc.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createIRCSettings = () => settingsRegistry.addGroup('IRC_Federation', async function () { diff --git a/apps/meteor/server/settings/layout.ts b/apps/meteor/server/settings/layout.ts index d869e7fcceec1..7c31ce660fae0 100644 --- a/apps/meteor/server/settings/layout.ts +++ b/apps/meteor/server/settings/layout.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createLayoutSettings = () => settingsRegistry.addGroup('Layout', async function () { diff --git a/apps/meteor/server/settings/ldap.ts b/apps/meteor/server/settings/ldap.ts index b0956310b8dfe..4df631fb2b5f1 100644 --- a/apps/meteor/server/settings/ldap.ts +++ b/apps/meteor/server/settings/ldap.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createLdapSettings = () => settingsRegistry.addGroup('LDAP', async function () { diff --git a/apps/meteor/server/settings/lib/auditedSettingUpdates.spec.ts b/apps/meteor/server/settings/lib/auditedSettingUpdates.spec.ts index f7c1d7fd9f3ec..a438a1c7fb613 100644 --- a/apps/meteor/server/settings/lib/auditedSettingUpdates.spec.ts +++ b/apps/meteor/server/settings/lib/auditedSettingUpdates.spec.ts @@ -11,7 +11,7 @@ jest.mock('@rocket.chat/models', () => ({ const mockSettings = new Map(); -jest.mock('../../../app/settings/server/cached', () => { +jest.mock('../cached', () => { const mockGetSetting = jest.fn((key: string) => mockSettings.get(key)); return { settings: { diff --git a/apps/meteor/server/settings/lib/auditedSettingUpdates.ts b/apps/meteor/server/settings/lib/auditedSettingUpdates.ts index 4b90278e6facd..4734e6a79660c 100644 --- a/apps/meteor/server/settings/lib/auditedSettingUpdates.ts +++ b/apps/meteor/server/settings/lib/auditedSettingUpdates.ts @@ -7,7 +7,7 @@ import type { } from '@rocket.chat/core-typings'; import { ServerEvents } from '@rocket.chat/models'; -import { settings } from '../../../app/settings/server/cached'; +import { settings } from '../cached'; const shouldMaskSettingInAudit = (settingId: ISetting['_id']): boolean => { const setting = settings.getSetting(settingId); diff --git a/apps/meteor/app/lib/server/functions/saveSettingsBulk.ts b/apps/meteor/server/settings/lib/saveSettingsBulk.ts similarity index 88% rename from apps/meteor/app/lib/server/functions/saveSettingsBulk.ts rename to apps/meteor/server/settings/lib/saveSettingsBulk.ts index 7f9ec197b95ab..8d57a038f27f1 100644 --- a/apps/meteor/app/lib/server/functions/saveSettingsBulk.ts +++ b/apps/meteor/server/settings/lib/saveSettingsBulk.ts @@ -4,13 +4,13 @@ import { Settings } from '@rocket.chat/models'; import { Match, check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; -import { hasPermissionAsync } from '../../../../server/lib/authorization/hasPermission'; -import { disableCustomScripts } from '../../../../server/lib/shared/disableCustomScripts'; -import { updateAuditedByUser } from '../../../../server/settings/lib/auditedSettingUpdates'; -import { getSettingPermissionId } from '../../../authorization/lib'; -import { settings } from '../../../settings/server'; -import { checkSettingValueBounds } from '../lib/checkSettingValueBonds'; -import { notifyOnSettingChangedById } from '../lib/notifyListener'; +import { settings } from '..'; +import { updateAuditedByUser } from './auditedSettingUpdates'; +import { getSettingPermissionId } from '../../../app/authorization/lib'; +import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { notifyOnSettingChangedById } from '../../lib/notifyListener'; +import { disableCustomScripts } from '../../lib/shared/disableCustomScripts'; +import { checkSettingValueBounds } from '../checkSettingValueBonds'; const validJSON = Match.Where((value: string) => { try { diff --git a/apps/meteor/server/settings/logs.ts b/apps/meteor/server/settings/logs.ts index cc7e20d813786..ad5557ad0cb2c 100644 --- a/apps/meteor/server/settings/logs.ts +++ b/apps/meteor/server/settings/logs.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createLogSettings = () => settingsRegistry.addGroup('Logs', async function () { diff --git a/apps/meteor/server/settings/message.ts b/apps/meteor/server/settings/message.ts index 3aeebb5de32a8..924351223931a 100644 --- a/apps/meteor/server/settings/message.ts +++ b/apps/meteor/server/settings/message.ts @@ -1,5 +1,5 @@ +import { settingsRegistry } from '.'; import { MessageTypesValues } from '../../app/lib/lib/MessageTypes'; -import { settingsRegistry } from '../../app/settings/server'; export const createMessageSettings = () => settingsRegistry.addGroup('Message', async function () { diff --git a/apps/meteor/server/settings/meta.ts b/apps/meteor/server/settings/meta.ts index fadb9ca2b54d6..cb0abcff82c0a 100644 --- a/apps/meteor/server/settings/meta.ts +++ b/apps/meteor/server/settings/meta.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createMetaSettings = () => settingsRegistry.addGroup('Meta', async function () { diff --git a/apps/meteor/server/settings/misc.ts b/apps/meteor/server/settings/misc.ts index 053dd53f8b832..d74267e573fbc 100644 --- a/apps/meteor/server/settings/misc.ts +++ b/apps/meteor/server/settings/misc.ts @@ -3,9 +3,9 @@ import crypto from 'node:crypto'; import { Logger } from '@rocket.chat/logger'; import { Settings } from '@rocket.chat/models'; +import { settingsRegistry, settings } from '.'; import { updateAuditedBySystem } from './lib/auditedSettingUpdates'; -import { notifyOnSettingChangedById } from '../../app/lib/server/lib/notifyListener'; -import { settingsRegistry, settings } from '../../app/settings/server'; +import { notifyOnSettingChangedById } from '../lib/notifyListener'; const logger = new Logger('FingerPrint'); diff --git a/apps/meteor/server/settings/mobile.ts b/apps/meteor/server/settings/mobile.ts index e6146390e9558..e23ac11524b85 100644 --- a/apps/meteor/server/settings/mobile.ts +++ b/apps/meteor/server/settings/mobile.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createMobileSettings = () => settingsRegistry.addGroup('Mobile', async function () { diff --git a/apps/meteor/server/settings/oauth.ts b/apps/meteor/server/settings/oauth.ts index 24b9a95579c60..54cfdc7c97a22 100644 --- a/apps/meteor/server/settings/oauth.ts +++ b/apps/meteor/server/settings/oauth.ts @@ -1,6 +1,6 @@ import { Random } from '@rocket.chat/random'; -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createOauthSettings = () => settingsRegistry.addGroup('OAuth', async function () { diff --git a/apps/meteor/server/settings/omnichannel.ts b/apps/meteor/server/settings/omnichannel.ts index 1fba2b6801883..c765edcba910b 100644 --- a/apps/meteor/server/settings/omnichannel.ts +++ b/apps/meteor/server/settings/omnichannel.ts @@ -1,6 +1,6 @@ import { SettingEditor } from '@rocket.chat/core-typings'; -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; const omnichannelEnabledQuery = { _id: 'Livechat_enabled', value: true }; diff --git a/apps/meteor/server/settings/push.ts b/apps/meteor/server/settings/push.ts index 714641721bc42..1be1afe8863fc 100644 --- a/apps/meteor/server/settings/push.ts +++ b/apps/meteor/server/settings/push.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; const pushEnabledWithoutGateway = [ { diff --git a/apps/meteor/server/settings/rate.ts b/apps/meteor/server/settings/rate.ts index b30799846f005..e045fc92d7614 100644 --- a/apps/meteor/server/settings/rate.ts +++ b/apps/meteor/server/settings/rate.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createRateLimitSettings = () => settingsRegistry.addGroup('Rate Limiter', async function () { diff --git a/apps/meteor/app/settings/server/raw.ts b/apps/meteor/server/settings/raw.ts similarity index 100% rename from apps/meteor/app/settings/server/raw.ts rename to apps/meteor/server/settings/raw.ts diff --git a/apps/meteor/server/settings/retention-policy.ts b/apps/meteor/server/settings/retention-policy.ts index 5e620e9a8e497..17cbf56867f96 100644 --- a/apps/meteor/server/settings/retention-policy.ts +++ b/apps/meteor/server/settings/retention-policy.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; const THIRTY_DAYS = 2592000000; diff --git a/apps/meteor/server/settings/setup-wizard.ts b/apps/meteor/server/settings/setup-wizard.ts index a63b4cfe49c66..b46150d21cb76 100644 --- a/apps/meteor/server/settings/setup-wizard.ts +++ b/apps/meteor/server/settings/setup-wizard.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createSetupWSettings = () => settingsRegistry.addGroup('Setup_Wizard', async function () { diff --git a/apps/meteor/server/settings/slackbridge.ts b/apps/meteor/server/settings/slackbridge.ts index bf3b8c090c9a1..507b9f5eacfd1 100644 --- a/apps/meteor/server/settings/slackbridge.ts +++ b/apps/meteor/server/settings/slackbridge.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createSlackBridgeSettings = () => settingsRegistry.addGroup('SlackBridge', async function () { diff --git a/apps/meteor/server/settings/smarsh.ts b/apps/meteor/server/settings/smarsh.ts index 3e52b92edc79c..b3cb98a465d72 100644 --- a/apps/meteor/server/settings/smarsh.ts +++ b/apps/meteor/server/settings/smarsh.ts @@ -1,6 +1,6 @@ import moment from 'moment-timezone'; -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const smarshIntervalValuesToCronMap: Record = { every_30_seconds: '*/30 * * * * *', diff --git a/apps/meteor/app/settings/server/startup.ts b/apps/meteor/server/settings/startup.ts similarity index 100% rename from apps/meteor/app/settings/server/startup.ts rename to apps/meteor/server/settings/startup.ts diff --git a/apps/meteor/app/theme/server/index.ts b/apps/meteor/server/settings/theme/index.ts similarity index 100% rename from apps/meteor/app/theme/server/index.ts rename to apps/meteor/server/settings/theme/index.ts diff --git a/apps/meteor/app/theme/server/server.ts b/apps/meteor/server/settings/theme/server.ts similarity index 91% rename from apps/meteor/app/theme/server/server.ts rename to apps/meteor/server/settings/theme/server.ts index 34b71e38a303d..d6aef6fd331ff 100644 --- a/apps/meteor/app/theme/server/server.ts +++ b/apps/meteor/server/settings/theme/server.ts @@ -4,8 +4,8 @@ import { Settings } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; import { WebApp } from 'meteor/webapp'; -import { settings } from '../../settings/server'; -import { addStyle } from '../../ui-master/server/inject'; +import { settings } from '..'; +import { addStyle } from '../../lib/ui-master/inject'; settings.watch('theme-custom-css', (value) => { if (!value || typeof value !== 'string') { diff --git a/apps/meteor/server/settings/threads.ts b/apps/meteor/server/settings/threads.ts index b9612d2925e8f..5855b64ec1ef3 100644 --- a/apps/meteor/server/settings/threads.ts +++ b/apps/meteor/server/settings/threads.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createThreadSettings = () => settingsRegistry.addGroup('Threads', async function () { diff --git a/apps/meteor/server/settings/troubleshoot.ts b/apps/meteor/server/settings/troubleshoot.ts index 7919970af9ccf..c86097855c31f 100644 --- a/apps/meteor/server/settings/troubleshoot.ts +++ b/apps/meteor/server/settings/troubleshoot.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createTroubleshootSettings = () => settingsRegistry.addGroup('Troubleshoot', async function () { diff --git a/apps/meteor/server/settings/userDataDownload.ts b/apps/meteor/server/settings/userDataDownload.ts index 1d078cb012c3f..2f7b7ef98ad8c 100644 --- a/apps/meteor/server/settings/userDataDownload.ts +++ b/apps/meteor/server/settings/userDataDownload.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createUserDataSettings = () => settingsRegistry.addGroup('UserDataDownload', async function () { diff --git a/apps/meteor/server/settings/video-conference.ts b/apps/meteor/server/settings/video-conference.ts index 9abee80d5c87e..097472c8d42b4 100644 --- a/apps/meteor/server/settings/video-conference.ts +++ b/apps/meteor/server/settings/video-conference.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createVConfSettings = () => settingsRegistry.addGroup('Video_Conference', async function () { diff --git a/apps/meteor/server/settings/webdav.ts b/apps/meteor/server/settings/webdav.ts index 85ffe0119f212..ee59637884c3a 100644 --- a/apps/meteor/server/settings/webdav.ts +++ b/apps/meteor/server/settings/webdav.ts @@ -1,4 +1,4 @@ -import { settingsRegistry } from '../../app/settings/server'; +import { settingsRegistry } from '.'; export const createWebDavSettings = () => settingsRegistry.addGroup('Webdav Integration', async function () { diff --git a/apps/meteor/server/slashcommands/archiveroom/server.ts b/apps/meteor/server/slashcommands/archiveroom/server.ts index ed5ff7058f6d3..f1f590da8dcf7 100644 --- a/apps/meteor/server/slashcommands/archiveroom/server.ts +++ b/apps/meteor/server/slashcommands/archiveroom/server.ts @@ -4,13 +4,13 @@ import { isRegisterUser } from '@rocket.chat/core-typings'; import { Users, Rooms } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../app/settings/server'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; import { RoomMemberActions } from '../../../definition/IRoomTypeConfig'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { i18n } from '../../lib/i18n'; import { archiveRoom } from '../../lib/rooms/archiveRoom'; import { roomCoordinator } from '../../lib/rooms/roomCoordinator'; +import { slashCommands } from '../../lib/utils/slashCommand'; +import { settings } from '../../settings'; slashCommands.add({ command: 'archive', diff --git a/apps/meteor/server/slashcommands/asciiarts/gimme.ts b/apps/meteor/server/slashcommands/asciiarts/gimme.ts index 6264d534be16a..557386d2df5e0 100644 --- a/apps/meteor/server/slashcommands/asciiarts/gimme.ts +++ b/apps/meteor/server/slashcommands/asciiarts/gimme.ts @@ -1,6 +1,6 @@ import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; +import { slashCommands } from '../../lib/utils/slashCommand'; import { executeSendMessage } from '../../meteor-methods/messages/sendMessage'; /* * Gimme is a named function that will replace /gimme commands diff --git a/apps/meteor/server/slashcommands/asciiarts/lenny.ts b/apps/meteor/server/slashcommands/asciiarts/lenny.ts index 7738ae9a74ca1..a0b5169ba7a80 100644 --- a/apps/meteor/server/slashcommands/asciiarts/lenny.ts +++ b/apps/meteor/server/slashcommands/asciiarts/lenny.ts @@ -1,6 +1,6 @@ import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; +import { slashCommands } from '../../lib/utils/slashCommand'; import { executeSendMessage } from '../../meteor-methods/messages/sendMessage'; /* * Lenny is a named function that will replace /lenny commands diff --git a/apps/meteor/server/slashcommands/asciiarts/shrug.ts b/apps/meteor/server/slashcommands/asciiarts/shrug.ts index fe58c1df5aa1a..875738d954218 100644 --- a/apps/meteor/server/slashcommands/asciiarts/shrug.ts +++ b/apps/meteor/server/slashcommands/asciiarts/shrug.ts @@ -1,6 +1,6 @@ import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; +import { slashCommands } from '../../lib/utils/slashCommand'; import { executeSendMessage } from '../../meteor-methods/messages/sendMessage'; /* * Shrug is a named function that will replace /shrug commands diff --git a/apps/meteor/server/slashcommands/asciiarts/tableflip.ts b/apps/meteor/server/slashcommands/asciiarts/tableflip.ts index 3b58e3606c101..f63f642813077 100644 --- a/apps/meteor/server/slashcommands/asciiarts/tableflip.ts +++ b/apps/meteor/server/slashcommands/asciiarts/tableflip.ts @@ -1,6 +1,6 @@ import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; +import { slashCommands } from '../../lib/utils/slashCommand'; import { executeSendMessage } from '../../meteor-methods/messages/sendMessage'; /* * Tableflip is a named function that will replace /Tableflip commands diff --git a/apps/meteor/server/slashcommands/asciiarts/unflip.ts b/apps/meteor/server/slashcommands/asciiarts/unflip.ts index f449739eb5ea7..428bfd61fdb7d 100644 --- a/apps/meteor/server/slashcommands/asciiarts/unflip.ts +++ b/apps/meteor/server/slashcommands/asciiarts/unflip.ts @@ -1,6 +1,6 @@ import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; +import { slashCommands } from '../../lib/utils/slashCommand'; import { executeSendMessage } from '../../meteor-methods/messages/sendMessage'; /* * Unflip is a named function that will replace /unflip commands diff --git a/apps/meteor/server/slashcommands/ban/ban.ts b/apps/meteor/server/slashcommands/ban/ban.ts index 260ceaba7207d..00565def4779b 100644 --- a/apps/meteor/server/slashcommands/ban/ban.ts +++ b/apps/meteor/server/slashcommands/ban/ban.ts @@ -2,11 +2,11 @@ import { api } from '@rocket.chat/core-services'; import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; -import { settings } from '../../../app/settings/server'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; import { banUserFromRoomMethod } from '../../lib/banUserFromRoom'; import { i18n } from '../../lib/i18n'; +import { slashCommands } from '../../lib/utils/slashCommand'; import { sanitizeUsername } from '../../meteor-methods/rooms/addUsersToRoom'; +import { settings } from '../../settings'; slashCommands.add({ command: 'ban', diff --git a/apps/meteor/server/slashcommands/ban/unban.ts b/apps/meteor/server/slashcommands/ban/unban.ts index f03042fb6965a..750e4aba19d9e 100644 --- a/apps/meteor/server/slashcommands/ban/unban.ts +++ b/apps/meteor/server/slashcommands/ban/unban.ts @@ -2,11 +2,11 @@ import { api } from '@rocket.chat/core-services'; import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; -import { settings } from '../../../app/settings/server'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; import { i18n } from '../../lib/i18n'; import { unbanUserFromRoom } from '../../lib/unbanUserFromRoom'; +import { slashCommands } from '../../lib/utils/slashCommand'; import { sanitizeUsername } from '../../meteor-methods/rooms/addUsersToRoom'; +import { settings } from '../../settings'; slashCommands.add({ command: 'unban', diff --git a/apps/meteor/server/slashcommands/create/server.ts b/apps/meteor/server/slashcommands/create/server.ts index 90f4e7811e1f8..ed15f08fd816a 100644 --- a/apps/meteor/server/slashcommands/create/server.ts +++ b/apps/meteor/server/slashcommands/create/server.ts @@ -2,11 +2,11 @@ import { api } from '@rocket.chat/core-services'; import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; import { Rooms, Users } from '@rocket.chat/models'; -import { settings } from '../../../app/settings/server'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; import { i18n } from '../../lib/i18n'; +import { slashCommands } from '../../lib/utils/slashCommand'; import { createChannelMethod } from '../../meteor-methods/rooms/createChannel'; import { createPrivateGroupMethod } from '../../meteor-methods/rooms/createPrivateGroup'; +import { settings } from '../../settings'; slashCommands.add({ command: 'create', diff --git a/apps/meteor/server/slashcommands/help/server.ts b/apps/meteor/server/slashcommands/help/server.ts index 28bffbcfa8509..7998b167bc73d 100644 --- a/apps/meteor/server/slashcommands/help/server.ts +++ b/apps/meteor/server/slashcommands/help/server.ts @@ -2,9 +2,9 @@ import { api } from '@rocket.chat/core-services'; import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; -import { settings } from '../../../app/settings/server'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; import { i18n } from '../../lib/i18n'; +import { slashCommands } from '../../lib/utils/slashCommand'; +import { settings } from '../../settings'; /* * Help is a named function that will replace /help commands diff --git a/apps/meteor/server/slashcommands/hide/hide.ts b/apps/meteor/server/slashcommands/hide/hide.ts index 2211ae4e11f20..c841e00beeed3 100644 --- a/apps/meteor/server/slashcommands/hide/hide.ts +++ b/apps/meteor/server/slashcommands/hide/hide.ts @@ -2,10 +2,10 @@ import { api } from '@rocket.chat/core-services'; import type { IRoom, SlashCommandCallbackParams } from '@rocket.chat/core-typings'; import { Rooms, Subscriptions, Users } from '@rocket.chat/models'; -import { settings } from '../../../app/settings/server'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; import { i18n } from '../../lib/i18n'; +import { slashCommands } from '../../lib/utils/slashCommand'; import { hideRoomMethod } from '../../meteor-methods/rooms/hideRoom'; +import { settings } from '../../settings'; /* * Hide is a named function that will replace /hide commands diff --git a/apps/meteor/server/slashcommands/invite/server.ts b/apps/meteor/server/slashcommands/invite/server.ts index 82dbe8d18c3df..91c4faa9c8da7 100644 --- a/apps/meteor/server/slashcommands/invite/server.ts +++ b/apps/meteor/server/slashcommands/invite/server.ts @@ -5,11 +5,11 @@ import { validateFederatedUsername } from '@rocket.chat/federation-matrix'; import { Subscriptions, Users, Rooms } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../app/settings/server'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; import { i18n } from '../../lib/i18n'; +import { slashCommands } from '../../lib/utils/slashCommand'; import { addUsersToRoomMethod, sanitizeUsername } from '../../meteor-methods/rooms/addUsersToRoom'; import { FederationActions } from '../../services/room/hooks/BeforeFederationActions'; +import { settings } from '../../settings'; // Type guards for the error function isStringError(error: unknown): error is { error: string } { diff --git a/apps/meteor/server/slashcommands/inviteall/server.ts b/apps/meteor/server/slashcommands/inviteall/server.ts index 5f4c135dc45f1..5802c1c4575ff 100644 --- a/apps/meteor/server/slashcommands/inviteall/server.ts +++ b/apps/meteor/server/slashcommands/inviteall/server.ts @@ -9,13 +9,13 @@ import { Rooms, Subscriptions, Users } from '@rocket.chat/models'; import { isTruthy } from '@rocket.chat/tools'; import { Meteor } from 'meteor/meteor'; -import { canAccessRoomAsync } from '../../../app/authorization/server'; -import { settings } from '../../../app/settings/server'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; +import { canAccessRoomAsync } from '../../lib/authorization'; import { i18n } from '../../lib/i18n'; +import { slashCommands } from '../../lib/utils/slashCommand'; import { addUsersToRoomMethod } from '../../meteor-methods/rooms/addUsersToRoom'; import { createChannelMethod } from '../../meteor-methods/rooms/createChannel'; import { createPrivateGroupMethod } from '../../meteor-methods/rooms/createPrivateGroup'; +import { settings } from '../../settings'; function inviteAll(type: T): SlashCommand['callback'] { return async function inviteAll({ command, params, message, userId }: SlashCommandCallbackParams): Promise { diff --git a/apps/meteor/server/slashcommands/join/server.ts b/apps/meteor/server/slashcommands/join/server.ts index b9d74b21c7913..782a15a763c1e 100644 --- a/apps/meteor/server/slashcommands/join/server.ts +++ b/apps/meteor/server/slashcommands/join/server.ts @@ -3,9 +3,9 @@ import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; import { Rooms, Subscriptions, Users } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../app/settings/server'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; import { i18n } from '../../lib/i18n'; +import { slashCommands } from '../../lib/utils/slashCommand'; +import { settings } from '../../settings'; slashCommands.add({ command: 'join', diff --git a/apps/meteor/server/slashcommands/kick/server.ts b/apps/meteor/server/slashcommands/kick/server.ts index d2e3ca568dc3e..48478cfcd72e9 100644 --- a/apps/meteor/server/slashcommands/kick/server.ts +++ b/apps/meteor/server/slashcommands/kick/server.ts @@ -3,11 +3,11 @@ import { api } from '@rocket.chat/core-services'; import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; -import { settings } from '../../../app/settings/server'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; import { i18n } from '../../lib/i18n'; +import { slashCommands } from '../../lib/utils/slashCommand'; import { sanitizeUsername } from '../../meteor-methods/rooms/addUsersToRoom'; import { removeUserFromRoomMethod } from '../../meteor-methods/rooms/removeUserFromRoom'; +import { settings } from '../../settings'; slashCommands.add({ command: 'kick', diff --git a/apps/meteor/server/slashcommands/leave/leave.ts b/apps/meteor/server/slashcommands/leave/leave.ts index 4131b2fb36af9..3c3280f465e0f 100644 --- a/apps/meteor/server/slashcommands/leave/leave.ts +++ b/apps/meteor/server/slashcommands/leave/leave.ts @@ -3,10 +3,10 @@ import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../app/settings/server'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; import { i18n } from '../../lib/i18n'; +import { slashCommands } from '../../lib/utils/slashCommand'; import { leaveRoomMethod } from '../../meteor-methods/rooms/leaveRoom'; +import { settings } from '../../settings'; /* * Leave is a named function that will replace /leave commands diff --git a/apps/meteor/server/slashcommands/me/me.ts b/apps/meteor/server/slashcommands/me/me.ts index ed8102cd19762..3fbe36ec3cc1b 100644 --- a/apps/meteor/server/slashcommands/me/me.ts +++ b/apps/meteor/server/slashcommands/me/me.ts @@ -1,6 +1,6 @@ import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; +import { slashCommands } from '../../lib/utils/slashCommand'; import { executeSendMessage } from '../../meteor-methods/messages/sendMessage'; /* diff --git a/apps/meteor/server/slashcommands/msg/server.ts b/apps/meteor/server/slashcommands/msg/server.ts index 6266649c8887d..fa837305c0d92 100644 --- a/apps/meteor/server/slashcommands/msg/server.ts +++ b/apps/meteor/server/slashcommands/msg/server.ts @@ -3,11 +3,11 @@ import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; import { Random } from '@rocket.chat/random'; -import { settings } from '../../../app/settings/server'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; import { i18n } from '../../lib/i18n'; +import { slashCommands } from '../../lib/utils/slashCommand'; import { createDirectMessage } from '../../meteor-methods/messages/createDirectMessage'; import { executeSendMessage } from '../../meteor-methods/messages/sendMessage'; +import { settings } from '../../settings'; /* * Msg is a named function that will replace /msg commands diff --git a/apps/meteor/server/slashcommands/mute/mute.ts b/apps/meteor/server/slashcommands/mute/mute.ts index 18cde4f3b1fcd..ad0fb0af62afd 100644 --- a/apps/meteor/server/slashcommands/mute/mute.ts +++ b/apps/meteor/server/slashcommands/mute/mute.ts @@ -2,10 +2,10 @@ import { api } from '@rocket.chat/core-services'; import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; -import { settings } from '../../../app/settings/server'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; import { i18n } from '../../lib/i18n'; +import { slashCommands } from '../../lib/utils/slashCommand'; import { muteUserInRoom } from '../../meteor-methods/rooms/muteUserInRoom'; +import { settings } from '../../settings'; /* * Mute is a named function that will replace /mute commands diff --git a/apps/meteor/server/slashcommands/mute/unmute.ts b/apps/meteor/server/slashcommands/mute/unmute.ts index d921be454b368..fb29e5e46d925 100644 --- a/apps/meteor/server/slashcommands/mute/unmute.ts +++ b/apps/meteor/server/slashcommands/mute/unmute.ts @@ -2,10 +2,10 @@ import { api } from '@rocket.chat/core-services'; import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; -import { settings } from '../../../app/settings/server'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; import { i18n } from '../../lib/i18n'; +import { slashCommands } from '../../lib/utils/slashCommand'; import { unmuteUserInRoom } from '../../meteor-methods/rooms/unmuteUserInRoom'; +import { settings } from '../../settings'; /* * Unmute is a named function that will replace /unmute commands diff --git a/apps/meteor/server/slashcommands/status/status.ts b/apps/meteor/server/slashcommands/status/status.ts index 147dcb4ff0b01..3775cfc263760 100644 --- a/apps/meteor/server/slashcommands/status/status.ts +++ b/apps/meteor/server/slashcommands/status/status.ts @@ -2,10 +2,10 @@ import { api } from '@rocket.chat/core-services'; import type { SlashCommandCallbackParams, IUser } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; -import { settings } from '../../../app/settings/server'; -import { setUserStatusMethod } from '../../../app/user-status/server/methods/setUserStatus'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; import { i18n } from '../../lib/i18n'; +import { slashCommands } from '../../lib/utils/slashCommand'; +import { setUserStatusMethod } from '../../meteor-methods/users/setUserStatus'; +import { settings } from '../../settings'; slashCommands.add({ command: 'status', diff --git a/apps/meteor/server/slashcommands/topic/topic.ts b/apps/meteor/server/slashcommands/topic/topic.ts index 97c0e9155fc19..56da1d6ace8d7 100644 --- a/apps/meteor/server/slashcommands/topic/topic.ts +++ b/apps/meteor/server/slashcommands/topic/topic.ts @@ -1,7 +1,7 @@ import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; +import { slashCommands } from '../../lib/utils/slashCommand'; import { saveRoomSettings } from '../../meteor-methods/rooms/saveRoomSettings'; slashCommands.add({ diff --git a/apps/meteor/server/slashcommands/unarchiveroom/server.ts b/apps/meteor/server/slashcommands/unarchiveroom/server.ts index d46a7866c7094..0f54e860a9668 100644 --- a/apps/meteor/server/slashcommands/unarchiveroom/server.ts +++ b/apps/meteor/server/slashcommands/unarchiveroom/server.ts @@ -4,13 +4,13 @@ import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; import { Users, Rooms } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; -import { settings } from '../../../app/settings/server'; -import { slashCommands } from '../../../app/utils/server/slashCommand'; import { RoomMemberActions } from '../../../definition/IRoomTypeConfig'; import { hasPermissionAsync } from '../../lib/authorization/hasPermission'; import { i18n } from '../../lib/i18n'; import { roomCoordinator } from '../../lib/rooms/roomCoordinator'; import { unarchiveRoom } from '../../lib/rooms/unarchiveRoom'; +import { slashCommands } from '../../lib/utils/slashCommand'; +import { settings } from '../../settings'; slashCommands.add({ command: 'unarchive', diff --git a/apps/meteor/server/startup/initialData.ts b/apps/meteor/server/startup/initialData.ts index f593e51b0c500..c51c41569c4d1 100644 --- a/apps/meteor/server/startup/initialData.ts +++ b/apps/meteor/server/startup/initialData.ts @@ -6,12 +6,12 @@ import { Accounts } from 'meteor/accounts-base'; import { Meteor } from 'meteor/meteor'; import { addCallHistoryTestData } from './callHistoryTestData'; -import { notifyOnSettingChangedById } from '../../app/lib/server/lib/notifyListener'; -import { settings } from '../../app/settings/server'; import { FileUpload } from '../lib/media/file-upload'; +import { notifyOnSettingChangedById } from '../lib/notifyListener'; import { addUserRolesAsync } from '../lib/roles/addUserRoles'; import { addUserToDefaultChannels } from '../lib/rooms/addUserToDefaultChannels'; import { checkUsernameAvailability } from '../lib/users/checkUsernameAvailability'; +import { settings } from '../settings'; export async function insertAdminUserFromEnv() { if (process.env.ADMIN_PASS) { diff --git a/apps/meteor/server/startup/migrations/v296.ts b/apps/meteor/server/startup/migrations/v296.ts index 1cc00d8aa2255..5e26d60fcf605 100644 --- a/apps/meteor/server/startup/migrations/v296.ts +++ b/apps/meteor/server/startup/migrations/v296.ts @@ -1,8 +1,8 @@ import { Settings } from '@rocket.chat/models'; -import { settings } from '../../../app/settings/server'; import { SystemLogger } from '../../lib/logger/system'; import { addMigration } from '../../lib/migrations'; +import { settings } from '../../settings'; addMigration({ version: 296, diff --git a/apps/meteor/server/startup/migrations/v300.ts b/apps/meteor/server/startup/migrations/v300.ts index 4e00b2c030750..8c46ef3993fe6 100644 --- a/apps/meteor/server/startup/migrations/v300.ts +++ b/apps/meteor/server/startup/migrations/v300.ts @@ -1,7 +1,7 @@ import { Settings } from '@rocket.chat/models'; -import { settingsRegistry } from '../../../app/settings/server'; import { addMigration } from '../../lib/migrations'; +import { settingsRegistry } from '../../settings'; addMigration({ version: 300, diff --git a/apps/meteor/server/startup/migrations/xrun.ts b/apps/meteor/server/startup/migrations/xrun.ts index 7dfe654baae4f..9fdaea271472f 100644 --- a/apps/meteor/server/startup/migrations/xrun.ts +++ b/apps/meteor/server/startup/migrations/xrun.ts @@ -1,9 +1,9 @@ import { Permissions, Roles, Settings, Users } from '@rocket.chat/models'; import type { UpdateResult } from 'mongodb'; -import { settings } from '../../../app/settings/server'; import { upsertPermissions } from '../../lib/authorization/upsertPermissions'; import { migrateDatabase, onServerVersionChange } from '../../lib/migrations'; +import { settings } from '../../settings'; import { ensureCloudWorkspaceRegistered } from '../cloudRegistration'; const { MIGRATION_VERSION = 'latest' } = process.env; diff --git a/apps/meteor/server/startup/presenceTroubleshoot.ts b/apps/meteor/server/startup/presenceTroubleshoot.ts index b84588aef6ef5..4fad112c81f58 100644 --- a/apps/meteor/server/startup/presenceTroubleshoot.ts +++ b/apps/meteor/server/startup/presenceTroubleshoot.ts @@ -1,6 +1,6 @@ import { Presence } from '@rocket.chat/core-services'; -import { settings } from '../../app/settings/server'; +import { settings } from '../settings'; // maybe this setting should disable the listener to 'presence.status' event on listerners.module.ts settings.watch('Troubleshoot_Disable_Presence_Broadcast', async (value) => { diff --git a/apps/meteor/app/lib/server/startup/rateLimiter.js b/apps/meteor/server/startup/rateLimiter.js similarity index 97% rename from apps/meteor/app/lib/server/startup/rateLimiter.js rename to apps/meteor/server/startup/rateLimiter.js index ee2da4faba73f..5b5c0fe46ead5 100644 --- a/apps/meteor/app/lib/server/startup/rateLimiter.js +++ b/apps/meteor/server/startup/rateLimiter.js @@ -4,9 +4,9 @@ import { Meteor } from 'meteor/meteor'; import { RateLimiter } from 'meteor/rate-limit'; import _ from 'underscore'; -import { sleep } from '../../../../lib/utils/sleep'; -import { metrics } from '../../../../server/lib/metrics'; -import { settings } from '../../../settings/server'; +import { sleep } from '../../lib/utils/sleep'; +import { metrics } from '../lib/metrics'; +import { settings } from '../settings'; const logger = new Logger('RateLimiter'); diff --git a/apps/meteor/app/lib/server/startup/robots.js b/apps/meteor/server/startup/robots.js similarity index 83% rename from apps/meteor/app/lib/server/startup/robots.js rename to apps/meteor/server/startup/robots.js index 2225b2b725e08..1ddbe35e4adea 100644 --- a/apps/meteor/app/lib/server/startup/robots.js +++ b/apps/meteor/server/startup/robots.js @@ -1,7 +1,7 @@ import { Meteor } from 'meteor/meteor'; import { WebApp } from 'meteor/webapp'; -import { settings } from '../../../settings/server'; +import { settings } from '../settings'; Meteor.startup(() => { return WebApp.connectHandlers.use('/robots.txt', (req, res /* , next*/) => { diff --git a/apps/meteor/server/startup/serverRunning.ts b/apps/meteor/server/startup/serverRunning.ts index f1cc50f8950f1..aee622af81793 100644 --- a/apps/meteor/server/startup/serverRunning.ts +++ b/apps/meteor/server/startup/serverRunning.ts @@ -6,13 +6,13 @@ import { License } from '@rocket.chat/license'; import { Meteor } from 'meteor/meteor'; import semver from 'semver'; -import { settings } from '../../app/settings/server'; import { Info } from '../../app/utils/rocketchat.info'; -import { getMongoInfo } from '../../app/utils/server/functions/getMongoInfo'; +import { showErrorBox, showSuccessBox, showWarningBox } from '../lib/logger/showBox'; +import { getMongoInfo } from '../lib/utils/functions/getMongoInfo'; // import { i18n } from '../lib/i18n'; // import { isRunningMs } from '../lib/isRunningMs'; // import { sendMessagesToAdmins } from '../lib/sendMessagesToAdmins'; -import { showErrorBox, showSuccessBox, showWarningBox } from '../lib/logger/showBox'; +import { settings } from '../settings'; const exitIfNotBypassed = (ignore: string | undefined, errorCode = 1) => { if (typeof ignore === 'string' && ['yes', 'true'].includes(ignore.toLowerCase())) { diff --git a/apps/meteor/tests/data/permissions.helper.ts b/apps/meteor/tests/data/permissions.helper.ts index 0f8036c3c1704..fe83450becb50 100644 --- a/apps/meteor/tests/data/permissions.helper.ts +++ b/apps/meteor/tests/data/permissions.helper.ts @@ -1,8 +1,8 @@ import type { ISetting } from '@rocket.chat/core-typings'; import { api, credentials, request } from './api-data'; -import { permissions } from '../../app/authorization/server/constant/permissions'; -import { omnichannelEEPermissions } from '../../ee/app/livechat-enterprise/server/permissions'; +import { omnichannelEEPermissions } from '../../ee/server/lib/omnichannel/permissions'; +import { permissions } from '../../server/lib/authorization/constant/permissions'; import { IS_EE } from '../e2e/config/constants'; export const updatePermission = (permission: string, roles: string[]): Promise => diff --git a/apps/meteor/tests/unit/app/livechat/server/outbound/outbound.spec.ts b/apps/meteor/tests/unit/app/livechat/server/outbound/outbound.spec.ts deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/apps/meteor/tests/unit/server/api/checkPermissions.spec.ts b/apps/meteor/tests/unit/server/api/checkPermissions.spec.ts index 03c94044c356e..558ca2b4b2cbc 100644 --- a/apps/meteor/tests/unit/server/api/checkPermissions.spec.ts +++ b/apps/meteor/tests/unit/server/api/checkPermissions.spec.ts @@ -6,7 +6,7 @@ import Sinon from 'sinon'; import type { PermissionsPayload } from '../../../../server/api/api.helpers'; const mocks = { - '../../app/lib/server/lib/deprecationWarningLogger': { + '../lib/deprecationWarningLogger': { apiDeprecationLogger: { endpoint: Sinon.stub(), }, diff --git a/apps/meteor/tests/unit/server/api/checkPermissionsForInvocation.spec.ts b/apps/meteor/tests/unit/server/api/checkPermissionsForInvocation.spec.ts index 52a9df2181ec2..2ecf81bf8a84f 100644 --- a/apps/meteor/tests/unit/server/api/checkPermissionsForInvocation.spec.ts +++ b/apps/meteor/tests/unit/server/api/checkPermissionsForInvocation.spec.ts @@ -21,7 +21,7 @@ const mocks = { return permissions.some((permission) => userPermissions[userId].includes(permission)); }, }, - '../../app/lib/server/lib/deprecationWarningLogger': { + '../lib/deprecationWarningLogger': { apiDeprecationLogger: { endpoint: Sinon.stub(), }, diff --git a/apps/meteor/tests/unit/server/hooks/omnichannel/beforeNewRoom.spec.ts b/apps/meteor/tests/unit/server/hooks/omnichannel/beforeNewRoom.spec.ts index c17e6a3768ba3..7a6f1f0807c26 100644 --- a/apps/meteor/tests/unit/server/hooks/omnichannel/beforeNewRoom.spec.ts +++ b/apps/meteor/tests/unit/server/hooks/omnichannel/beforeNewRoom.spec.ts @@ -16,7 +16,7 @@ const { beforeNewRoomPatched } = proxyquire.noCallThru().load('../../../../../ee findOneByIdOrName: findStub, }, }, - '../../../../app/livechat/server/lib/hooks': { + '../../../../server/lib/omnichannel/hooks': { beforeNewRoom: { patch: sinon.stub() }, }, }); diff --git a/apps/meteor/tests/unit/server/hooks/omnichannel/markRoomResponded.spec.ts b/apps/meteor/tests/unit/server/hooks/omnichannel/markRoomResponded.spec.ts index 8461ec6aca9b0..13526b5e938d8 100644 --- a/apps/meteor/tests/unit/server/hooks/omnichannel/markRoomResponded.spec.ts +++ b/apps/meteor/tests/unit/server/hooks/omnichannel/markRoomResponded.spec.ts @@ -23,10 +23,10 @@ const isMessageFromBotMock = { isMessageFromBot: Sinon.stub() }; const { markRoomResponded } = proxyquire.noCallThru().load('../../../../../server/hooks/omnichannel/markRoomResponded.ts', { '../../lib/callbacks': { callbacks: { add: Sinon.stub(), priority: { HIGH: 'high' } } }, - '../../../app/lib/server/lib/notifyListener': { notifyOnLivechatInquiryChanged: Sinon.stub() }, + '../../lib/notifyListener': { notifyOnLivechatInquiryChanged: Sinon.stub() }, '@rocket.chat/models': models, - '../../../app/settings/server': { settings: settingsGetMock }, - '../../../app/livechat/server/lib/isMessageFromBot': isMessageFromBotMock, + '../../settings': { settings: settingsGetMock }, + '../../lib/omnichannel/isMessageFromBot': isMessageFromBotMock, }); describe('markRoomResponded', () => { diff --git a/apps/meteor/tests/unit/server/hooks/omnichannel/processRoomAbandonment.spec.ts b/apps/meteor/tests/unit/server/hooks/omnichannel/processRoomAbandonment.spec.ts index 005b44eff9088..9a1c033a5412e 100644 --- a/apps/meteor/tests/unit/server/hooks/omnichannel/processRoomAbandonment.spec.ts +++ b/apps/meteor/tests/unit/server/hooks/omnichannel/processRoomAbandonment.spec.ts @@ -30,10 +30,10 @@ const { getSecondsWhenOfficeHoursIsDisabled, parseDays, getSecondsSinceLastAgent '../../lib/callbacks': { callbacks: { add: sinon.stub(), priority: { HIGH: 'high' } }, }, - '../../../app/settings/server': { + '../../settings': { settings: { get: settingsStub }, }, - '../../../app/livechat/server/business-hour': { businessHourManager: businessHourManagerMock }, + '../../lib/omnichannel/business-hour': { businessHourManager: businessHourManagerMock }, }); describe('processRoomAbandonment', () => { diff --git a/apps/meteor/tests/unit/server/hooks/omnichannel/sendToCRM.tests.ts b/apps/meteor/tests/unit/server/hooks/omnichannel/sendToCRM.tests.ts index af2eebfc25d96..77da38a04b550 100644 --- a/apps/meteor/tests/unit/server/hooks/omnichannel/sendToCRM.tests.ts +++ b/apps/meteor/tests/unit/server/hooks/omnichannel/sendToCRM.tests.ts @@ -9,18 +9,18 @@ const resultObj = { const { sendMessageType, isOmnichannelNavigationMessage, isOmnichannelClosingMessage, getAdditionalFieldsByType } = p .noCallThru() .load('../../../../../server/hooks/omnichannel/sendToCRM', { - '../../../app/settings/server': { + '../../settings': { settings: { get() { return resultObj.result; }, }, }, - '../../../app/utils/server/functions/normalizeMessageFileUpload': { + '../../lib/utils/functions/normalizeMessageFileUpload': { normalizeMessageFileUpload: sinon.stub().returnsArg(0), }, - '../../../app/livechat/server/lib/webhooks': {}, - '../../../app/livechat/server/lib/guests': { getLivechatRoomGuestInfo: sinon.stub() }, + '../../lib/omnichannel/webhooks': {}, + '../../lib/omnichannel/guests': { getLivechatRoomGuestInfo: sinon.stub() }, }); describe('[OC] Send TO CRM', () => { diff --git a/apps/meteor/tests/unit/server/lib/banUserFromRoom.spec.ts b/apps/meteor/tests/unit/server/lib/banUserFromRoom.spec.ts index db3874f20d945..1058b9a2b02e6 100644 --- a/apps/meteor/tests/unit/server/lib/banUserFromRoom.spec.ts +++ b/apps/meteor/tests/unit/server/lib/banUserFromRoom.spec.ts @@ -37,12 +37,12 @@ const { banUserFromRoomMethod } = p.noCallThru().load('../../../../server/lib/ba isBannedSubscription: (sub: { status?: string } | null) => sub?.status === 'BANNED', }, '@rocket.chat/models': modelsMock, - '../../app/authorization/server': { canAccessRoomAsync: canAccessRoomAsyncMock }, + './authorization': { canAccessRoomAsync: canAccessRoomAsyncMock }, './authorization/hasPermission': { hasPermissionAsync: hasPermissionAsyncMock }, './authorization/hasRole': { hasRoleAsync: hasRoleAsyncMock }, './rooms/banUserFromRoom': { banUserFromRoom: banUserFromRoomMock }, '../../definition/IRoomTypeConfig': { RoomMemberActions }, - '../lib/rooms/roomCoordinator': { roomCoordinator: roomCoordinatorMock }, + './rooms/roomCoordinator': { roomCoordinator: roomCoordinatorMock }, }); describe('banUserFromRoomMethod', () => { diff --git a/apps/meteor/tests/unit/server/lib/dataExport/exportRoomMessagesToFile.spec.ts b/apps/meteor/tests/unit/server/lib/dataExport/exportRoomMessagesToFile.spec.ts index d9c346d45c92e..b89b8f599fc80 100644 --- a/apps/meteor/tests/unit/server/lib/dataExport/exportRoomMessagesToFile.spec.ts +++ b/apps/meteor/tests/unit/server/lib/dataExport/exportRoomMessagesToFile.spec.ts @@ -35,7 +35,7 @@ const { getMessageData, exportRoomMessages, exportMessageObject } = proxyquire t: stubs.translateKey, }, }, - '../../../app/settings/server': { + '../../settings': { settings: stubs.settings, }, }); diff --git a/apps/meteor/tests/unit/server/lib/e2e/functions/resetRoomKey.spec.ts b/apps/meteor/tests/unit/server/lib/e2e/functions/resetRoomKey.spec.ts index c370ce4e7b1d6..e0fff2515f48c 100644 --- a/apps/meteor/tests/unit/server/lib/e2e/functions/resetRoomKey.spec.ts +++ b/apps/meteor/tests/unit/server/lib/e2e/functions/resetRoomKey.spec.ts @@ -30,7 +30,7 @@ const { resetRoomKey, pushToLimit, replicateMongoSlice } = proxyquire .noCallThru() .load('../../../../../../server/lib/e2e/functions/resetRoomKey', { '@rocket.chat/models': models, - '../../../../app/lib/server/lib/notifyListener': { + '../../notifyListener': { notifyOnRoomChanged: sinon.stub(), notifyOnSubscriptionChanged: sinon.stub(), }, diff --git a/apps/meteor/tests/unit/server/lib/import/messageConverter.spec.ts b/apps/meteor/tests/unit/server/lib/import/messageConverter.spec.ts index 3affcb64cb2f6..562a1fc0e95a5 100644 --- a/apps/meteor/tests/unit/server/lib/import/messageConverter.spec.ts +++ b/apps/meteor/tests/unit/server/lib/import/messageConverter.spec.ts @@ -11,9 +11,6 @@ const modelsMock = { const insertMessage = sinon.stub(); const { MessageConverter } = proxyquire.noCallThru().load('../../../../../server/lib/import/classes/converters/MessageConverter', { - '../../../settings/server': { - settings: { get: settingsStub }, - }, '../../../messages/insertMessage': { insertMessage, }, diff --git a/apps/meteor/tests/unit/server/lib/import/recordConverter.spec.ts b/apps/meteor/tests/unit/server/lib/import/recordConverter.spec.ts index 5de2583377294..ed849d1494a67 100644 --- a/apps/meteor/tests/unit/server/lib/import/recordConverter.spec.ts +++ b/apps/meteor/tests/unit/server/lib/import/recordConverter.spec.ts @@ -15,9 +15,6 @@ const modelsMock = { }; const { RecordConverter } = proxyquire.noCallThru().load('../../../../../server/lib/import/classes/converters/RecordConverter', { - '../../../settings/server': { - settings: { get: settingsStub }, - }, 'meteor/check': sinon.stub(), 'meteor/meteor': sinon.stub(), '@rocket.chat/models': { ...modelsMock, '@global': true }, diff --git a/apps/meteor/tests/unit/server/lib/import/roomConverter.spec.ts b/apps/meteor/tests/unit/server/lib/import/roomConverter.spec.ts index 734d4e55b8e89..139ef934055f4 100644 --- a/apps/meteor/tests/unit/server/lib/import/roomConverter.spec.ts +++ b/apps/meteor/tests/unit/server/lib/import/roomConverter.spec.ts @@ -19,16 +19,13 @@ const createDirectMessage = sinon.stub(); const saveRoomSettings = sinon.stub(); const { RoomConverter } = proxyquire.noCallThru().load('../../../../../server/lib/import/classes/converters/RoomConverter', { - '../../../settings/server': { - settings: { get: settingsStub }, - }, '../../../../meteor-methods/messages/createDirectMessage': { createDirectMessage, }, '../../../../meteor-methods/rooms/saveRoomSettings': { saveRoomSettings, }, - '../../../../../app/lib/server/lib/notifyListener': { + '../../../notifyListener': { notifyOnSubscriptionChangedByRoomId: sinon.stub(), }, '../../../../meteor-methods/rooms/createChannel': { diff --git a/apps/meteor/tests/unit/server/lib/import/userConverter.spec.ts b/apps/meteor/tests/unit/server/lib/import/userConverter.spec.ts index e96536ee4efd2..0c740bebaed9e 100644 --- a/apps/meteor/tests/unit/server/lib/import/userConverter.spec.ts +++ b/apps/meteor/tests/unit/server/lib/import/userConverter.spec.ts @@ -24,9 +24,6 @@ const { UserConverter } = proxyquire.noCallThru().load('../../../../../server/li '../../../callbacks': { callbacks, }, - '../../../settings/server': { - settings: { get: settingsStub }, - }, '../../../rooms/addUserToDefaultChannels': { addUserToDefaultChannels, }, @@ -39,7 +36,7 @@ const { UserConverter } = proxyquire.noCallThru().load('../../../../../server/li '../../../users/setUserActiveStatus': { setUserActiveStatus: sinon.stub(), }, - '../../../../../app/lib/server/lib/notifyListener': { + '../../../notifyListener': { notifyOnUserChange: sinon.stub(), }, './generateTempPassword': { diff --git a/apps/meteor/tests/unit/app/ui-utils/server.tests.js b/apps/meteor/tests/unit/server/lib/messaging/Message.tests.js similarity index 100% rename from apps/meteor/tests/unit/app/ui-utils/server.tests.js rename to apps/meteor/tests/unit/server/lib/messaging/Message.tests.js diff --git a/apps/meteor/tests/unit/app/lib/server/lib/getHiddenSystemMessage.spec.ts b/apps/meteor/tests/unit/server/lib/messaging/getHiddenSystemMessage.spec.ts similarity index 96% rename from apps/meteor/tests/unit/app/lib/server/lib/getHiddenSystemMessage.spec.ts rename to apps/meteor/tests/unit/server/lib/messaging/getHiddenSystemMessage.spec.ts index 4fb3df00b8c58..320d519105483 100644 --- a/apps/meteor/tests/unit/app/lib/server/lib/getHiddenSystemMessage.spec.ts +++ b/apps/meteor/tests/unit/server/lib/messaging/getHiddenSystemMessage.spec.ts @@ -1,7 +1,7 @@ import type { MessageTypesValues, IRoom, IUser } from '@rocket.chat/core-typings'; import { expect } from 'chai'; -import { getHiddenSystemMessages } from '../../../../../../app/lib/server/lib/getHiddenSystemMessages'; +import { getHiddenSystemMessages } from '../../../../../server/lib/messaging/getHiddenSystemMessages'; describe('getHiddenSystemMessages', () => { it('should return room.sysMes if it is an array', async () => { diff --git a/apps/meteor/tests/unit/server/lib/messaging/reactions/setReaction.spec.ts b/apps/meteor/tests/unit/server/lib/messaging/reactions/setReaction.spec.ts index 3e37658f7ec1e..2df8f61b1be0e 100644 --- a/apps/meteor/tests/unit/server/lib/messaging/reactions/setReaction.spec.ts +++ b/apps/meteor/tests/unit/server/lib/messaging/reactions/setReaction.spec.ts @@ -43,11 +43,11 @@ const { removeUserReaction, executeSetReaction, setReaction } = p 'meteor/meteor': { Meteor: { methods: meteorMethodsMock, Error: meteorErrorMock } }, '../../callbacks': { callbacks: { run: callbacksRunMock } }, '../../i18n': { i18n: i18nMock }, - '../../../../app/authorization/server': { canAccessRoomAsync: canAccessRoomAsyncMock }, + '../../authorization': { canAccessRoomAsync: canAccessRoomAsyncMock }, '../../authorization/hasPermission': { hasPermissionAsync: hasPermissionAsyncMock }, '../emoji': { emoji: { list: emojiList } }, '../../messages/isTheLastMessage': { isTheLastMessage: isTheLastMessageMock }, - '../../../../app/lib/server/lib/notifyListener': { + '../../notifyListener': { notifyOnMessageChange: notifyOnMessageChangeMock, }, }); diff --git a/apps/meteor/tests/unit/app/lib/server/lib/validateCustomMessageFields.tests.ts b/apps/meteor/tests/unit/server/lib/messaging/validateCustomMessageFields.tests.ts similarity index 95% rename from apps/meteor/tests/unit/app/lib/server/lib/validateCustomMessageFields.tests.ts rename to apps/meteor/tests/unit/server/lib/messaging/validateCustomMessageFields.tests.ts index d0f8851a78ed0..e19fd96bb4119 100644 --- a/apps/meteor/tests/unit/app/lib/server/lib/validateCustomMessageFields.tests.ts +++ b/apps/meteor/tests/unit/server/lib/messaging/validateCustomMessageFields.tests.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { validateCustomMessageFields } from '../../../../../../app/lib/server/lib/validateCustomMessageFields'; +import { validateCustomMessageFields } from '../../../../../server/lib/messaging/validateCustomMessageFields'; describe('validateCustomMessageFields', () => { describe('When not enabled', () => { diff --git a/apps/meteor/tests/unit/app/mailer/api.spec.ts b/apps/meteor/tests/unit/server/lib/notifications/email/api.spec.ts similarity index 95% rename from apps/meteor/tests/unit/app/mailer/api.spec.ts rename to apps/meteor/tests/unit/server/lib/notifications/email/api.spec.ts index 2f80cc69cfef1..a1c909d550cec 100644 --- a/apps/meteor/tests/unit/app/mailer/api.spec.ts +++ b/apps/meteor/tests/unit/server/lib/notifications/email/api.spec.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { replaceVariables } from '../../../../server/lib/notifications/email/replaceVariables'; +import { replaceVariables } from '../../../../../../server/lib/notifications/email/replaceVariables'; describe('Mailer-API', () => { describe('replaceVariables', () => { diff --git a/apps/meteor/tests/unit/app/mailer/getEmailContent.spec.ts b/apps/meteor/tests/unit/server/lib/notifications/message/getEmailContent.spec.ts similarity index 78% rename from apps/meteor/tests/unit/app/mailer/getEmailContent.spec.ts rename to apps/meteor/tests/unit/server/lib/notifications/message/getEmailContent.spec.ts index 84a694f2b93a4..27d28f4a6dd8c 100644 --- a/apps/meteor/tests/unit/app/mailer/getEmailContent.spec.ts +++ b/apps/meteor/tests/unit/server/lib/notifications/message/getEmailContent.spec.ts @@ -12,17 +12,17 @@ const mocks = { startup: () => {}, }, }, - '../../../../../server/lib/callbacks': { + '../../callbacks': { callbacks: { run: () => {}, }, }, - '../../../../../server/lib/i18n': { + '../../i18n': { i18n: { t: (trans: string) => trans, }, }, - '../../../../../server/lib/rooms/roomCoordinator': { + '../../rooms/roomCoordinator': { roomCoordinator: { getRoomDirectives: () => ({ isGroupChat: () => true, @@ -30,21 +30,21 @@ const mocks = { getRoomName: () => '', }, }, - '../../../../../server/lib/notifications/email/api': { + '../email/api': { getTemplate: () => {}, send: () => {}, replace: () => {}, }, - '../../../../settings/server': { + '../../../settings': { settings: { get: () => true, watch: () => {}, }, }, - '../../../../../server/lib/metrics': { + '../../metrics': { metrics: {}, }, - '../../../../utils/server/getURL': { + '../../utils/getURL': { getURL: () => {}, }, }; @@ -64,7 +64,7 @@ const room = { describe('getEmailContent', () => { it('should return preview string for encrypted message', async () => { - const { getEmailContent } = proxyquire.noCallThru().load('../../../../app/lib/server/functions/notifications/email.js', mocks); + const { getEmailContent } = proxyquire.noCallThru().load('../../../../../../server/lib/notifications/message/email.js', mocks); const result = await getEmailContent({ message: { ...message, t: 'e2e' }, @@ -75,9 +75,9 @@ describe('getEmailContent', () => { }); it('should return header for encrypted message if Email_notification_show_message is turned off', async () => { - const { getEmailContent } = proxyquire.noCallThru().load('../../../../app/lib/server/functions/notifications/email.js', { + const { getEmailContent } = proxyquire.noCallThru().load('../../../../../../server/lib/notifications/message/email.js', { ...mocks, - '../../../../settings/server': { + '../../../settings': { settings: { get: () => false, watch: () => {}, diff --git a/apps/meteor/tests/unit/app/lib/server/functions/notifications/messageContainsHighlight.tests.ts b/apps/meteor/tests/unit/server/lib/notifications/message/messageContainsHighlight.tests.ts similarity index 95% rename from apps/meteor/tests/unit/app/lib/server/functions/notifications/messageContainsHighlight.tests.ts rename to apps/meteor/tests/unit/server/lib/notifications/message/messageContainsHighlight.tests.ts index ad1d5461cdb91..90cf121d19d5e 100644 --- a/apps/meteor/tests/unit/app/lib/server/functions/notifications/messageContainsHighlight.tests.ts +++ b/apps/meteor/tests/unit/server/lib/notifications/message/messageContainsHighlight.tests.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { messageContainsHighlight } from '../../../../../../../app/lib/server/functions/notifications/messageContainsHighlight'; +import { messageContainsHighlight } from '../../../../../../server/lib/notifications/message/messageContainsHighlight'; describe('messageContainsHighlight', () => { it('should return false for no highlights', async () => { diff --git a/apps/meteor/tests/unit/server/lib/notifications/push/push.spec.ts b/apps/meteor/tests/unit/server/lib/notifications/push/push.spec.ts index fff31de1aec26..54d7c27c3c04d 100644 --- a/apps/meteor/tests/unit/server/lib/notifications/push/push.spec.ts +++ b/apps/meteor/tests/unit/server/lib/notifications/push/push.spec.ts @@ -9,7 +9,7 @@ const settingsStub = { get: sinon.stub().returns('') }; const { Push } = proxyquire.noCallThru().load('../../../../../../server/lib/notifications/push/push', { './logger': { logger: loggerStub }, - '../../../../app/settings/server': { settings: settingsStub }, + '../../../settings': { settings: settingsStub }, '@rocket.chat/tools': { pick, truncateString }, 'meteor/check': { check: sinon.stub(), diff --git a/apps/meteor/tests/unit/app/lib/server/lib/notifyListener.spec.ts b/apps/meteor/tests/unit/server/lib/notifyListener.spec.ts similarity index 97% rename from apps/meteor/tests/unit/app/lib/server/lib/notifyListener.spec.ts rename to apps/meteor/tests/unit/server/lib/notifyListener.spec.ts index 0d800f7705cb1..d0c335df80107 100644 --- a/apps/meteor/tests/unit/app/lib/server/lib/notifyListener.spec.ts +++ b/apps/meteor/tests/unit/server/lib/notifyListener.spec.ts @@ -48,7 +48,7 @@ describe('Message Broadcast Tests', () => { broadcastStub = sinon.stub(); memStub = sinon.stub().callsFake((fn: any) => fn); - const proxyMock = proxyquire.noPreserveCache().load('../../../../../../app/lib/server/lib/notifyListener', { + const proxyMock = proxyquire.noPreserveCache().load('../../../../server/lib/notifyListener', { '@rocket.chat/models': modelsStubs(), '@rocket.chat/core-services': coreStubs(), 'mem': memStub, @@ -201,7 +201,7 @@ describe('Message Broadcast Tests', () => { describe('notifyOnMessageChange', () => { const setupProxyMock = () => { - const proxyMock = proxyquire.noCallThru().load('../../../../../../app/lib/server/lib/notifyListener', { + const proxyMock = proxyquire.noCallThru().load('../../../../server/lib/notifyListener', { '@rocket.chat/models': modelsStubs(), '@rocket.chat/core-services': coreStubs(), 'mem': memStub, diff --git a/apps/meteor/tests/unit/app/livechat/lib/assets.spec.ts b/apps/meteor/tests/unit/server/lib/omnichannel/assets.spec.ts similarity index 94% rename from apps/meteor/tests/unit/app/livechat/lib/assets.spec.ts rename to apps/meteor/tests/unit/server/lib/omnichannel/assets.spec.ts index dd9944498ae1f..38c1795200afb 100644 --- a/apps/meteor/tests/unit/app/livechat/lib/assets.spec.ts +++ b/apps/meteor/tests/unit/server/lib/omnichannel/assets.spec.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { describe, it, before, after } from 'mocha'; -import { addServerUrlToIndex } from '../../../../../app/livechat/lib/Assets'; +import { addServerUrlToIndex } from '../../../../../server/lib/omnichannel/Assets'; describe('addServerUrlToIndex', () => { before(() => { diff --git a/apps/meteor/tests/unit/app/livechat/server/business-hour/BusinessHourManager.spec.ts b/apps/meteor/tests/unit/server/lib/omnichannel/business-hour/BusinessHourManager.spec.ts similarity index 97% rename from apps/meteor/tests/unit/app/livechat/server/business-hour/BusinessHourManager.spec.ts rename to apps/meteor/tests/unit/server/lib/omnichannel/business-hour/BusinessHourManager.spec.ts index 3b4637bcdfedb..b9419c38dd144 100644 --- a/apps/meteor/tests/unit/app/livechat/server/business-hour/BusinessHourManager.spec.ts +++ b/apps/meteor/tests/unit/server/lib/omnichannel/business-hour/BusinessHourManager.spec.ts @@ -24,16 +24,15 @@ const LivechatBusinessHoursStub = { const saveBusinessHourStub = sinon.stub(); const loggerStub = sinon.stub(); -const { BusinessHourManager } = proxyquire.noCallThru().load('../../../../../../app/livechat/server/business-hour/BusinessHourManager', { - '../../../settings/server': {}, - '../../../../server/lib/callbacks': {}, - '../../../../ee/app/livechat-enterprise/server/business-hour/Helper': {}, +const { BusinessHourManager } = proxyquire.noCallThru().load('../../../../../../server/lib/omnichannel/business-hour/BusinessHourManager', { + '../../../settings': {}, + '../../callbacks': {}, './AbstractBusinessHour': {}, 'moment-timezone': momentStub, '@rocket.chat/models': { LivechatBusinessHours: LivechatBusinessHoursStub, }, - '../lib/logger': { + '../logger': { businessHourLogger: { error: loggerStub, }, diff --git a/apps/meteor/tests/unit/server/lib/omnichannel/closeLivechatRoom.tests.ts b/apps/meteor/tests/unit/server/lib/omnichannel/closeLivechatRoom.tests.ts index 3f56cd402ac51..9b8a17422faee 100644 --- a/apps/meteor/tests/unit/server/lib/omnichannel/closeLivechatRoom.tests.ts +++ b/apps/meteor/tests/unit/server/lib/omnichannel/closeLivechatRoom.tests.ts @@ -22,7 +22,7 @@ const livechatStub = { const hasPermissionStub = sinon.stub(); const { closeLivechatRoom } = proxyquire.noCallThru().load('../../../../../server/lib/omnichannel/closeLivechatRoom.ts', { - '../../../app/livechat/server/lib/closeRoom': livechatStub, + './closeRoom': livechatStub, '../authorization/hasPermission': { hasPermissionAsync: hasPermissionStub, }, diff --git a/apps/meteor/tests/unit/app/livechat/server/lib/conditionalLockAgent.spec.ts b/apps/meteor/tests/unit/server/lib/omnichannel/conditionalLockAgent.spec.ts similarity index 93% rename from apps/meteor/tests/unit/app/livechat/server/lib/conditionalLockAgent.spec.ts rename to apps/meteor/tests/unit/server/lib/omnichannel/conditionalLockAgent.spec.ts index 3d4eb0f64d975..22f3e3e7bc2c9 100644 --- a/apps/meteor/tests/unit/app/livechat/server/lib/conditionalLockAgent.spec.ts +++ b/apps/meteor/tests/unit/server/lib/omnichannel/conditionalLockAgent.spec.ts @@ -13,10 +13,10 @@ const mockSettings = { const mockHasRoleAsync = sinon.stub(); -const { conditionalLockAgent } = proxyquire.noCallThru().load('../../../../../../app/livechat/server/lib/conditionalLockAgent', { +const { conditionalLockAgent } = proxyquire.noCallThru().load('../../../../../server/lib/omnichannel/conditionalLockAgent', { '@rocket.chat/models': { Users: mockUsers }, - '../../../../server/lib/authorization/hasRole': { hasRoleAsync: mockHasRoleAsync }, - '../../../settings/server': { settings: mockSettings }, + '../authorization/hasRole': { hasRoleAsync: mockHasRoleAsync }, + '../../settings': { settings: mockSettings }, }); describe('conditionalLockAgent', () => { diff --git a/apps/meteor/tests/unit/app/livechat/server/lib/custom-fields.spec.ts b/apps/meteor/tests/unit/server/lib/omnichannel/custom-fields.spec.ts similarity index 98% rename from apps/meteor/tests/unit/app/livechat/server/lib/custom-fields.spec.ts rename to apps/meteor/tests/unit/server/lib/omnichannel/custom-fields.spec.ts index 4b6c4312146d4..8bd811514a6db 100644 --- a/apps/meteor/tests/unit/app/livechat/server/lib/custom-fields.spec.ts +++ b/apps/meteor/tests/unit/server/lib/omnichannel/custom-fields.spec.ts @@ -8,7 +8,7 @@ const modelsMock = { }, }; -const { updateContactsCustomFields } = proxyquire.noCallThru().load('../../../../../../app/livechat/server/lib/custom-fields.ts', { +const { updateContactsCustomFields } = proxyquire.noCallThru().load('../../../../../server/lib/omnichannel/custom-fields.ts', { '@rocket.chat/models': modelsMock, }); diff --git a/apps/meteor/tests/unit/app/livechat/server/lib/disableContact.spec.ts b/apps/meteor/tests/unit/server/lib/omnichannel/disableContact.spec.ts similarity index 97% rename from apps/meteor/tests/unit/app/livechat/server/lib/disableContact.spec.ts rename to apps/meteor/tests/unit/server/lib/omnichannel/disableContact.spec.ts index aca864f9aeb67..47e29dd13eb99 100644 --- a/apps/meteor/tests/unit/app/livechat/server/lib/disableContact.spec.ts +++ b/apps/meteor/tests/unit/server/lib/omnichannel/disableContact.spec.ts @@ -18,10 +18,10 @@ const settingsMock = { const removeGuestMock = { removeGuest: sinon.stub() }; -const { disableContactById } = proxyquire.noCallThru().load('../../../../../../app/livechat/server/lib/contacts/disableContact.ts', { +const { disableContactById } = proxyquire.noCallThru().load('../../../../../server/lib/omnichannel/contacts/disableContact.ts', { '@rocket.chat/models': modelsMock, '../guests': removeGuestMock, - '../../../../settings/server': { settings: settingsMock }, + '../../../settings': { settings: settingsMock }, }); describe('disableContact', () => { diff --git a/apps/meteor/tests/unit/app/livechat/server/lib/isMessageFromBot.spec.ts b/apps/meteor/tests/unit/server/lib/omnichannel/isMessageFromBot.spec.ts similarity index 87% rename from apps/meteor/tests/unit/app/livechat/server/lib/isMessageFromBot.spec.ts rename to apps/meteor/tests/unit/server/lib/omnichannel/isMessageFromBot.spec.ts index 6449f3a52cb72..383d1ea88f5d2 100644 --- a/apps/meteor/tests/unit/app/livechat/server/lib/isMessageFromBot.spec.ts +++ b/apps/meteor/tests/unit/server/lib/omnichannel/isMessageFromBot.spec.ts @@ -2,7 +2,7 @@ import { expect } from 'chai'; import p from 'proxyquire'; import sinon from 'sinon'; -import { createFakeMessage } from '../../../../../mocks/data'; +import { createFakeMessage } from '../../../../mocks/data'; const modelsMock = { Users: { @@ -10,7 +10,7 @@ const modelsMock = { }, }; -const { isMessageFromBot } = p.noCallThru().load('../../../../../../app/livechat/server/lib/isMessageFromBot', { +const { isMessageFromBot } = p.noCallThru().load('../../../../../server/lib/omnichannel/isMessageFromBot', { '@rocket.chat/models': modelsMock, }); diff --git a/apps/meteor/tests/unit/app/livechat/server/lib/parseTranscriptRequest.spec.ts b/apps/meteor/tests/unit/server/lib/omnichannel/parseTranscriptRequest.spec.ts similarity index 98% rename from apps/meteor/tests/unit/app/livechat/server/lib/parseTranscriptRequest.spec.ts rename to apps/meteor/tests/unit/server/lib/omnichannel/parseTranscriptRequest.spec.ts index a1b2ce52d1a35..b6368e18722c0 100644 --- a/apps/meteor/tests/unit/app/livechat/server/lib/parseTranscriptRequest.spec.ts +++ b/apps/meteor/tests/unit/server/lib/omnichannel/parseTranscriptRequest.spec.ts @@ -15,9 +15,9 @@ const settingsGetMock = { get: sinon.stub(), }; -const { parseTranscriptRequest } = p.noCallThru().load('../../../../../../app/livechat/server/lib/parseTranscriptRequest', { +const { parseTranscriptRequest } = p.noCallThru().load('../../../../../server/lib/omnichannel/parseTranscriptRequest', { '@rocket.chat/models': modelsMock, - '../../../settings/server': { settings: settingsGetMock }, + '../../settings': { settings: settingsGetMock }, }); describe('parseTranscriptRequest', () => { diff --git a/apps/meteor/tests/unit/app/livechat/server/lib/sendTranscript.spec.ts b/apps/meteor/tests/unit/server/lib/omnichannel/sendTranscript.spec.ts similarity index 92% rename from apps/meteor/tests/unit/app/livechat/server/lib/sendTranscript.spec.ts rename to apps/meteor/tests/unit/server/lib/omnichannel/sendTranscript.spec.ts index 6cca6e41c3c10..508740352103b 100644 --- a/apps/meteor/tests/unit/app/livechat/server/lib/sendTranscript.spec.ts +++ b/apps/meteor/tests/unit/server/lib/omnichannel/sendTranscript.spec.ts @@ -51,7 +51,12 @@ const mailerMock = sinon.stub(); const tStub = sinon.stub(); -const { sendTranscript } = p.noCallThru().load('../../../../../../app/livechat/server/lib/sendTranscript', { +const { sendTranscript } = p.noCallThru().load('../../../../../server/lib/omnichannel/sendTranscript', { + // mocked so the spec doesn't depend on whichever broker a previously-run spec installed + '@rocket.chat/core-services': { + Message: { saveSystemMessage: sinon.stub().resolves() }, + Omnichannel: { isWithinMACLimit: sinon.stub().resolves(true) }, + }, '@rocket.chat/models': modelsMock, '@rocket.chat/logger': { Logger: mockLogger }, 'meteor/meteor': { @@ -60,17 +65,17 @@ const { sendTranscript } = p.noCallThru().load('../../../../../../app/livechat/s }, }, 'meteor/check': { check: checkMock }, - '../../../../server/lib/callbacks': { + '../callbacks': { callbacks: { run: sinon.stub(), }, }, - '../../../../server/lib/i18n': { i18n: { t: tStub } }, - '../../../../server/lib/notifications/email/api': { send: mailerMock }, - '../../../settings/server': { settings: { get: settingsMock } }, - '../../../utils/server/lib/getTimezone': { getTimezone: getTimezoneMock }, + '../i18n': { i18n: { t: tStub } }, + '../notifications/email/api': { send: mailerMock }, + '../../settings': { settings: { get: settingsMock } }, + '../utils/lib/getTimezone': { getTimezone: getTimezoneMock }, // TODO: add tests for file handling on transcripts - '../../../../server/lib/media/file-upload': { FileUpload: {} }, + '../media/file-upload': { FileUpload: {} }, }); describe('Send transcript', () => { diff --git a/apps/meteor/tests/unit/app/livechat/server/lib/validateRequiredCustomFields.spec.ts b/apps/meteor/tests/unit/server/lib/omnichannel/validateRequiredCustomFields.spec.ts similarity index 96% rename from apps/meteor/tests/unit/app/livechat/server/lib/validateRequiredCustomFields.spec.ts rename to apps/meteor/tests/unit/server/lib/omnichannel/validateRequiredCustomFields.spec.ts index 1009c2b76b929..d80b7a66a2f33 100644 --- a/apps/meteor/tests/unit/app/livechat/server/lib/validateRequiredCustomFields.spec.ts +++ b/apps/meteor/tests/unit/server/lib/omnichannel/validateRequiredCustomFields.spec.ts @@ -1,7 +1,7 @@ import type { ILivechatCustomField } from '@rocket.chat/core-typings'; import { expect } from 'chai'; -import { validateRequiredCustomFields } from '../../../../../../app/livechat/server/lib/custom-fields'; +import { validateRequiredCustomFields } from '../../../../../server/lib/omnichannel/custom-fields'; describe('validateRequiredCustomFields', () => { it('should throw an error if the required custom fields are not provided', async () => { diff --git a/apps/meteor/tests/unit/app/livechat/server/lib/webhooks.spec.ts b/apps/meteor/tests/unit/server/lib/omnichannel/webhooks.spec.ts similarity index 98% rename from apps/meteor/tests/unit/app/livechat/server/lib/webhooks.spec.ts rename to apps/meteor/tests/unit/server/lib/omnichannel/webhooks.spec.ts index 4949678e6ef62..6243b0d8dbad5 100644 --- a/apps/meteor/tests/unit/app/livechat/server/lib/webhooks.spec.ts +++ b/apps/meteor/tests/unit/server/lib/omnichannel/webhooks.spec.ts @@ -13,7 +13,7 @@ const mkResponse = (status: number, text = ''): FetchResponse => ({ text: async () => text, }); -const MODULE_PATH = '../../../../../../app/livechat/server/lib/webhooks'; +const MODULE_PATH = '../../../../../server/lib/omnichannel/webhooks'; function buildSubject(options?: { fetchSequence?: Array<{ status: number; text?: string }>; @@ -58,8 +58,8 @@ function buildSubject(options?: { const { sendRequest } = proxyquire.noCallThru().load(MODULE_PATH, { '@rocket.chat/server-fetch': { serverFetch: fetchStub }, './logger': { webhooksLogger: logger }, - '../../../../server/lib/metrics': { metrics }, - '../../../settings/server': { settings }, + '../metrics': { metrics }, + '../../settings': { settings }, }); return { diff --git a/apps/meteor/tests/unit/server/lib/rooms/banUserFromRoom.spec.ts b/apps/meteor/tests/unit/server/lib/rooms/banUserFromRoom.spec.ts index 1cf846f5ca639..45b478ccb1b36 100644 --- a/apps/meteor/tests/unit/server/lib/rooms/banUserFromRoom.spec.ts +++ b/apps/meteor/tests/unit/server/lib/rooms/banUserFromRoom.spec.ts @@ -38,7 +38,7 @@ const { performUserBan, banUserFromRoom } = p.noCallThru().load('../../../../../ 'meteor/meteor': { Meteor: { Error: meteorErrorMock } }, '../callbacks/afterBanFromRoomCallback': { afterBanFromRoomCallback: afterBanFromRoomCallbackMock }, '../roles/removeUserFromRoles': { removeUserFromRolesAsync: removeUserFromRolesAsyncMock }, - '../../../app/lib/server/lib/notifyListener': { + '../notifyListener': { notifyOnRoomChangedById: notifyOnRoomChangedByIdMock, notifyOnSubscriptionChanged: notifyOnSubscriptionChangedMock, }, diff --git a/apps/meteor/tests/unit/server/lib/saml/server.tests.ts b/apps/meteor/tests/unit/server/lib/saml/server.tests.ts index b3810e5f31a03..cd6d447de6713 100644 --- a/apps/meteor/tests/unit/server/lib/saml/server.tests.ts +++ b/apps/meteor/tests/unit/server/lib/saml/server.tests.ts @@ -1194,7 +1194,7 @@ describe('SAML', () => { '../../rooms/createRoom': { createRoom: sinon.stub() }, '../../users/getUsernameSuggestion': { generateUsernameSuggestion: sinon.stub() }, '../../users/saveUserIdentity': { saveUserIdentity: sinon.stub() }, - '../../../../app/settings/server': { settings: { get: sinon.stub() } }, + '../../../settings': { settings: { get: sinon.stub() } }, '../../../../app/utils/lib/i18n': { i18n: { t: (s: string) => s, languages: [] } }, }).SAML; diff --git a/apps/meteor/tests/unit/server/lib/users/saveUser/sendUserEmail.spec.ts b/apps/meteor/tests/unit/server/lib/users/saveUser/sendUserEmail.spec.ts index 797d38006505c..c9a419dcb559b 100644 --- a/apps/meteor/tests/unit/server/lib/users/saveUser/sendUserEmail.spec.ts +++ b/apps/meteor/tests/unit/server/lib/users/saveUser/sendUserEmail.spec.ts @@ -56,7 +56,7 @@ describe('sendUserEmail (Mocha + TS)', () => { const mod = mock.noCallThru().load('../../../../../../server/lib/users/saveUser/sendUserEmail.ts', { '../../notifications/email/api': MailerStub, - '../../../../app/settings/server': SettingsStub, + '../../../settings': SettingsStub, 'meteor/meteor': MeteorStub, }) as any; diff --git a/apps/meteor/tests/unit/server/lib/users/setUsername.spec.ts b/apps/meteor/tests/unit/server/lib/users/setUsername.spec.ts index fd58b5f06a6fe..a2953386b9035 100644 --- a/apps/meteor/tests/unit/server/lib/users/setUsername.spec.ts +++ b/apps/meteor/tests/unit/server/lib/users/setUsername.spec.ts @@ -50,8 +50,8 @@ describe('setUsername', () => { '@rocket.chat/models': { Users: stubs.Users, Invites: stubs.Invites, Subscriptions: stubs.Subscriptions }, 'meteor/accounts-base': { Accounts: stubs.Accounts }, 'underscore': stubs.underscore, - '../../../app/settings/server': { settings: stubs.settings }, - '../../../app/lib/server/lib/notifyListener': { notifyOnUserChange: stubs.notifyOnUserChange }, + '../../settings': { settings: stubs.settings }, + '../notifyListener': { notifyOnUserChange: stubs.notifyOnUserChange }, '../rooms/addUserToRoom': { addUserToRoom: stubs.addUserToRoom }, './checkUsernameAvailability': { checkUsernameAvailability: stubs.checkUsernameAvailability }, './getAvatarSuggestionForUser': { getAvatarSuggestionForUser: stubs.getAvatarSuggestionForUser }, diff --git a/apps/meteor/tests/unit/server/lib/users/validateUsername.spec.ts b/apps/meteor/tests/unit/server/lib/users/validateUsername.spec.ts index b853362d1c238..2c86d5dd46190 100644 --- a/apps/meteor/tests/unit/server/lib/users/validateUsername.spec.ts +++ b/apps/meteor/tests/unit/server/lib/users/validateUsername.spec.ts @@ -12,7 +12,7 @@ describe('validateUsername', () => { }; const { validateUsername } = proxyquire.noCallThru().load('../../../../../server/lib/users/validateUsername', { - '../../../app/settings/server': proxySettings, + '../../settings': proxySettings, }); beforeEach(() => { diff --git a/apps/meteor/tests/unit/server/meteor-methods/platform/updateGroupKey.spec.ts b/apps/meteor/tests/unit/server/meteor-methods/platform/updateGroupKey.spec.ts index 0deb4fe9d77a3..e216221f85519 100644 --- a/apps/meteor/tests/unit/server/meteor-methods/platform/updateGroupKey.spec.ts +++ b/apps/meteor/tests/unit/server/meteor-methods/platform/updateGroupKey.spec.ts @@ -15,16 +15,11 @@ const models = { }; const { updateGroupKey } = proxyquire.noCallThru().load('../../../../../server/meteor-methods/platform/updateGroupKey.ts', { - '../../../app/lib/server/lib/notifyListener': { + '../../lib/notifyListener': { notifyOnSubscriptionChanged: sinon.stub(), notifyOnRoomChangedById: sinon.stub(), notifyOnSubscriptionChangedById: sinon.stub(), }, - '../../../app/lib/server/lib/deprecationWarningLogger': { - methodDeprecationLogger: { - method: sinon.stub(), - }, - }, '@rocket.chat/models': models, 'meteor/meteor': { Meteor: { methods: sinon.stub() } }, }); diff --git a/apps/meteor/tests/unit/server/services/calendar/service.tests.ts b/apps/meteor/tests/unit/server/services/calendar/service.tests.ts index 740ab5fb0e56b..531d5824c6104 100644 --- a/apps/meteor/tests/unit/server/services/calendar/service.tests.ts +++ b/apps/meteor/tests/unit/server/services/calendar/service.tests.ts @@ -37,7 +37,7 @@ const UsersMock = { const getUserPreferenceMock = sinon.stub(); const serviceMocks = { - '../../../app/settings/server': { settings: settingsMock }, + '../../settings': { settings: settingsMock }, '@rocket.chat/core-services': { api, ServiceClassInternal: class {}, @@ -45,7 +45,7 @@ const serviceMocks = { }, '@rocket.chat/cron': { cronJobs: cronJobsMock }, '@rocket.chat/models': { CalendarEvent: CalendarEventMock, Users: UsersMock }, - '../../../app/utils/server/lib/getUserPreference': { getUserPreference: getUserPreferenceMock }, + '../../lib/utils/lib/getUserPreference': { getUserPreference: getUserPreferenceMock }, '../../lib/i18n': { i18n: { t: sinon.stub().returns('Outlook: In a meeting') } }, }; diff --git a/apps/meteor/tests/unit/server/services/omnichannel-integrations/providers/twilio.spec.ts b/apps/meteor/tests/unit/server/services/omnichannel-integrations/providers/twilio.spec.ts index 6e72b9c30fa08..64e073e4d4064 100644 --- a/apps/meteor/tests/unit/server/services/omnichannel-integrations/providers/twilio.spec.ts +++ b/apps/meteor/tests/unit/server/services/omnichannel-integrations/providers/twilio.spec.ts @@ -14,8 +14,8 @@ const twilioStub = { }; const { Twilio } = proxyquire.noCallThru().load('../../../../../../server/services/omnichannel-integrations/providers/twilio.ts', { - '../../../../app/settings/server': { settings: settingsStub }, - '../../../../app/utils/server/restrictions': { fileUploadIsValidContentType: sinon.stub() }, + '../../../settings': { settings: settingsStub }, + '../../../lib/utils/restrictions': { fileUploadIsValidContentType: sinon.stub() }, '../../../lib/i18n': { i18n: sinon.stub() }, '../../../lib/logger/system': { SystemLogger: { error: sinon.stub() } }, }); diff --git a/apps/meteor/tests/unit/server/services/omnichannel/queue.tests.ts b/apps/meteor/tests/unit/server/services/omnichannel/queue.tests.ts index 896e27cb7fd15..52bcf540c2a4b 100644 --- a/apps/meteor/tests/unit/server/services/omnichannel/queue.tests.ts +++ b/apps/meteor/tests/unit/server/services/omnichannel/queue.tests.ts @@ -43,17 +43,17 @@ const license = { }; const { OmnichannelQueue } = p.noCallThru().load('../../../../../server/services/omnichannel/queue', { - '../../../app/livechat/server/lib/Helper': { + '../../lib/omnichannel/Helper': { dispatchAgentDelegated, }, - '../../../app/livechat/server/lib/RoutingManager': { + '../../lib/omnichannel/RoutingManager': { RoutingManager: { getConfig, delegateInquiry, }, }, - '../../../app/livechat/server/lib/settings': libSettings, - '../../../app/settings/server': { settings }, + '../../lib/omnichannel/settings': libSettings, + '../../settings': { settings }, './logger': { queueLogger }, '@rocket.chat/models': models, '@rocket.chat/license': { License: license }, diff --git a/apps/meteor/tests/unit/server/services/team/service.tests.ts b/apps/meteor/tests/unit/server/services/team/service.tests.ts index 101f3f9620308..8417e846a5b67 100644 --- a/apps/meteor/tests/unit/server/services/team/service.tests.ts +++ b/apps/meteor/tests/unit/server/services/team/service.tests.ts @@ -31,10 +31,10 @@ const { TeamService } = proxyquire.noCallThru().load('../../../../../server/serv '@rocket.chat/string-helpers': { escapeRegExp: (value: string) => value, }, - '../../../app/channel-settings/server': { + '../../lib/rooms/settings': { saveRoomName: sinon.stub(), }, - '../../../app/channel-settings/server/functions/saveRoomType': { + '../../lib/rooms/settings/saveRoomType': { saveRoomType: sinon.stub(), }, '../../lib/rooms/addUserToRoom': { @@ -49,11 +49,11 @@ const { TeamService } = proxyquire.noCallThru().load('../../../../../server/serv '../../lib/rooms/removeUserFromRoom': { removeUserFromRoom: sinon.stub(), }, - '../../../app/lib/server/lib/notifyListener': { + '../../lib/notifyListener': { notifyOnSubscriptionChangedByRoomIdAndUserId: sinon.stub(), notifyOnRoomChangedById: sinon.stub(), }, - '../../../app/settings/server': { + '../../settings': { settings: { get: sinon.stub() }, }, }); diff --git a/apps/meteor/tests/unit/app/settings/server/functions/compareSettingsMetadata.tests.ts b/apps/meteor/tests/unit/server/settings/functions/compareSettingsMetadata.tests.ts similarity index 77% rename from apps/meteor/tests/unit/app/settings/server/functions/compareSettingsMetadata.tests.ts rename to apps/meteor/tests/unit/server/settings/functions/compareSettingsMetadata.tests.ts index e06249a8e7f8b..d8d846efb6467 100644 --- a/apps/meteor/tests/unit/app/settings/server/functions/compareSettingsMetadata.tests.ts +++ b/apps/meteor/tests/unit/server/settings/functions/compareSettingsMetadata.tests.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; -import { compareSettings } from '../../../../../../app/settings/server/SettingsRegistry'; -import { getSettingDefaults } from '../../../../../../app/settings/server/functions/getSettingDefaults'; +import { compareSettings } from '../../../../../server/settings/SettingsRegistry'; +import { getSettingDefaults } from '../../../../../server/settings/functions/getSettingDefaults'; const testSetting = getSettingDefaults({ _id: 'my_dummy_setting', diff --git a/apps/meteor/tests/unit/app/settings/server/functions/getSettingDefaults.tests.ts b/apps/meteor/tests/unit/server/settings/functions/getSettingDefaults.tests.ts similarity index 96% rename from apps/meteor/tests/unit/app/settings/server/functions/getSettingDefaults.tests.ts rename to apps/meteor/tests/unit/server/settings/functions/getSettingDefaults.tests.ts index f2a7c2a6a1711..00a0a8df5b545 100644 --- a/apps/meteor/tests/unit/app/settings/server/functions/getSettingDefaults.tests.ts +++ b/apps/meteor/tests/unit/server/settings/functions/getSettingDefaults.tests.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { getSettingDefaults } from '../../../../../../app/settings/server/functions/getSettingDefaults'; +import { getSettingDefaults } from '../../../../../server/settings/functions/getSettingDefaults'; describe('getSettingDefaults', () => { it('should return based on _id type value', () => { diff --git a/apps/meteor/tests/unit/app/settings/server/functions/overrideGenerator.tests.ts b/apps/meteor/tests/unit/server/settings/functions/overrideGenerator.tests.ts similarity index 88% rename from apps/meteor/tests/unit/app/settings/server/functions/overrideGenerator.tests.ts rename to apps/meteor/tests/unit/server/settings/functions/overrideGenerator.tests.ts index f50f5d966c24c..e88585980c5e5 100644 --- a/apps/meteor/tests/unit/app/settings/server/functions/overrideGenerator.tests.ts +++ b/apps/meteor/tests/unit/server/settings/functions/overrideGenerator.tests.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; -import { getSettingDefaults } from '../../../../../../app/settings/server/functions/getSettingDefaults'; -import { overrideGenerator } from '../../../../../../app/settings/server/functions/overrideGenerator'; +import { getSettingDefaults } from '../../../../../server/settings/functions/getSettingDefaults'; +import { overrideGenerator } from '../../../../../server/settings/functions/overrideGenerator'; describe('overrideGenerator', () => { it('should return a new object with the new value', () => { diff --git a/apps/meteor/tests/unit/app/settings/server/functions/settings.tests.ts b/apps/meteor/tests/unit/server/settings/functions/settings.tests.ts similarity index 98% rename from apps/meteor/tests/unit/app/settings/server/functions/settings.tests.ts rename to apps/meteor/tests/unit/server/settings/functions/settings.tests.ts index 8df6b4d4fdd20..0c0808085b33d 100644 --- a/apps/meteor/tests/unit/app/settings/server/functions/settings.tests.ts +++ b/apps/meteor/tests/unit/server/settings/functions/settings.tests.ts @@ -1,10 +1,10 @@ import { expect, spy } from 'chai'; import { beforeEach, describe, it } from 'mocha'; -import { CachedSettings } from '../../../../../../app/settings/server/CachedSettings'; -import { SettingsRegistry } from '../../../../../../app/settings/server/SettingsRegistry'; -import { getSettingDefaults } from '../../../../../../app/settings/server/functions/getSettingDefaults'; -import { Settings } from '../../../../../../app/settings/server/functions/settings.mocks'; +import { CachedSettings } from '../../../../../server/settings/CachedSettings'; +import { SettingsRegistry } from '../../../../../server/settings/SettingsRegistry'; +import { getSettingDefaults } from '../../../../../server/settings/functions/getSettingDefaults'; +import { Settings } from '../../../../../server/settings/functions/settings.mocks'; const testSetting = getSettingDefaults({ _id: 'my_dummy_setting', diff --git a/apps/meteor/tests/unit/app/settings/server/functions/validateSettings.tests.ts b/apps/meteor/tests/unit/server/settings/functions/validateSettings.tests.ts similarity index 93% rename from apps/meteor/tests/unit/app/settings/server/functions/validateSettings.tests.ts rename to apps/meteor/tests/unit/server/settings/functions/validateSettings.tests.ts index 7f147074f533c..8f4856a0631f7 100644 --- a/apps/meteor/tests/unit/app/settings/server/functions/validateSettings.tests.ts +++ b/apps/meteor/tests/unit/server/settings/functions/validateSettings.tests.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { validateSetting } from '../../../../../../app/settings/server/functions/validateSetting'; +import { validateSetting } from '../../../../../server/settings/functions/validateSetting'; describe('validateSettings', () => { it('should validate the type string', () => { diff --git a/apps/meteor/tests/unit/server/startup/initialData.tests.ts b/apps/meteor/tests/unit/server/startup/initialData.tests.ts index 74c71571a949c..5e98070574bb0 100644 --- a/apps/meteor/tests/unit/server/startup/initialData.tests.ts +++ b/apps/meteor/tests/unit/server/startup/initialData.tests.ts @@ -32,12 +32,11 @@ const { insertAdminUserFromEnv } = proxyquire.noCallThru().load('../../../../ser }, }, '../lib/media/file-upload': {}, - '../../app/file/server': {}, '../lib/rooms/addUserToDefaultChannels': {}, '../lib/users/checkUsernameAvailability': { checkUsernameAvailability, }, - '../../app/settings/server': { + '../settings': { settings: { get: settingsGet }, }, '@rocket.chat/tools': { diff --git a/docs/backend-folder-structure.md b/docs/backend-folder-structure.md new file mode 100644 index 0000000000000..f12baab82b995 --- /dev/null +++ b/docs/backend-folder-structure.md @@ -0,0 +1,123 @@ +# Backend Folder Structure + +This document describes how the server-side code of the main app (`apps/meteor/`) is organized, what each folder is responsible for, and — most importantly — **how to decide where new code goes**. It replaces the migration plan that drove the 2026 restructure (PRs #40259, #41115, #41126, #41155, #41225, #41315, #41381), which moved everything out of the old `app/*/server/` feature folders. + +## The organizing principle + +``` +server/// +``` + +Code is grouped **by responsibility first** (what *kind* of code it is: an API endpoint, a hook, a domain function, a Meteor method) **and by domain second** (what *feature area* it belongs to: rooms, users, messages, omnichannel…). This is the opposite of the old layout, which grouped by feature first (`app/livechat/server/…`) and made responsibilities (methods, hooks, API, lib) repeat inside every feature. + +Practical consequence: when you look for code, ask "what kind of thing is it?" before "what feature is it for?". A livechat REST endpoint is in `server/api/v1/omnichannel/`, a livechat hook in `server/hooks/omnichannel/`, a livechat domain function in `server/lib/omnichannel/`. + +## Top-level map of `apps/meteor/` + +| Path | What it is | +| ----------- | ---------- | +| `server/` | **All community server code.** Described in detail below. | +| `ee/server/` | Enterprise server code — an exact mirror of `server/`'s responsibility layout. See [License boundary](#the-license-boundary-ee). | +| `client/`, `ee/client/` | Frontend (React) code. | +| `app/` | **Legacy remnant, do not add server code here.** What's left is genuinely shared client+server code (`app/*/lib/`), client-only feature code (`app/*/client/`), and `app/apps/server/` (Apps-Engine bridges/converters, kept intentionally). | +| `lib/` | Small utilities shared between client and server (isomorphic, no Meteor/server imports). | +| `imports/` | Legacy Meteor-style feature folders (`personal-access-tokens`, message-read-receipt client parts). Avoid adding to it. | +| `packages/` (repo root) | Workspace packages (`@rocket.chat/*`). Cross-app logic, typings (`core-typings`, `rest-typings`), and services SDK (`core-services`) live here — prefer a package when code must be shared beyond `apps/meteor`. | +| `tests/` | Test suites — see [Tests](#tests). | + +## Inside `server/` + +### Entry points + +- `main.ts` — the server entry point. Import order here matters (models → settings definitions → startup → `importPackages` → methods → publications). +- `importPackages.ts` — the big list of side-effect imports that load every feature at startup. If you create a module that must run at boot and nothing imports it, register it here (or in the closer aggregator: `meteor-methods/index.ts`, `startup/index.ts`). +- `models.ts` — registers the MongoDB model classes from `@rocket.chat/models`. + +### Responsibility folders + +| Folder | Responsibility | Domain layout | +| ------ | -------------- | ------------- | +| `api/` | REST API. `ApiClass.ts`/`router.ts` are the Hono-based framework, `v1/` holds one file per endpoint group (`users.ts`, `chat.ts`, …), `v1/omnichannel/` the livechat endpoints, `v1/middlewares/` auth/cors/metrics, `lib/` request helpers, `validation/` the ajv setup, `webhooks.ts` the `/hooks/*` incoming-webhook API. Endpoint payload types live in `packages/rest-typings`. | +| `services/` | Internal services registered on the `@rocket.chat/core-services` broker (one folder per service: `room/`, `team/`, `omnichannel/`, `federation/`, …). Callable cross-process in microservices deployments. **Preferred home for new business logic** — see the decision guide. | +| `lib/` | Everything that is a plain function/class library: domain functions and shared server utilities. See [`server/lib/` domains](#serverlib-domains). | +| `hooks/` | Event handlers registered on the `callbacks` system (`callbacks.add('afterSaveMessage', …)`). Domain subfolders: `messages/`, `rooms/`, `auth/`, `omnichannel/`; a few cross-cutting ones sit flat (`afterUserActions.ts`, `sauMonitorHooks.ts`). A hook file only registers listeners — real logic should live in `lib/` or `services/` and be called from the hook. | +| `meteor-methods/` | **Deprecated.** Meteor DDP RPC handlers, kept only for backward compatibility with existing clients. Domain subfolders (`users/`, `rooms/`, `messages/`, `auth/`, `omnichannel/`, `settings/`, `platform/`, `media/`, `import/`, `integrations/`). Registration happens via side-effect import from `meteor-methods/index.ts` — a method file that nobody imports **silently stops existing** (lint/tsc/tests all stay green), so never remove an import without removing the method. Do not add new methods; add a REST endpoint instead. | +| `publications/` | **Deprecated.** Meteor DDP publications. Same story as methods: don't add, use REST + streams. | +| `settings/` | The settings system. `index.ts` is the **registry barrel** (`settings`, `settingsRegistry` — what everything imports); `definitions.ts` loads the per-domain setting definition files (`accounts.ts`, `email.ts`, `omnichannel.ts`, …) that call `settingsRegistry.addGroup(...)`; `theme/` is the theme compiler; `lib/` settings-specific helpers. New setting? Add it to the matching definitions file, not to the registry. | +| `slashcommands/` | One file per slash command (`ban.ts`, `invite.ts`, …). | +| `bridges/` | Adapters to external systems: `irc/`, `slack/` (slackbridge), `smarsh/`, `webdav/`, `nextcloud/`. Leaf code — imports the core, nothing imports it. | +| `cron/` | Scheduled jobs. | +| `startup/` | Boot-time configuration and one-off initialization (`initialData.ts`, `rateLimiter.js`, `robots.js`, `migrations/`). | +| `routes/` | Non-REST HTTP routes (avatar serving, etc.). | +| `database/` | Mongo connection utilities (`trash`, `readSecondaryPreferred`, transaction helpers). | +| `modules/` | Larger self-contained subsystems (core-apps, listeners, notifications, streamer). | +| `features/` | Feature-flag style subsystems (e.g. `EmailInbox/`). | +| `configuration/` | Runtime configuration glue (OAuth, CAS, LDAP wiring). | +| `email/`, `ufs/`, `oauth2-server/`, `deasync/` | Infrastructure kept as-is: mailer transport, Upload-File-System storage engine, OAuth2 provider implementation, deasync shim. | + +### `server/lib/` domains + +`lib/` is the largest folder. Its immediate children are **domains** (plus a handful of flat cross-cutting utilities like `callbacks.ts`, `i18n.ts`, `notifyListener.ts`, `RateLimiter.js`, `debug.js`, `bugsnag.ts`, `deprecationWarningLogger.ts`, `validateEmailDomain.js`, `defaultBlockedDomainsList.ts`). + +| Domain | Contents | +| ------ | -------- | +| `users/` | User domain functions: `deleteUser`, `setRealName`, `saveUserIdentity`, `getFullUserData`, availability checks, `status/` (custom user status)… | +| `rooms/` | Room domain functions: `createRoom`, `deleteRoom`, `addUserToRoom`, `roomCoordinator`, plus `settings/` (save-room-* functions), `invites/`, `retention/` (retention-policy cron). | +| `messages/` | Message domain functions: `sendMessage`, `insertMessage`, `deleteMessage`, `updateMessage`, `loadMessageHistory`… | +| `messaging/` | Messaging *features* around messages: `threads/`, `discussions/`, `reactions/`, `pins/`, `stars/`, `unread/`, `mentions/`, `markdown/`, `emoji`, `msgStream`, `Message.ts` (formatting), `getHiddenSystemMessages`, `validateCustomMessageFields`. Rule of thumb: `messages/` = lifecycle of a message document; `messaging/` = features built on top of messages. | +| `omnichannel/` | The livechat/omnichannel engine: `QueueManager`, `RoutingManager` (+ `routing/` strategies), `business-hour/`, `contacts/`, `analytics/`, transcripts, visitors, guests, departments… The biggest domain. | +| `authorization/` | Permission/role checks: `hasPermission`, `canAccessRoom`, `getRoles`, `constant/permissions.ts` (the permission list), `streamer/` (permission change notifications). | +| `auth/` | Authentication utilities: `passwordPolicy`, `generatePassword`, login attempt logging/restriction, `oauth2-server/` (OAuth app admin), `token-login`. | +| `auth-providers/` | One folder/file per external login provider: `apple/`, `crowd/`, `custom-oauth/`, `oauth/` (core OAuth glue), `github.ts`, `gitlab.ts`, `google.js`, `wordpress.ts`, … | +| `saml/`, `cas/`, `ldap/`, `2fa/`, `e2e/` | Protocol-specific auth/crypto subsystems. | +| `notifications/` | Notification delivery: `push/`, `push-config/`, `email/` (Mailer API), `mail-messages/`, `queue/`, `core/` (Notifications streams), `message/` (per-message desktop/email/mobile decision helpers), direct-reply email processing. | +| `media/` | Files and media: `file-upload/` (FileUpload + storage configs), `file/`, `emoji-custom/`, `emoji-native/`, `custom-sounds/`, `assets/`. | +| `import/` | Importer framework (`classes/`, converters) + one folder per importer (`csv/`, `slack/`, `slack-users/`, `omnichannel-contacts/`, `pending-avatars/`, `pending-files/`). | +| `integrations/` | Incoming/outgoing webhook integrations engine (the REST surface is `server/api/webhooks.ts`). | +| `cloud/` | Rocket.Chat Cloud connectivity, `version-check/`, license sync. | +| `search/`, `autotranslate/`, `statistics/`, `metrics/`, `moderation/`, `dataExport/`, `oauth/`, `roles/`, `bot-helpers/`, `cors/`, `error-handler/`, `ui-master/` | Smaller single-purpose domains, named after what they do. | +| `utils/` | Generic server utilities without a domain (`getURL`, `slashCommand` registry, `restrictions`, JWT helper, timezone…). If a function clearly belongs to a domain above, it does **not** go here. | +| `shared/` | Tiny validators shared across domains (`validateName`, `validateNameChars`…). | + +## The EE tree (`ee/server/`) and the license boundary + +`ee/server/` mirrors the same responsibility layout: `api/`, `hooks/`, `lib/` (with `omnichannel/`, `license/`, `ldap/`, `canned-responses/`, `abac/`, `audit/`, …), `meteor-methods/`, `settings/`, `cron/`, `models/`, `patches/`, `startup/`, `configuration/`, and `local-services/` (EE internal services — note: `ee/server/services/` is docker/build scaffolding for the microservices images, **not** a code folder). + +**The directory boundary is the license boundary.** Code under an `ee/` path is governed by the Enterprise license (`apps/meteor/ee/LICENSE`); everything else is community-licensed: + +- Never move a file across the `ee/` boundary in either direction — that silently relicenses it. +- Imports may cross the boundary (community code imports EE modules behind license checks and vice versa); files may not. +- EE features are gated at runtime via `License.onLicense(...)` / license modules — moving a file into `ee/` is not what gates it, but EE-licensed code must live there. +- Standalone EE workspaces (`ee/apps/*`, `ee/packages/*` at the repo root) and EE subtrees inside packages (`packages/*/src/ee/`) are separate from `apps/meteor/ee/`. + +## Where do I put new code? + +1. **A REST endpoint** → `server/api/v1/.ts` (omnichannel ones in `v1/omnichannel/`), payload schemas in `packages/rest-typings`. This is the default way to expose anything to clients. +2. **Business logic** → prefer a **service** in `server/services/` (registered via `@rocket.chat/core-services`) when the logic has a clear service boundary or must be callable cross-process. Plain **domain functions** in `server/lib//` are fine for logic tied to one domain that services and endpoints compose. Long-term direction: business logic trends toward `services/`; `lib//` is the pragmatic middle ground. +3. **Reacting to an event** ("when a message is saved…", "after a user logs in…") → `server/hooks//`. Keep the hook file thin; put the logic in `lib/`/`services/`. +4. **A Meteor method or publication** → don't. Both are deprecated; expose a REST endpoint (+ streamer event if clients need pushes). If you must touch an existing method, it lives in `server/meteor-methods//` and must stay imported by `meteor-methods/index.ts`. +5. **A setting** → the matching definitions file under `server/settings/`. +6. **A slash command** → `server/slashcommands/`. +7. **A scheduled job** → `server/cron/`. +8. **Startup-only wiring** → `server/startup/` (and an import in `main.ts`/`importPackages.ts` if nothing else loads it). +9. **Code shared with the frontend** → `apps/meteor/lib/` for app-local isomorphic helpers, or a `packages/*` package if shared beyond the app. Never import server code from client code. +10. **Enterprise-only** → same decision tree inside `ee/server/`, gated by license checks. +11. **A new domain?** If your code doesn't fit an existing `lib/` domain, create a new `server/lib//` folder rather than dropping files flat in `lib/` or stretching `utils/`. Name it after the business concept, not the implementing tech. + +Anti-patterns to avoid: + +- Adding server code under `app/` (the folder is frozen; only shared/client code remains there). +- Barrel `index.ts` files that just re-export — import the concrete file. (Existing barrels like `settings/index.ts` and `authorization/index.ts` are legacy API surfaces, kept until their consumers are rewritten.) +- Putting logic in a hook/method/endpoint file instead of `lib`/`services` — those files should be thin entry points. +- "Utility" dumping: if it has a domain, it goes in the domain. + +## Tests + +- **Co-located specs** (`server/**/**.spec.ts`) and **mirrored specs** (`tests/unit/server/**` mirrors the source tree; EE code is mirrored under `ee/tests/unit/**`) both exist. When you move source, move its mirror. +- Two runners with **separate globs**: mocha (`.mocharc.js` `spec` list) and jest (`jest.config.ts` `testMatch`). A spec in a folder not matched by any glob silently never runs; a jest spec caught by a mocha glob throws `jest is not defined`. +- `proxyquire`/`jest.mock` keys are **string literals matched against the loaded module's import specifiers** — lint and tsc cannot validate them. If you move a module, every mock key referencing it (or referencing its dependencies' specifiers) must be updated, and the affected suites actually run. A stale key silently loads the real dependency; if that dependency reaches `server/settings/index.ts`, the whole mocha run dies with a top-level-await transform error — that error is the signature of a stale settings mock. +- Specs must not depend on suite execution order (e.g. on another spec having installed a mocked core-services broker) — mock `@rocket.chat/core-services` locally. + +## History + +The structure above is the result of a 7-phase migration (finished 2026-07) that dissolved the old Meteor-package-style `app/*/server/` folders: slash commands (#40259), bridges (#41115), REST API (#41126), domain functions (#41155), meteor-methods (#41225), lib/hooks/feature code (#41315), omnichannel + final cleanup (#41381). Files were moved as-is, so `git log --follow` works across the moves. The old `app//server/` path of any file can be found in those PRs' manifests if needed. From 9db6a29634bc72c6d206082fcbd3df99ef6fb4e4 Mon Sep 17 00:00:00 2001 From: Kevin Aleman Date: Wed, 15 Jul 2026 14:40:49 -0600 Subject: [PATCH 143/220] test: update stale proxyquire mock paths breaking unit test CI (#41403) --- apps/meteor/server/lib/ldap/Connection.spec.ts | 2 +- .../tests/unit/server/lib/import/SlackImporter.spec.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/meteor/server/lib/ldap/Connection.spec.ts b/apps/meteor/server/lib/ldap/Connection.spec.ts index a3ef1c9f60021..4a6582230361b 100644 --- a/apps/meteor/server/lib/ldap/Connection.spec.ts +++ b/apps/meteor/server/lib/ldap/Connection.spec.ts @@ -6,7 +6,7 @@ import sinon from 'sinon'; const loggerStub = { debug: sinon.stub(), error: sinon.stub(), info: sinon.stub(), warn: sinon.stub() }; const { LDAPConnection } = proxyquire.noCallThru().load('./Connection', { - '../../../app/settings/server': { settings: { get: sinon.stub() } }, + '../../settings': { settings: { get: sinon.stub() } }, './getLDAPConditionalSetting': { getLDAPConditionalSetting: sinon.stub().returns('') }, './Logger': { logger: loggerStub, diff --git a/apps/meteor/tests/unit/server/lib/import/SlackImporter.spec.ts b/apps/meteor/tests/unit/server/lib/import/SlackImporter.spec.ts index 6064470e1aff3..5fd3c12fa8269 100644 --- a/apps/meteor/tests/unit/server/lib/import/SlackImporter.spec.ts +++ b/apps/meteor/tests/unit/server/lib/import/SlackImporter.spec.ts @@ -53,7 +53,7 @@ const { SlackImporter } = proxyquire.noCallThru().load('../../../../../server/li }, ImporterWebsocket: { progressUpdated: sinon.stub() }, }, - '../../../../app/lib/server/lib/notifyListener': { notifyOnSettingChanged: sinon.stub() }, + '../../notifyListener': { notifyOnSettingChanged: sinon.stub() }, '../../../../app/mentions/lib/MentionsParser': { MentionsParser: class { getUserMentions() { @@ -65,8 +65,8 @@ const { SlackImporter } = proxyquire.noCallThru().load('../../../../../server/li } }, }, - '../../../../app/settings/server': { settings: settingsStub }, - '../../../../app/utils/server/getUserAvatarURL': { getUserAvatarURL: sinon.stub().returns('/avatar/user') }, + '../../../settings': { settings: settingsStub }, + '../../utils/getUserAvatarURL': { getUserAvatarURL: sinon.stub().returns('/avatar/user') }, }); describe('SlackImporter', () => { From bfacbd39ced4c7708a331b24c36b6446ae1739f7 Mon Sep 17 00:00:00 2001 From: Yash Rajpal <58601732+yash-rajpal@users.noreply.github.com> Date: Thu, 16 Jul 2026 01:36:12 +0530 Subject: [PATCH 144/220] chore: Permissions translations in title case (#41380) --- packages/i18n/src/locales/en.i18n.json | 72 +++++++++++++------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/packages/i18n/src/locales/en.i18n.json b/packages/i18n/src/locales/en.i18n.json index 4d8bb8bf8c7b7..1166d1357199f 100644 --- a/packages/i18n/src/locales/en.i18n.json +++ b/packages/i18n/src/locales/en.i18n.json @@ -101,14 +101,14 @@ "ABAC_Update_room_confirmation_modal_annotation": "Proceed with caution", "ABAC_Update_room_confirmation_modal_title": "Update ABAC room", "ABAC_Update_room_content": "{{roomName}} is currently ABAC-managed. Changes may alter who can access this room.", - "abac-management": "Manage ABAC configuration", - "manage-abac-admin-settings": "Manage ABAC settings", + "abac-management": "Manage ABAC Configuration", + "manage-abac-admin-settings": "Manage ABAC Settings", "manage-abac-admin-settings_description": "Permission to view and modify ABAC settings", - "manage-abac-admin-room-attributes": "Manage ABAC room attributes", + "manage-abac-admin-room-attributes": "Manage ABAC Room Attributes", "manage-abac-admin-room-attributes_description": "Permission to view, create, edit and delete ABAC attribute definitions", - "manage-abac-admin-rooms": "Manage ABAC rooms", + "manage-abac-admin-rooms": "Manage ABAC Rooms", "manage-abac-admin-rooms_description": "Permission to view rooms and assign or remove ABAC attributes on them", - "view-abac-admin-audit": "View ABAC audit log", + "view-abac-admin-audit": "View ABAC Audit Log", "view-abac-admin-audit_description": "Permission to view the ABAC audit log", "bypass-abac-store-validation": "Bypass ABAC store validation", "bypass-abac-store-validation_description": "Permission to save or edit ABAC attributes without validating them against the attribute store", @@ -2182,7 +2182,7 @@ "Export": "Export", "Export_Messages": "Export messages", "Export_My_Data": "Export My Data (JSON)", - "export-messages-as-pdf": "Export messages as PDF", + "export-messages-as-pdf": "Export Messages as PDF", "Export_most_recent_logs": "Export most recent logs", "Export_as_PDF": "Export as PDF", "Export_as_file": "Export as file", @@ -6168,7 +6168,7 @@ "Zoom_out": "Zoom out", "access-mailer": "Access Mailer Screen", "access-mailer_description": "Permission to send mass email to all users.", - "access-marketplace": "Access marketplace", + "access-marketplace": "Access Marketplace", "access-marketplace_description": "Permission to browse and get apps from the marketplace", "access-permissions": "Access Permissions Screen", "access-permissions_description": "Modify permissions for various roles.", @@ -6177,7 +6177,7 @@ "access-federation": "Access Federation", "access-federation_description": "Permission to access federation features, create and join federated rooms", "active": "active", - "add-all-to-room": "Add all users to a room", + "add-all-to-room": "Add All Users to a Room", "add-all-to-room_description": "Permission to add all users to a room", "add-livechat-department-agents": "Add Omnichannel Agents to Departments", "add-livechat-department-agents_description": "Permission to add omnichannel agents to departments", @@ -6202,7 +6202,7 @@ "admin-video-conf-provider-not-configured": "**Conference call not enabled**: Configure conference calls in order to make it available on this workspace.", "all": "all", "and": "and", - "api-bypass-rate-limit": "Bypass rate limit for REST API", + "api-bypass-rate-limit": "Bypass Rate Limit for REST API", "api-bypass-rate-limit_description": "Permission to call api without rate limitation", "archive-room": "Archive Room", "archive-room_description": "Permission to archive a channel", @@ -6224,14 +6224,14 @@ "Banned_Users": "Banned Users", "block-ip-device-management": "Block IP Device Management", "block-ip-device-management_description": "Permission to block an IP adress", - "block-livechat-contact": "Block Omnichannel contact channel", + "block-livechat-contact": "Block Omnichannel Contact Channel", "bold": "bold", "bot_request": "Bot request", "bulk-register-user": "Bulk Create Users", "bulk-register-user_description": "Permission to create users in bulk", "busy": "busy", "by": "by", - "bypass-time-limit-edit-and-delete": "Bypass time limit", + "bypass-time-limit-edit-and-delete": "Bypass Time Limit", "bypass-time-limit-edit-and-delete_description": "Permission to Bypass time limit for editing and deleting messages", "cache_cleared": "Cache cleared", "call-management": "Call Management", @@ -6250,7 +6250,7 @@ "clean-channel-history": "Clean Channel History", "clean-channel-history_description": "Permission to Clear the history from channels", "clear": "Clear", - "clear-oembed-cache": "Clear OEmbed cache", + "clear-oembed-cache": "Clear OEmbed Cache", "clear-oembed-cache_description": "Permission to clear OEmbed cache", "clear_cache_now": "Clear Cache Now", "clear_history": "Clear History", @@ -6274,15 +6274,15 @@ "create-d_description": "Permission to start direct messages", "create-invite-links": "Create Invite Links", "create-invite-links_description": "Permission to create invite links to channels", - "create-livechat-contact": "Create Omnichannel contacts", + "create-livechat-contact": "Create Omnichannel Contacts", "create-p": "Create Private Channels", "create-p_description": "Permission to create private channels", "create-personal-access-tokens": "Create Personal Access Tokens", "create-personal-access-tokens_description": "Permission to create Personal Access Tokens", "create-team": "Create Team", - "create-team-channel": "Create channel within team", + "create-team-channel": "Create Channel within Team", "create-team-channel_description": "Permission to create a channel in a team (Overrides global permission)", - "create-team-group": "Create group within team", + "create-team-group": "Create Group within Team", "create-team-group_description": "Permission to create a group in a team (Overrides global permission)", "create-team_description": "Permission to create teams", "create-user": "Create User", @@ -6301,9 +6301,9 @@ "delete-p": "Delete Private Channels", "delete-p_description": "Permission to delete private channels", "delete-team": "Delete Team", - "delete-team-channel": "Delete channel within team", + "delete-team-channel": "Delete Channel within Team", "delete-team-channel_description": "Permission to delete a channel in a team (when delete public channels is already granted)", - "delete-team-group": "Delete group within team", + "delete-team-group": "Delete Group within Team", "delete-team-group_description": "Permission to delete a group in a team (when delete groups is already granted)", "delete-team_description": "Permission to delete teams", "delete-user": "Delete User", @@ -6753,9 +6753,9 @@ "meteor_status_waiting": "You’re offline", "minute": "minute", "minutes": "minutes", - "mobile-upload-file": "Allow file upload on mobile devices", + "mobile-upload-file": "Allow File Upload on Mobile Devices", "mobile-upload-file_description": "Permission to allow file upload on mobile devices", - "move-room-to-team": "Move room within team", + "move-room-to-team": "Move Room within Team", "move-room-to-team_description": "Permission to add an existing room to a team", "multi": "multi", "multi_line": "multi line", @@ -6869,13 +6869,13 @@ "Outbound_message_upsell_description": "Send personalized outbound messages on WhatsApp and other channels — ideal for reminders, alerts and follow-ups.", "Outbound_message_upsell_annotation": "Contact your workspace admin to enable outbound chat", "Outbound_message_upsell_alt": "Illustration of a smartphone receiving a new message notification.", - "outbound.send-messages": "Send outbound messages", + "outbound.send-messages": "Send Outbound Messages", "outbound.send-messages_description": "Permission to send outbound messages", - "outbound.can-assign-queues": "Can assign departments to receive outbound messages responses", + "outbound.can-assign-queues": "Can Assign Departments to Receive Outbound Messages Responses", "outbound.can-assign-queues_description": "Permission to assign departments to receive outbound messages responses", - "outbound.can-assign-any-agent": "Can assign any agent to receive outbound messages responses", + "outbound.can-assign-any-agent": "Can Assign Any Agent to Receive Outbound Messages Responses", "outbound.can-assign-any-agent_description": "Permission to assign any agent to receive outbound messages responses", - "outbound.can-assign-self-only": "Can assign self only to receive outbound messages responses", + "outbound.can-assign-self-only": "Can Assign Self Only to Receive Outbound Messages Responses", "outbound.can-assign-self-only_description": "Permission to assign self only to receive outbound messages responses", "pdf_error_message": "Error generating PDF Transcript", "pdf_success_message": "PDF Transcript successfully generated", @@ -6968,7 +6968,7 @@ "requests": "requests", "required": "required", "reset-other-user-e2e-key": "Reset Other User E2E Key", - "restart-server": "Restart the server", + "restart-server": "Restart the Server", "restart-server_description": "Permission to restart the server", "room_account_deactivated": "This account is deactivated", "room_allowed_reacting": "Room allowed reacting by {{user_by}}", @@ -7049,12 +7049,12 @@ "subscription.callout.roomsPerGuest": "max guest per room", "subscription.callout.servicesDisruptionsMayOccur": "Services disruptions may occur", "subscription.callout.servicesDisruptionsOccurring": "Services disruptions occurring", - "sync-auth-services-users": "Sync authentication services' users", + "sync-auth-services-users": "Sync Authentication Services' Users", "sync-auth-services-users_description": "Permission to sync authentication services' users", "system_message": "system message", - "test-admin-options": "Test options on admin panel", + "test-admin-options": "Test Options on Admin Panel", "test-admin-options_description": "Permission to test options on admin panel such as LDAP login.", - "test-push-notifications": "Test push notifications", + "test-push-notifications": "Test Push Notifications", "test-push-notifications_description": "Permission to test push notifications", "theme-color-attention-color": "Attention Color", "theme-color-component-color": "Component Color", @@ -7134,13 +7134,13 @@ "unarchive-room": "Unarchive Room", "unarchive-room_description": "Permission to unarchive channels", "unauthorized": "Not authorized", - "unblock-livechat-contact": "Unblock Omnichannel contact channel", + "unblock-livechat-contact": "Unblock Omnichannel Contact Channel", "unpinning-not-allowed": "Unpinning is not allowed", "unread_messages_counter": { "one": "{{count}} unread message", "other": "{{count}} unread messages" }, - "update-livechat-contact": "Update Omnichannel contacts", + "update-livechat-contact": "Update Omnichannel Contacts", "used_limit": "{{used, number}} / {{limit, number}}", "used_limit_infinite": "{{used, number}} / ∞", "user-generate-access-token": "User Generate Access Token", @@ -7159,7 +7159,7 @@ "video_direct_started": "_Started a call._", "video_livechat_missed": "_Started a video call that wasn't answered._", "video_livechat_started": "_Started a video call._", - "videoconf-ring-users": "Ring other users when calling", + "videoconf-ring-users": "Ring Other Users When Calling", "videoconf-ring-users_description": "Permission to ring other users when calling", "view-agent-canned-responses": "View Agent Canned Responses", "view-agent-canned-responses_description": "Permission to view agent canned responses", @@ -7199,8 +7199,8 @@ "view-livechat-appearance_description": "Permission to view live chat appearance", "view-livechat-business-hours": "View Omnichannel Business-Hours", "view-livechat-business-hours_description": "Permission to view live chat business hours", - "view-livechat-contact": "View Omnichannel contacts", - "view-livechat-contact-history": "View Omnichannel contacts history", + "view-livechat-contact": "View Omnichannel Contacts", + "view-livechat-contact-history": "View Omnichannel Contacts History", "view-livechat-customfields": "View Omnichannel Custom Fields", "view-livechat-customfields_description": "Permission to view Omnichannel custom fields", "view-livechat-departments": "View Omnichannel Departments", @@ -7215,13 +7215,13 @@ "view-livechat-queue": "View Omnichannel Queue", "view-livechat-queue_description": "Permission to view Omnichannel queue", "view-livechat-real-time-monitoring": "View Omnichannel Real-time Monitoring", - "view-livechat-room-closed-by-another-agent": "View Omnichannel Rooms closed by another agent", + "view-livechat-room-closed-by-another-agent": "View Omnichannel Rooms Closed by Another Agent", "view-livechat-room-closed-by-another-agent_description": "Permission to view live chat rooms closed by another agent", - "view-livechat-room-closed-same-department": "View Omnichannel Rooms closed by another agent in the same department", + "view-livechat-room-closed-same-department": "View Omnichannel Rooms Closed by Another Agent in the Same Department", "view-livechat-room-closed-same-department_description": "Permission to view live chat rooms closed by another agent in the same department", "view-livechat-room-customfields": "View Omnichannel Room Custom Fields", "view-livechat-room-customfields_description": "Permission to view live chat room custom fields", - "view-livechat-rooms": "View all omnichannel rooms", + "view-livechat-rooms": "View All Omnichannel Rooms", "view-livechat-rooms_description": "Permission to view other Omnichannel rooms", "view-livechat-triggers": "View Omnichannel Triggers", "view-livechat-triggers_description": "Permission to view live chat triggers", @@ -7230,7 +7230,7 @@ "view-livechat-webhooks_description": "Permission to view live chat webhooks", "view-logs": "View Logs", "view-logs_description": "Permission to view the server logs ", - "view-members-list-all-rooms": "Can view members in all rooms", + "view-members-list-all-rooms": "Can View Members in All Rooms", "view-members-list-all-rooms_description": "Gives the ability to see the members list in all rooms, even those the user is not part of", "view-moderation-console": "View Moderation Console", "view-moderation-console_description": "Permission to view moderation console of the server", From 77201560028b4dc627457db6d79fc2a0023e1c6a Mon Sep 17 00:00:00 2001 From: Tasso Evangelista Date: Wed, 15 Jul 2026 22:43:47 -0300 Subject: [PATCH 145/220] chore(eslint): Replace eslint-plugin-import with eslint-plugin-import-x (#41401) --- apps/meteor/.scripts/run-ha.ts | 2 +- apps/meteor/.scripts/version.js | 2 +- apps/meteor/app/utils/client/getURL.ts | 2 +- apps/meteor/app/utils/lib/getURL.ts | 4 +- .../GenericUpsellModal.spec.tsx | 1 - apps/meteor/client/definitions/global.d.ts | 2 - apps/meteor/client/meteor/login/facebook.ts | 4 +- apps/meteor/client/meteor/login/google.ts | 4 +- .../meteor/login/meteorDeveloperAccount.ts | 4 +- apps/meteor/client/meteor/login/twitter.ts | 4 +- .../ABACAttributesTab/AttributesForm.spec.tsx | 1 - .../channels/useChannelsList.ts | 1 - .../messages/useMessageOrigins.ts | 1 - .../messages/useMessagesSent.ts | 1 - .../messages/useTopFivePopularChannels.ts | 1 - .../users/useActiveUsers.ts | 1 - .../users/useUsersByTimeOfTheDay.ts | 1 - .../EnterE2EPasswordModal.spec.tsx | 1 - .../sidebar/RoomList/SidebarItemWithData.tsx | 1 - .../steps/MessageStep.spec.tsx | 1 - .../steps/RecipientStep.spec.tsx | 1 - .../steps/RepliesStep.spec.tsx | 1 - .../ee/server/cron/readReceiptsArchive.ts | 10 +- .../lib/omnichannel/debounceByParams.ts | 5 +- apps/meteor/server/api/ApiClass.ts | 4 +- apps/meteor/server/api/lib/isValidQuery.ts | 1 - .../server/bridges/slack/slackbridge.ts | 2 +- .../error-handler/RocketChat.ErrorHandler.ts | 1 - apps/meteor/server/lib/i18n.ts | 2 +- .../lib/media/file-upload/lib/FileUpload.ts | 5 +- .../server/lib/messages/isTheLastMessage.ts | 1 - .../server/lib/rooms/updateGroupDMsName.ts | 1 - apps/meteor/server/lib/utils/getURL.ts | 2 +- .../server/services/import/service.spec.ts | 2 +- .../services/omnichannel-analytics/service.ts | 1 - .../server/settings/SettingsRegistry.ts | 1 - .../settings/functions/settings.mocks.ts | 8 +- apps/meteor/server/settings/startup.ts | 1 - apps/meteor/server/ufs/ufs-server.ts | 1 - apps/meteor/server/ufs/ufs-store.ts | 1 - .../e2e-encryption/e2ee-legacy-format.spec.ts | 2 +- apps/meteor/tests/e2e/page-objects/login.ts | 2 +- .../omnichannel-analytics/AgentData.tests.ts | 2 +- ee/apps/omnichannel-transcript/src/i18n.ts | 2 +- ee/packages/license/src/licenseImp.ts | 1 - eslint.config.mjs | 12 +- package.json | 1 - packages/apps/node-runtime/src/lib/require.ts | 2 +- packages/cas-validate/src/validate.ts | 5 +- packages/ddp-client/src/types/methods.ts | 1 - packages/eslint-config/index.js | 48 +- packages/eslint-config/package.json | 2 +- .../src/MockedAppRootBuilder.tsx | 1 - packages/ui-client/src/methods.d.ts | 1 - yarn.lock | 435 ++++++++++++------ 55 files changed, 352 insertions(+), 255 deletions(-) diff --git a/apps/meteor/.scripts/run-ha.ts b/apps/meteor/.scripts/run-ha.ts index a1a3775000690..2b53a960d7c06 100644 --- a/apps/meteor/.scripts/run-ha.ts +++ b/apps/meteor/.scripts/run-ha.ts @@ -56,7 +56,7 @@ async function runMain(config: IConfig): Promise { async function runInstance(config: IConfig): Promise { // Desctructuring the unused variables allows us to omit them in the `mainConfig` - // eslint-disable-next-line @typescript-eslint/no-unused-vars + const { customEnv, parentEnv, ...mainConfig } = config; const env = { diff --git a/apps/meteor/.scripts/version.js b/apps/meteor/.scripts/version.js index 9ad130f449f4f..d33237361fbc1 100644 --- a/apps/meteor/.scripts/version.js +++ b/apps/meteor/.scripts/version.js @@ -3,7 +3,7 @@ const path = require('path'); let pkgJson = {}; try { - // eslint-disable-next-line import/no-dynamic-require + // eslint-disable-next-line import-x/no-dynamic-require pkgJson = require(path.resolve(process.cwd(), './package.json')); } catch (err) { console.error('no root package.json found'); diff --git a/apps/meteor/app/utils/client/getURL.ts b/apps/meteor/app/utils/client/getURL.ts index 0a292e6009589..2c50225e0da53 100644 --- a/apps/meteor/app/utils/client/getURL.ts +++ b/apps/meteor/app/utils/client/getURL.ts @@ -3,7 +3,7 @@ import { getURLWithoutSettings } from '../lib/getURL'; import { Info } from '../rocketchat.info'; export const getURL = function ( - path: string, // eslint-disable-next-line @typescript-eslint/naming-convention + path: string, params: { cdn?: boolean; full?: boolean; diff --git a/apps/meteor/app/utils/lib/getURL.ts b/apps/meteor/app/utils/lib/getURL.ts index ed510767311da..5cbf9f2d670ca 100644 --- a/apps/meteor/app/utils/lib/getURL.ts +++ b/apps/meteor/app/utils/lib/getURL.ts @@ -37,7 +37,7 @@ function getCloudUrl( export const _getURL = ( path: string, - // eslint-disable-next-line @typescript-eslint/naming-convention + { cdn, full, cloud, cloud_route, cloud_params, _cdn_prefix, _root_url_path_prefix, _site_url }: Record, deeplinkUrl?: string, ): string => { @@ -76,7 +76,7 @@ export const _getURL = ( export const getURLWithoutSettings = ( path: string, - // eslint-disable-next-line @typescript-eslint/naming-convention + { cdn = true, full = false, diff --git a/apps/meteor/client/components/GenericUpsellModal/GenericUpsellModal.spec.tsx b/apps/meteor/client/components/GenericUpsellModal/GenericUpsellModal.spec.tsx index f9f944ce5bb39..431f092178153 100644 --- a/apps/meteor/client/components/GenericUpsellModal/GenericUpsellModal.spec.tsx +++ b/apps/meteor/client/components/GenericUpsellModal/GenericUpsellModal.spec.tsx @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/naming-convention */ import { mockAppRoot } from '@rocket.chat/mock-providers'; import { composeStories } from '@storybook/react'; import { render, screen } from '@testing-library/react'; diff --git a/apps/meteor/client/definitions/global.d.ts b/apps/meteor/client/definitions/global.d.ts index 3cefc38cc8362..1f1072ec6313b 100644 --- a/apps/meteor/client/definitions/global.d.ts +++ b/apps/meteor/client/definitions/global.d.ts @@ -1,7 +1,6 @@ import type { IRocketChatDesktop } from '@rocket.chat/desktop-api'; declare global { - // eslint-disable-next-line @typescript-eslint/naming-convention interface Window { RocketChatDesktop?: IRocketChatDesktop; @@ -70,7 +69,6 @@ declare global { addStream(stream: MediaStream): void; } - // eslint-disable-next-line @typescript-eslint/naming-convention interface MediaTrackConstraints { /** @deprecated */ mozMediaSource?: string; diff --git a/apps/meteor/client/meteor/login/facebook.ts b/apps/meteor/client/meteor/login/facebook.ts index f13b22daec289..1df40a81a9514 100644 --- a/apps/meteor/client/meteor/login/facebook.ts +++ b/apps/meteor/client/meteor/login/facebook.ts @@ -1,9 +1,9 @@ import type { FacebookOAuthConfiguration } from '@rocket.chat/core-typings'; import { Random } from '@rocket.chat/random'; -// eslint-disable-next-line import/no-duplicates +// eslint-disable-next-line import-x/no-duplicates import { Facebook } from 'meteor/facebook-oauth'; import { Meteor } from 'meteor/meteor'; -// eslint-disable-next-line import/no-duplicates +// eslint-disable-next-line import-x/no-duplicates import { OAuth } from 'meteor/oauth'; import { createOAuthTotpLoginMethod } from './oauth'; diff --git a/apps/meteor/client/meteor/login/google.ts b/apps/meteor/client/meteor/login/google.ts index 9eaf46ac40b44..07ba62359ea50 100644 --- a/apps/meteor/client/meteor/login/google.ts +++ b/apps/meteor/client/meteor/login/google.ts @@ -1,9 +1,9 @@ import { Random } from '@rocket.chat/random'; import { Accounts } from 'meteor/accounts-base'; -// eslint-disable-next-line import/no-duplicates +// eslint-disable-next-line import-x/no-duplicates import { Google } from 'meteor/google-oauth'; import { Meteor } from 'meteor/meteor'; -// eslint-disable-next-line import/no-duplicates +// eslint-disable-next-line import-x/no-duplicates import { OAuth } from 'meteor/oauth'; import { createOAuthTotpLoginMethod } from './oauth'; diff --git a/apps/meteor/client/meteor/login/meteorDeveloperAccount.ts b/apps/meteor/client/meteor/login/meteorDeveloperAccount.ts index 6f917d867f6c0..9a6038269c4b7 100644 --- a/apps/meteor/client/meteor/login/meteorDeveloperAccount.ts +++ b/apps/meteor/client/meteor/login/meteorDeveloperAccount.ts @@ -1,7 +1,7 @@ import { Meteor } from 'meteor/meteor'; -// eslint-disable-next-line import/no-duplicates +// eslint-disable-next-line import-x/no-duplicates import { MeteorDeveloperAccounts } from 'meteor/meteor-developer-oauth'; -// eslint-disable-next-line import/no-duplicates +// eslint-disable-next-line import-x/no-duplicates import { OAuth } from 'meteor/oauth'; import { Random } from 'meteor/random'; diff --git a/apps/meteor/client/meteor/login/twitter.ts b/apps/meteor/client/meteor/login/twitter.ts index 74ce14828c64e..1c6bba3203b70 100644 --- a/apps/meteor/client/meteor/login/twitter.ts +++ b/apps/meteor/client/meteor/login/twitter.ts @@ -1,9 +1,9 @@ import type { TwitterOAuthConfiguration } from '@rocket.chat/core-typings'; import { Random } from '@rocket.chat/random'; import { Meteor } from 'meteor/meteor'; -// eslint-disable-next-line import/no-duplicates +// eslint-disable-next-line import-x/no-duplicates import { OAuth } from 'meteor/oauth'; -// eslint-disable-next-line import/no-duplicates +// eslint-disable-next-line import-x/no-duplicates import { Twitter } from 'meteor/twitter-oauth'; import { createOAuthTotpLoginMethod } from './oauth'; diff --git a/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesForm.spec.tsx b/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesForm.spec.tsx index 84927e6427a5a..9b5f5de2f0573 100644 --- a/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesForm.spec.tsx +++ b/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesForm.spec.tsx @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/naming-convention */ import { mockAppRoot } from '@rocket.chat/mock-providers'; import { composeStories } from '@storybook/react'; import { render, screen, waitFor } from '@testing-library/react'; diff --git a/apps/meteor/client/views/admin/engagementDashboard/channels/useChannelsList.ts b/apps/meteor/client/views/admin/engagementDashboard/channels/useChannelsList.ts index c8e9c82e74698..4ba36195551f9 100644 --- a/apps/meteor/client/views/admin/engagementDashboard/channels/useChannelsList.ts +++ b/apps/meteor/client/views/admin/engagementDashboard/channels/useChannelsList.ts @@ -10,7 +10,6 @@ type UseChannelsListOptions = { count: number; }; -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type export const useChannelsList = ({ period, offset, count }: UseChannelsListOptions) => { const getChannelsList = useEndpoint('GET', '/v1/engagement-dashboard/channels/list'); diff --git a/apps/meteor/client/views/admin/engagementDashboard/messages/useMessageOrigins.ts b/apps/meteor/client/views/admin/engagementDashboard/messages/useMessageOrigins.ts index b451840427cd8..33cc6327476c9 100644 --- a/apps/meteor/client/views/admin/engagementDashboard/messages/useMessageOrigins.ts +++ b/apps/meteor/client/views/admin/engagementDashboard/messages/useMessageOrigins.ts @@ -6,7 +6,6 @@ import { getPeriodRange } from '../../../../components/dashboards/periods'; type UseMessageOriginsOptions = { period: Period['key'] }; -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type export const useMessageOrigins = ({ period }: UseMessageOriginsOptions) => { const getMessageOrigins = useEndpoint('GET', '/v1/engagement-dashboard/messages/origin'); diff --git a/apps/meteor/client/views/admin/engagementDashboard/messages/useMessagesSent.ts b/apps/meteor/client/views/admin/engagementDashboard/messages/useMessagesSent.ts index a8e3bfe8bed1c..92c7c8911f4f8 100644 --- a/apps/meteor/client/views/admin/engagementDashboard/messages/useMessagesSent.ts +++ b/apps/meteor/client/views/admin/engagementDashboard/messages/useMessagesSent.ts @@ -6,7 +6,6 @@ import { getPeriodRange } from '../../../../components/dashboards/periods'; type UseMessagesSentOptions = { period: Period['key']; utc: boolean }; -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type export const useMessagesSent = ({ period, utc }: UseMessagesSentOptions) => { const getMessagesSent = useEndpoint('GET', '/v1/engagement-dashboard/messages/messages-sent'); diff --git a/apps/meteor/client/views/admin/engagementDashboard/messages/useTopFivePopularChannels.ts b/apps/meteor/client/views/admin/engagementDashboard/messages/useTopFivePopularChannels.ts index bc6780a3e1270..9e4f8828b63e5 100644 --- a/apps/meteor/client/views/admin/engagementDashboard/messages/useTopFivePopularChannels.ts +++ b/apps/meteor/client/views/admin/engagementDashboard/messages/useTopFivePopularChannels.ts @@ -6,7 +6,6 @@ import { getPeriodRange } from '../../../../components/dashboards/periods'; type UseTopFivePopularChannelsOptions = { period: Period['key'] }; -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type export const useTopFivePopularChannels = ({ period }: UseTopFivePopularChannelsOptions) => { const getTopFivePopularChannels = useEndpoint('GET', '/v1/engagement-dashboard/messages/top-five-popular-channels'); diff --git a/apps/meteor/client/views/admin/engagementDashboard/users/useActiveUsers.ts b/apps/meteor/client/views/admin/engagementDashboard/users/useActiveUsers.ts index cb5c7d6939047..2c92ffc7456dd 100644 --- a/apps/meteor/client/views/admin/engagementDashboard/users/useActiveUsers.ts +++ b/apps/meteor/client/views/admin/engagementDashboard/users/useActiveUsers.ts @@ -5,7 +5,6 @@ import { getPeriodRange } from '../../../../components/dashboards/periods'; type UseActiveUsersOptions = { utc: boolean }; -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type export const useActiveUsers = ({ utc }: UseActiveUsersOptions) => { const getActiveUsers = useEndpoint('GET', '/v1/engagement-dashboard/users/active-users'); diff --git a/apps/meteor/client/views/admin/engagementDashboard/users/useUsersByTimeOfTheDay.ts b/apps/meteor/client/views/admin/engagementDashboard/users/useUsersByTimeOfTheDay.ts index 4118edce0f1cd..cb5f1b78cd895 100644 --- a/apps/meteor/client/views/admin/engagementDashboard/users/useUsersByTimeOfTheDay.ts +++ b/apps/meteor/client/views/admin/engagementDashboard/users/useUsersByTimeOfTheDay.ts @@ -6,7 +6,6 @@ import { getPeriodRange } from '../../../../components/dashboards/periods'; type UseUsersByTimeOfTheDayOptions = { period: Period['key']; utc: boolean }; -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type export const useUsersByTimeOfTheDay = ({ period, utc }: UseUsersByTimeOfTheDayOptions) => { const getUsersByTimeOfTheDay = useEndpoint('GET', '/v1/engagement-dashboard/users/users-by-time-of-the-day-in-a-week'); diff --git a/apps/meteor/client/views/e2e/EnterE2EPasswordModal/EnterE2EPasswordModal.spec.tsx b/apps/meteor/client/views/e2e/EnterE2EPasswordModal/EnterE2EPasswordModal.spec.tsx index 0eb37d9037ad0..1130500962d78 100644 --- a/apps/meteor/client/views/e2e/EnterE2EPasswordModal/EnterE2EPasswordModal.spec.tsx +++ b/apps/meteor/client/views/e2e/EnterE2EPasswordModal/EnterE2EPasswordModal.spec.tsx @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/naming-convention */ import { mockAppRoot } from '@rocket.chat/mock-providers'; import { composeStories } from '@storybook/react'; import { render, screen } from '@testing-library/react'; diff --git a/apps/meteor/client/views/navigation/sidebar/RoomList/SidebarItemWithData.tsx b/apps/meteor/client/views/navigation/sidebar/RoomList/SidebarItemWithData.tsx index 39ff4b678b081..1762fdebf0013 100644 --- a/apps/meteor/client/views/navigation/sidebar/RoomList/SidebarItemWithData.tsx +++ b/apps/meteor/client/views/navigation/sidebar/RoomList/SidebarItemWithData.tsx @@ -96,7 +96,6 @@ function safeDateNotEqualCheck(a: Date | string | undefined, b: Date | string | const keys: (keyof RoomListRowProps)[] = ['id', 'style', 't', 'videoConfActions']; -// eslint-disable-next-line react/no-multi-comp export default memo(SidebarItemWithData, (prevProps, nextProps) => { if (keys.some((key) => prevProps[key] !== nextProps[key])) { return false; diff --git a/apps/meteor/client/views/omnichannel/components/outboundMessage/components/OutboundMessageWizard/steps/MessageStep.spec.tsx b/apps/meteor/client/views/omnichannel/components/outboundMessage/components/OutboundMessageWizard/steps/MessageStep.spec.tsx index 95339ff897cfe..022ac3229dc04 100644 --- a/apps/meteor/client/views/omnichannel/components/outboundMessage/components/OutboundMessageWizard/steps/MessageStep.spec.tsx +++ b/apps/meteor/client/views/omnichannel/components/outboundMessage/components/OutboundMessageWizard/steps/MessageStep.spec.tsx @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/naming-convention */ import { mockAppRoot } from '@rocket.chat/mock-providers'; import { WizardContext, StepsLinkedList } from '@rocket.chat/ui-client'; import { composeStories } from '@storybook/react'; diff --git a/apps/meteor/client/views/omnichannel/components/outboundMessage/components/OutboundMessageWizard/steps/RecipientStep.spec.tsx b/apps/meteor/client/views/omnichannel/components/outboundMessage/components/OutboundMessageWizard/steps/RecipientStep.spec.tsx index 448a0f96dfc45..54e65e93f21d1 100644 --- a/apps/meteor/client/views/omnichannel/components/outboundMessage/components/OutboundMessageWizard/steps/RecipientStep.spec.tsx +++ b/apps/meteor/client/views/omnichannel/components/outboundMessage/components/OutboundMessageWizard/steps/RecipientStep.spec.tsx @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/naming-convention */ import { mockAppRoot } from '@rocket.chat/mock-providers'; import { WizardContext, StepsLinkedList } from '@rocket.chat/ui-client'; import { composeStories } from '@storybook/react'; diff --git a/apps/meteor/client/views/omnichannel/components/outboundMessage/components/OutboundMessageWizard/steps/RepliesStep.spec.tsx b/apps/meteor/client/views/omnichannel/components/outboundMessage/components/OutboundMessageWizard/steps/RepliesStep.spec.tsx index 382b766579ad1..f4b346c557c99 100644 --- a/apps/meteor/client/views/omnichannel/components/outboundMessage/components/OutboundMessageWizard/steps/RepliesStep.spec.tsx +++ b/apps/meteor/client/views/omnichannel/components/outboundMessage/components/OutboundMessageWizard/steps/RepliesStep.spec.tsx @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/naming-convention */ import { mockAppRoot } from '@rocket.chat/mock-providers'; import { WizardContext, StepsLinkedList } from '@rocket.chat/ui-client'; import { composeStories } from '@storybook/react'; diff --git a/apps/meteor/ee/server/cron/readReceiptsArchive.ts b/apps/meteor/ee/server/cron/readReceiptsArchive.ts index 716b223ed2e90..62ca0bbf6c3b4 100644 --- a/apps/meteor/ee/server/cron/readReceiptsArchive.ts +++ b/apps/meteor/ee/server/cron/readReceiptsArchive.ts @@ -21,13 +21,12 @@ export async function archiveOldReadReceipts(): Promise { let batchNumber = 0; let hasMore = true; - // eslint-disable-next-line no-await-in-loop while (hasMore) { batchNumber++; logger.info({ msg: 'Processing batch', batchNumber }); // Find receipts older than the retention period, limited by batch size - // eslint-disable-next-line no-await-in-loop + const oldReceipts = await ReadReceipts.findOlderThan(cutoffDate).limit(batchSize).toArray(); if (oldReceipts.length === 0) { @@ -43,7 +42,6 @@ export async function archiveOldReadReceipts(): Promise { try { // Insert receipts into archive collection (using insertMany with ordered: false to continue on duplicate key errors) try { - // eslint-disable-next-line no-await-in-loop await ReadReceiptsArchive.insertMany(oldReceipts, { ordered: false }); logger.info({ msg: 'Successfully archived read receipts', count: oldReceipts.length, batchNumber }); } catch (error: unknown) { @@ -71,13 +69,13 @@ export async function archiveOldReadReceipts(): Promise { } // Mark messages as having archived receipts - // eslint-disable-next-line no-await-in-loop + const updateResult = await Messages.setReceiptsArchivedById(messageIds, true); logger.info({ msg: 'Marked messages as having archived receipts', modifiedCount: updateResult.modifiedCount, batchNumber }); // Delete old receipts from hot storage for this batch const receiptIds = oldReceipts.map((receipt) => receipt._id); - // eslint-disable-next-line no-await-in-loop + const deleteResult = await ReadReceipts.removeByIds(receiptIds); logger.info({ msg: 'Deleted old receipts from hot storage', deletedCount: deleteResult.deletedCount, batchNumber }); @@ -86,7 +84,7 @@ export async function archiveOldReadReceipts(): Promise { // If we processed a full batch, there might be more, so wait and continue if (oldReceipts.length === batchSize) { logger.info({ msg: 'Batch complete, waiting before next batch', batchNumber, delayMs: BATCH_DELAY_MS }); - // eslint-disable-next-line no-await-in-loop + await sleep(BATCH_DELAY_MS); } else { // This was the last batch (partial batch) diff --git a/apps/meteor/ee/server/lib/omnichannel/debounceByParams.ts b/apps/meteor/ee/server/lib/omnichannel/debounceByParams.ts index 24dd03e9c6d2d..323f7a2464618 100644 --- a/apps/meteor/ee/server/lib/omnichannel/debounceByParams.ts +++ b/apps/meteor/ee/server/lib/omnichannel/debounceByParams.ts @@ -9,10 +9,7 @@ interface IMemoizeDebouncedFunction any> { // Debounce `func` based on passed parameters // ref: https://github.com/lodash/lodash/issues/2403#issuecomment-816137402 export function memoizeDebounce any>(func: F, wait = 0, options: any = {}): IMemoizeDebouncedFunction { - const debounceMemo = mem( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - (..._args: Parameters) => debounce(func, wait, options), - ); + const debounceMemo = mem((..._args: Parameters) => debounce(func, wait, options)); function wrappedFunction(this: IMemoizeDebouncedFunction, ...args: Parameters): ReturnType | undefined { return debounceMemo(...args)(...args); diff --git a/apps/meteor/server/api/ApiClass.ts b/apps/meteor/server/api/ApiClass.ts index 44519a28407c9..71dfc86bc0020 100644 --- a/apps/meteor/server/api/ApiClass.ts +++ b/apps/meteor/server/api/ApiClass.ts @@ -10,11 +10,11 @@ import { wrapExceptions } from '@rocket.chat/tools'; import type { ValidateFunction } from 'ajv'; import { Accounts } from 'meteor/accounts-base'; import { DDP } from 'meteor/ddp'; -// eslint-disable-next-line import/no-duplicates +// eslint-disable-next-line import-x/no-duplicates import { DDPCommon } from 'meteor/ddp-common'; import { Meteor } from 'meteor/meteor'; import type { RateLimiterOptionsToCheck } from 'meteor/rate-limit'; -// eslint-disable-next-line import/no-duplicates +// eslint-disable-next-line import-x/no-duplicates import { RateLimiter } from 'meteor/rate-limit'; import _ from 'underscore'; diff --git a/apps/meteor/server/api/lib/isValidQuery.ts b/apps/meteor/server/api/lib/isValidQuery.ts index ef8a0716505cb..912c14c7ae595 100644 --- a/apps/meteor/server/api/lib/isValidQuery.ts +++ b/apps/meteor/server/api/lib/isValidQuery.ts @@ -15,7 +15,6 @@ export const isValidQuery: { throw new Error('query must be an object'); } - // eslint-disable-next-line @typescript-eslint/no-use-before-define return verifyQuery(query, allowedAttributes, allowedOperations); }, { diff --git a/apps/meteor/server/bridges/slack/slackbridge.ts b/apps/meteor/server/bridges/slack/slackbridge.ts index baca928ca4d81..69bd9fa5d02fc 100644 --- a/apps/meteor/server/bridges/slack/slackbridge.ts +++ b/apps/meteor/server/bridges/slack/slackbridge.ts @@ -1,6 +1,6 @@ // This is a JS File that was renamed to TS so it won't lose its git history when converted to TS // TODO: Remove the following lint/ts instructions when the file gets properly converted -/* eslint-disable @typescript-eslint/no-floating-promises */ + /* eslint-disable-next-line @typescript-eslint/ban-ts-comment */ // @ts-nocheck import { debounce } from 'lodash'; diff --git a/apps/meteor/server/lib/error-handler/RocketChat.ErrorHandler.ts b/apps/meteor/server/lib/error-handler/RocketChat.ErrorHandler.ts index 828f173b43806..f544936203029 100644 --- a/apps/meteor/server/lib/error-handler/RocketChat.ErrorHandler.ts +++ b/apps/meteor/server/lib/error-handler/RocketChat.ErrorHandler.ts @@ -68,7 +68,6 @@ Meteor.startup(async () => { }); }); -// eslint-disable-next-line @typescript-eslint/no-this-alias const originalMeteorDebug = Meteor._debug; Meteor._debug = function (message, stack, ...args) { diff --git a/apps/meteor/server/lib/i18n.ts b/apps/meteor/server/lib/i18n.ts index 330dfc3154180..7ec51e0a61895 100644 --- a/apps/meteor/server/lib/i18n.ts +++ b/apps/meteor/server/lib/i18n.ts @@ -88,7 +88,7 @@ void i18n.init({ language, extractTranslationNamespaces( // TODO: commonjs is terrible but we don't have esm build yet - // eslint-disable-next-line @typescript-eslint/no-var-requires, import/no-dynamic-require + // eslint-disable-next-line import-x/no-dynamic-require require(`@rocket.chat/i18n/dist/resources/${language}.i18n.json`) as unknown as Record, ), ]), diff --git a/apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts b/apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts index 52c0592b6fc87..98ace431b8bf3 100644 --- a/apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts +++ b/apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts @@ -457,7 +457,7 @@ export const FileUpload = { } const { query } = URL.parse(url, true); - // eslint-disable-next-line @typescript-eslint/naming-convention + let { rc_uid, rc_token } = query as Record; if (!rc_uid && headers.cookie) { @@ -482,7 +482,7 @@ export const FileUpload = { } const { query } = URL.parse(url, true); - // eslint-disable-next-line @typescript-eslint/naming-convention + let { rc_uid, rc_token, rc_rid, rc_room_type } = query as Record; const { token } = query; @@ -699,7 +699,6 @@ export const FileUpload = { return; } - // eslint-disable-next-line prettier/prettier const headersToProxy = ['age', 'cache-control', 'content-length', 'content-type', 'date', 'expired', 'last-modified']; headersToProxy.forEach((header) => { diff --git a/apps/meteor/server/lib/messages/isTheLastMessage.ts b/apps/meteor/server/lib/messages/isTheLastMessage.ts index 93d8aa587f9ee..d6772a22c9bb4 100644 --- a/apps/meteor/server/lib/messages/isTheLastMessage.ts +++ b/apps/meteor/server/lib/messages/isTheLastMessage.ts @@ -2,6 +2,5 @@ import type { IMessage, IRoom, AtLeast } from '@rocket.chat/core-typings'; import { settings } from '../../settings'; -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type export const isTheLastMessage = (room: AtLeast, message: Pick) => settings.get('Store_Last_Message') && (!room.lastMessage || room.lastMessage._id === message._id); diff --git a/apps/meteor/server/lib/rooms/updateGroupDMsName.ts b/apps/meteor/server/lib/rooms/updateGroupDMsName.ts index 844b63126f1e9..a3aaf286e8e17 100644 --- a/apps/meteor/server/lib/rooms/updateGroupDMsName.ts +++ b/apps/meteor/server/lib/rooms/updateGroupDMsName.ts @@ -57,7 +57,6 @@ export const updateGroupDMsName = async ( const rooms = Rooms.findGroupDMsByUids([userThatChangedName._id], { projection: { uids: 1 }, session }); - // eslint-disable-next-line @typescript-eslint/explicit-function-return-type const getMembers = (uids: string[]) => uids.map((uid) => users.get(uid)).filter(isNotUndefined); // loop rooms to update the subscriptions from them all diff --git a/apps/meteor/server/lib/utils/getURL.ts b/apps/meteor/server/lib/utils/getURL.ts index 97199c3537413..0abe82dc4e91c 100644 --- a/apps/meteor/server/lib/utils/getURL.ts +++ b/apps/meteor/server/lib/utils/getURL.ts @@ -2,7 +2,7 @@ import { getURLWithoutSettings } from '../../../app/utils/lib/getURL'; import { settings } from '../../settings'; export const getURL = function ( - path: string, // eslint-disable-next-line @typescript-eslint/naming-convention + path: string, params: { cdn?: boolean; full?: boolean; diff --git a/apps/meteor/server/services/import/service.spec.ts b/apps/meteor/server/services/import/service.spec.ts index 698b223dfd61f..e2f1981867855 100644 --- a/apps/meteor/server/services/import/service.spec.ts +++ b/apps/meteor/server/services/import/service.spec.ts @@ -57,7 +57,7 @@ jest.mock('../user/lib/getNewUserRoles', () => ({ getNewUserRoles: (...args: unknown[]) => mockGetNewUserRoles(...args), })); -// eslint-disable-next-line import/first +// eslint-disable-next-line import-x/first import { ImportService } from './service'; const createMockOperation = (overrides?: Partial): IImport => ({ diff --git a/apps/meteor/server/services/omnichannel-analytics/service.ts b/apps/meteor/server/services/omnichannel-analytics/service.ts index 46e9ff577bcb6..c56b37661546f 100644 --- a/apps/meteor/server/services/omnichannel-analytics/service.ts +++ b/apps/meteor/server/services/omnichannel-analytics/service.ts @@ -1,4 +1,3 @@ -/* eslint-disable new-cap */ import { ServiceClassInternal } from '@rocket.chat/core-services'; import type { AgentOverviewDataOptions, diff --git a/apps/meteor/server/settings/SettingsRegistry.ts b/apps/meteor/server/settings/SettingsRegistry.ts index 15aeb88bfa89f..a49974fa6fc9d 100644 --- a/apps/meteor/server/settings/SettingsRegistry.ts +++ b/apps/meteor/server/settings/SettingsRegistry.ts @@ -213,7 +213,6 @@ export class SettingsRegistry { */ async addGroup(_id: string, cb?: addGroupCallback): Promise; - // eslint-disable-next-line no-dupe-class-members async addGroup(_id: string, groupOptions: ISettingAddGroupOptions | addGroupCallback = {}, cb?: addGroupCallback): Promise { if (!_id || (groupOptions instanceof Function && cb)) { throw new Error('Invalid arguments'); diff --git a/apps/meteor/server/settings/functions/settings.mocks.ts b/apps/meteor/server/settings/functions/settings.mocks.ts index fb31c3021b1b3..758f96a6904b6 100644 --- a/apps/meteor/server/settings/functions/settings.mocks.ts +++ b/apps/meteor/server/settings/functions/settings.mocks.ts @@ -41,7 +41,7 @@ class SettingsClass { insertOne(doc: any): void { this.data.set(doc._id, doc); - // eslint-disable-next-line @typescript-eslint/no-var-requires + this.settings.set(doc); this.insertCalls++; } @@ -77,13 +77,13 @@ class SettingsClass { this.data.set(query._id, data); // Can't import before the mock command on end of this file! - // eslint-disable-next-line @typescript-eslint/no-var-requires + this.settings.set(data); }, this.delay); } else { this.data.set(query._id, data); // Can't import before the mock command on end of this file! - // eslint-disable-next-line @typescript-eslint/no-var-requires + this.settings.set(data); } @@ -98,7 +98,7 @@ class SettingsClass { updateValueById(id: string, value: any): void { this.data.set(id, { ...this.data.get(id), value }); // Can't import before the mock command on end of this file! - // eslint-disable-next-line @typescript-eslint/no-var-requires + if (this.delay) { setTimeout(() => { this.settings.set(this.data.get(id) as ISetting); diff --git a/apps/meteor/server/settings/startup.ts b/apps/meteor/server/settings/startup.ts index 5c0f4cdee5fe6..450d46cc45599 100644 --- a/apps/meteor/server/settings/startup.ts +++ b/apps/meteor/server/settings/startup.ts @@ -3,7 +3,6 @@ import type { Settings } from '@rocket.chat/models'; import type { ICachedSettings } from './CachedSettings'; -// eslint-disable-next-line @typescript-eslint/naming-convention export async function initializeSettings({ model, settings }: { model: typeof Settings; settings: ICachedSettings }): Promise { await model.find().forEach((record: ISetting) => { settings.set(record); diff --git a/apps/meteor/server/ufs/ufs-server.ts b/apps/meteor/server/ufs/ufs-server.ts index 4b528a1a59ff3..665ea767acdc2 100644 --- a/apps/meteor/server/ufs/ufs-server.ts +++ b/apps/meteor/server/ufs/ufs-server.ts @@ -168,7 +168,6 @@ WebApp.connectHandlers.use(async (req, res, next) => { if ( (file.modifiedAt instanceof Date && file.modifiedAt > modifiedSince) || - // eslint-disable-next-line no-mixed-operators (file.uploadedAt instanceof Date && file.uploadedAt > modifiedSince) ) { res.writeHead(304); // Not Modified diff --git a/apps/meteor/server/ufs/ufs-store.ts b/apps/meteor/server/ufs/ufs-store.ts index 54ea2d8317bf0..05a094be711e4 100644 --- a/apps/meteor/server/ufs/ufs-store.ts +++ b/apps/meteor/server/ufs/ufs-store.ts @@ -240,7 +240,6 @@ export class Store { generateToken(pattern?: string) { return (pattern || 'xyxyxyxyxy').replace(/[xy]/g, (c) => { - // eslint-disable-next-line no-mixed-operators const r = (Math.random() * 16) | 0; const v = c === 'x' ? r : (r & 0x3) | 0x8; const s = v.toString(16); diff --git a/apps/meteor/tests/e2e/e2e-encryption/e2ee-legacy-format.spec.ts b/apps/meteor/tests/e2e/e2e-encryption/e2ee-legacy-format.spec.ts index 0f77679a0fc17..7d9082442ac68 100644 --- a/apps/meteor/tests/e2e/e2e-encryption/e2ee-legacy-format.spec.ts +++ b/apps/meteor/tests/e2e/e2e-encryption/e2ee-legacy-format.spec.ts @@ -72,7 +72,7 @@ test.describe('E2EE Legacy Format', () => { await page.evaluate( async ({ rid, kid, encryptedKey }) => { - // eslint-disable-next-line import/no-unresolved, import/no-absolute-path + // eslint-disable-next-line import-x/no-absolute-path const { e2e } = require('/client/lib/e2ee/rocketchat.e2e.ts') as typeof import('../../../client/lib/e2ee/rocketchat.e2e'); const room = await e2e.getInstanceByRoomId(rid); await room?.importGroupKey(kid + encryptedKey); diff --git a/apps/meteor/tests/e2e/page-objects/login.ts b/apps/meteor/tests/e2e/page-objects/login.ts index dcf3e4802484c..7b81c91f6513f 100644 --- a/apps/meteor/tests/e2e/page-objects/login.ts +++ b/apps/meteor/tests/e2e/page-objects/login.ts @@ -46,7 +46,7 @@ export class LoginPage { items.forEach(({ name, value }) => { window.localStorage.setItem(name, value); }); - // eslint-disable-next-line @typescript-eslint/no-var-requires + require('meteor/accounts-base').Accounts._pollStoredLoginToken(); }, localStorageItems); diff --git a/apps/meteor/tests/unit/server/services/omnichannel-analytics/AgentData.tests.ts b/apps/meteor/tests/unit/server/services/omnichannel-analytics/AgentData.tests.ts index 7e3003332d503..fbbda13a7e2a4 100644 --- a/apps/meteor/tests/unit/server/services/omnichannel-analytics/AgentData.tests.ts +++ b/apps/meteor/tests/unit/server/services/omnichannel-analytics/AgentData.tests.ts @@ -70,7 +70,7 @@ describe('AgentData Analytics', () => { try { // @ts-expect-error - test - // eslint-disable-next-line prettier/prettier, no-return-await + await agentOverview.callAction('invalid', moment(), moment()); } catch (e) { expect(e).to.be.instanceOf(Error); diff --git a/ee/apps/omnichannel-transcript/src/i18n.ts b/ee/apps/omnichannel-transcript/src/i18n.ts index 99a0d1580e003..669b932a66fef 100644 --- a/ee/apps/omnichannel-transcript/src/i18n.ts +++ b/ee/apps/omnichannel-transcript/src/i18n.ts @@ -16,7 +16,7 @@ void i18n.init({ language, extractTranslationNamespaces( // TODO: commonjs is terrible but we don't have esm build yet - // eslint-disable-next-line @typescript-eslint/no-var-requires, import/no-dynamic-require + // eslint-disable-next-line import-x/no-dynamic-require require(`@rocket.chat/i18n/dist/resources/${language}.i18n.json`) as unknown as Record, ), ]), diff --git a/ee/packages/license/src/licenseImp.ts b/ee/packages/license/src/licenseImp.ts index e5795751942f5..74b2d7814946e 100644 --- a/ee/packages/license/src/licenseImp.ts +++ b/ee/packages/license/src/licenseImp.ts @@ -26,7 +26,6 @@ import { getTags } from './tags'; import { getCurrentValueForLicenseLimit, setLicenseLimitCounter } from './validation/getCurrentValueForLicenseLimit'; import { validateFormat } from './validation/validateFormat'; -// eslint-disable-next-line @typescript-eslint/naming-convention export class LicenseImp extends LicenseManager { constructor() { super(); diff --git a/eslint.config.mjs b/eslint.config.mjs index 16952bc2d1f74..91f95696ebaf2 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -29,11 +29,11 @@ export default [ 'you-dont-need-lodash-underscore': youDontNeedLodashUnderscorePlugin, }, settings: { - 'import/ignore': ['meteor/.+'], + 'import-x/ignore': ['meteor/.+'], }, rules: { - 'import/named': 'error', - 'import/no-unresolved': [ + 'import-x/named': 'error', + 'import-x/no-unresolved': [ 'error', { commonjs: true, @@ -249,8 +249,8 @@ export default [ }, rules: { '@typescript-eslint/no-floating-promises': 'error', - 'import/named': 'error', - 'import/order': [ + 'import-x/named': 'error', + 'import-x/order': [ 'error', { 'newlines-between': 'always', @@ -470,7 +470,7 @@ export default [ { files: ['ee/packages/federation-matrix/src/api/.well-known/server.ts'], rules: { - 'import/order': 'warn', + 'import-x/order': 'warn', }, }, ]; diff --git a/package.json b/package.json index af49bc52ec473..c89b6e456e636 100644 --- a/package.json +++ b/package.json @@ -132,7 +132,6 @@ "create-hmac/sha.js": "2.4.12", "@typescript-eslint/typescript-estree/minimatch": "10.2.5", "depcheck/minimatch": "7.4.9", - "eslint-plugin-import/minimatch": "3.1.5", "eslint-plugin-jsx-a11y/minimatch": "3.1.5", "eslint-plugin-react/minimatch": "3.1.5", "fork-ts-checker-webpack-plugin/minimatch": "3.1.5", diff --git a/packages/apps/node-runtime/src/lib/require.ts b/packages/apps/node-runtime/src/lib/require.ts index 5b1f118e38a08..c680d263ddfbf 100644 --- a/packages/apps/node-runtime/src/lib/require.ts +++ b/packages/apps/node-runtime/src/lib/require.ts @@ -32,6 +32,6 @@ export const sandboxRequire = (module: string) => { } // This is THE purpose of this function, we can't escape a dinamyc require call - // eslint-disable-next-line @typescript-eslint/no-unsafe-return, import/no-dynamic-require, @typescript-eslint/no-require-imports + // eslint-disable-next-line @typescript-eslint/no-unsafe-return, import-x/no-dynamic-require, @typescript-eslint/no-require-imports return require(normalized); }; diff --git a/packages/cas-validate/src/validate.ts b/packages/cas-validate/src/validate.ts index 00158c7dbf0e7..67eff69f2c5ec 100644 --- a/packages/cas-validate/src/validate.ts +++ b/packages/cas-validate/src/validate.ts @@ -7,7 +7,6 @@ import type { Cheerio, CheerioAPI } from 'cheerio'; import { load } from 'cheerio'; export type CasOptions = { - // eslint-disable-next-line @typescript-eslint/naming-convention base_url: string; service?: string; version: 1.0 | 2.0; @@ -16,7 +15,7 @@ export type CasOptions = { export type CasCallbackExtendedData = { username?: string; attributes?: Record; - // eslint-disable-next-line @typescript-eslint/naming-convention + PGTIOU?: string; ticket?: string; proxies?: string[]; @@ -268,7 +267,7 @@ export function validate(options: CasOptions, ticket: string, callback: CasCallb callback(undefined, true, username, { username, attributes, - // eslint-disable-next-line @typescript-eslint/naming-convention + PGTIOU: pgtIOU, ticket, proxies, diff --git a/packages/ddp-client/src/types/methods.ts b/packages/ddp-client/src/types/methods.ts index a9d2ae36f03d2..c96b4bb459643 100644 --- a/packages/ddp-client/src/types/methods.ts +++ b/packages/ddp-client/src/types/methods.ts @@ -1,4 +1,3 @@ -// eslint-disable-next-line @typescript-eslint/naming-convention export interface ServerMethods { resetPassword(token: string, password: string): { token: string }; checkRegistrationSecretURL(hash: string): boolean; diff --git a/packages/eslint-config/index.js b/packages/eslint-config/index.js index f7ce026622482..23496dbc1f652 100644 --- a/packages/eslint-config/index.js +++ b/packages/eslint-config/index.js @@ -1,7 +1,8 @@ import eslint from '@eslint/js'; import { defineConfig } from 'eslint/config'; +import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript'; import antiTrojanSourcePlugin from 'eslint-plugin-anti-trojan-source'; -import importPlugin from 'eslint-plugin-import'; +import importXPlugin, { createNodeResolver } from 'eslint-plugin-import-x'; import jestPlugin from 'eslint-plugin-jest'; import jsxA11yPlugin from 'eslint-plugin-jsx-a11y'; import prettierPluginRecommended from 'eslint-plugin-prettier/recommended'; @@ -32,8 +33,8 @@ export default defineConfig( }, }, }, - importPlugin.flatConfigs.recommended, - importPlugin.flatConfigs.typescript, + importXPlugin.flatConfigs.recommended, + importXPlugin.flatConfigs.typescript, jsxA11yPlugin.flatConfigs.recommended, { name: 'rocket.chat/jsx-a11y', @@ -337,28 +338,29 @@ export default defineConfig( { name: 'rocket.chat/import', settings: { - 'import/resolver': { - node: true, - typescript: true, - }, + // The node resolver must run first (the TypeScript resolver would otherwise resolve + // packages like node-fetch to their `@types/*` declarations), and `exportsFields: []` + // keeps the old eslint-import-resolver-node behavior of ignoring package `exports` + // maps (required for deep imports like `csv-parse/lib/sync` and `swiper/modules/*.css`). + 'import-x/resolver-next': [createNodeResolver({ exportsFields: [] }), createTypeScriptImportResolver()], }, rules: { - 'import/no-unresolved': [ + 'import-x/no-unresolved': [ 'error', { commonjs: true, caseSensitive: true, }, ], - 'import/named': 'off', - 'import/default': 'off', - 'import/namespace': 'off', - 'import/export': 'error', - 'import/no-named-as-default': 'off', - 'import/no-named-as-default-member': 'off', - 'import/first': 'error', - 'import/no-duplicates': 'error', - 'import/order': [ + 'import-x/named': 'off', + 'import-x/default': 'off', + 'import-x/namespace': 'off', + 'import-x/export': 'error', + 'import-x/no-named-as-default': 'off', + 'import-x/no-named-as-default-member': 'off', + 'import-x/first': 'error', + 'import-x/no-duplicates': 'error', + 'import-x/order': [ 'error', { 'newlines-between': 'always', @@ -368,12 +370,12 @@ export default defineConfig( }, }, ], - 'import/newline-after-import': 'error', - 'import/no-absolute-path': 'error', - 'import/no-dynamic-require': 'error', - 'import/no-self-import': 'error', - 'import/no-cycle': 'off', - 'import/no-useless-path-segments': 'error', + 'import-x/newline-after-import': 'error', + 'import-x/no-absolute-path': 'error', + 'import-x/no-dynamic-require': 'error', + 'import-x/no-self-import': 'error', + 'import-x/no-cycle': 'off', + 'import-x/no-useless-path-segments': 'error', }, }, { diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json index 0722b40946eee..5594702dea325 100644 --- a/packages/eslint-config/package.json +++ b/packages/eslint-config/package.json @@ -24,7 +24,7 @@ "eslint-config-prettier": "~10.1.8", "eslint-import-resolver-typescript": "~4.4.4", "eslint-plugin-anti-trojan-source": "~1.1.2", - "eslint-plugin-import": "~2.32.0", + "eslint-plugin-import-x": "~4.17.1", "eslint-plugin-jest": "~29.15.2", "eslint-plugin-jsx-a11y": "~6.10.2", "eslint-plugin-prettier": "~5.5.5", diff --git a/packages/mock-providers/src/MockedAppRootBuilder.tsx b/packages/mock-providers/src/MockedAppRootBuilder.tsx index ff4860936ae20..802eec4da3c89 100644 --- a/packages/mock-providers/src/MockedAppRootBuilder.tsx +++ b/packages/mock-providers/src/MockedAppRootBuilder.tsx @@ -60,7 +60,6 @@ type Mutable = { -readonly [P in keyof T]: T[P]; }; -// eslint-disable-next-line @typescript-eslint/naming-convention // interface MockedAppRootEvents extends Record<`stream-${StreamNames}-${StreamKeys}`, any> { // 'update-modal': void; // } diff --git a/packages/ui-client/src/methods.d.ts b/packages/ui-client/src/methods.d.ts index fe12902b53e17..e3861388cac44 100644 --- a/packages/ui-client/src/methods.d.ts +++ b/packages/ui-client/src/methods.d.ts @@ -2,7 +2,6 @@ import '@rocket.chat/ddp-client'; import type { ISetting } from '@rocket.chat/core-typings'; declare module '@rocket.chat/ddp-client' { - // eslint-disable-next-line @typescript-eslint/naming-convention interface ServerMethods { getSetupWizardParameters(): Promise<{ settings: ISetting[]; diff --git a/yarn.lock b/yarn.lock index 8477e56c6ab8b..2f3f99a8d4504 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9083,7 +9083,7 @@ __metadata: eslint-config-prettier: "npm:~10.1.8" eslint-import-resolver-typescript: "npm:~4.4.4" eslint-plugin-anti-trojan-source: "npm:~1.1.2" - eslint-plugin-import: "npm:~2.32.0" + eslint-plugin-import-x: "npm:~4.17.1" eslint-plugin-jest: "npm:~29.15.2" eslint-plugin-jsx-a11y: "npm:~6.10.2" eslint-plugin-prettier: "npm:~5.5.5" @@ -11249,13 +11249,6 @@ __metadata: languageName: node linkType: hard -"@rtsao/scc@npm:^1.1.0": - version: 1.1.0 - resolution: "@rtsao/scc@npm:1.1.0" - checksum: 10/17d04adf404e04c1e61391ed97bca5117d4c2767a76ae3e879390d6dec7b317fcae68afbf9e98badee075d0b64fa60f287729c4942021b4d19cd01db77385c01 - languageName: node - linkType: hard - "@samchon/openapi@npm:^4.7.1": version: 4.7.1 resolution: "@samchon/openapi@npm:4.7.1" @@ -14138,13 +14131,6 @@ __metadata: languageName: node linkType: hard -"@types/json5@npm:^0.0.29": - version: 0.0.29 - resolution: "@types/json5@npm:0.0.29" - checksum: 10/4e5aed58cabb2bbf6f725da13421aa50a49abb6bc17bfab6c31b8774b073fa7b50d557c61f961a09a85f6056151190f8ac95f13f5b48136ba5841f7d4484ec56 - languageName: node - linkType: hard - "@types/jsonwebtoken@npm:^8.3.7": version: 8.5.9 resolution: "@types/jsonwebtoken@npm:8.5.9" @@ -15159,6 +15145,13 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/types@npm:^8.56.0": + version: 8.63.0 + resolution: "@typescript-eslint/types@npm:8.63.0" + checksum: 10/f72eb114970cae0da8e53f68cd8dca1b51ac410f4438141a2851655fa07aacb3090e24a2ae53462cf0970e4d5b52cabf9693aa6f07abdff5c210874806427e5b + languageName: node + linkType: hard + "@typescript-eslint/typescript-estree@npm:8.56.1": version: 8.56.1 resolution: "@typescript-eslint/typescript-estree@npm:8.56.1" @@ -15217,6 +15210,13 @@ __metadata: languageName: node linkType: hard +"@unrs/resolver-binding-android-arm-eabi@npm:1.12.2": + version: 1.12.2 + resolution: "@unrs/resolver-binding-android-arm-eabi@npm:1.12.2" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + "@unrs/resolver-binding-android-arm-eabi@npm:1.9.0": version: 1.9.0 resolution: "@unrs/resolver-binding-android-arm-eabi@npm:1.9.0" @@ -15224,6 +15224,13 @@ __metadata: languageName: node linkType: hard +"@unrs/resolver-binding-android-arm64@npm:1.12.2": + version: 1.12.2 + resolution: "@unrs/resolver-binding-android-arm64@npm:1.12.2" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + "@unrs/resolver-binding-android-arm64@npm:1.9.0": version: 1.9.0 resolution: "@unrs/resolver-binding-android-arm64@npm:1.9.0" @@ -15231,6 +15238,13 @@ __metadata: languageName: node linkType: hard +"@unrs/resolver-binding-darwin-arm64@npm:1.12.2": + version: 1.12.2 + resolution: "@unrs/resolver-binding-darwin-arm64@npm:1.12.2" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + "@unrs/resolver-binding-darwin-arm64@npm:1.9.0": version: 1.9.0 resolution: "@unrs/resolver-binding-darwin-arm64@npm:1.9.0" @@ -15238,6 +15252,13 @@ __metadata: languageName: node linkType: hard +"@unrs/resolver-binding-darwin-x64@npm:1.12.2": + version: 1.12.2 + resolution: "@unrs/resolver-binding-darwin-x64@npm:1.12.2" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + "@unrs/resolver-binding-darwin-x64@npm:1.9.0": version: 1.9.0 resolution: "@unrs/resolver-binding-darwin-x64@npm:1.9.0" @@ -15245,6 +15266,13 @@ __metadata: languageName: node linkType: hard +"@unrs/resolver-binding-freebsd-x64@npm:1.12.2": + version: 1.12.2 + resolution: "@unrs/resolver-binding-freebsd-x64@npm:1.12.2" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + "@unrs/resolver-binding-freebsd-x64@npm:1.9.0": version: 1.9.0 resolution: "@unrs/resolver-binding-freebsd-x64@npm:1.9.0" @@ -15252,6 +15280,13 @@ __metadata: languageName: node linkType: hard +"@unrs/resolver-binding-linux-arm-gnueabihf@npm:1.12.2": + version: 1.12.2 + resolution: "@unrs/resolver-binding-linux-arm-gnueabihf@npm:1.12.2" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + "@unrs/resolver-binding-linux-arm-gnueabihf@npm:1.9.0": version: 1.9.0 resolution: "@unrs/resolver-binding-linux-arm-gnueabihf@npm:1.9.0" @@ -15259,6 +15294,13 @@ __metadata: languageName: node linkType: hard +"@unrs/resolver-binding-linux-arm-musleabihf@npm:1.12.2": + version: 1.12.2 + resolution: "@unrs/resolver-binding-linux-arm-musleabihf@npm:1.12.2" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + "@unrs/resolver-binding-linux-arm-musleabihf@npm:1.9.0": version: 1.9.0 resolution: "@unrs/resolver-binding-linux-arm-musleabihf@npm:1.9.0" @@ -15266,6 +15308,13 @@ __metadata: languageName: node linkType: hard +"@unrs/resolver-binding-linux-arm64-gnu@npm:1.12.2": + version: 1.12.2 + resolution: "@unrs/resolver-binding-linux-arm64-gnu@npm:1.12.2" + conditions: os=linux & cpu=arm64 & libc=glibc + languageName: node + linkType: hard + "@unrs/resolver-binding-linux-arm64-gnu@npm:1.9.0": version: 1.9.0 resolution: "@unrs/resolver-binding-linux-arm64-gnu@npm:1.9.0" @@ -15273,6 +15322,13 @@ __metadata: languageName: node linkType: hard +"@unrs/resolver-binding-linux-arm64-musl@npm:1.12.2": + version: 1.12.2 + resolution: "@unrs/resolver-binding-linux-arm64-musl@npm:1.12.2" + conditions: os=linux & cpu=arm64 & libc=musl + languageName: node + linkType: hard + "@unrs/resolver-binding-linux-arm64-musl@npm:1.9.0": version: 1.9.0 resolution: "@unrs/resolver-binding-linux-arm64-musl@npm:1.9.0" @@ -15280,6 +15336,27 @@ __metadata: languageName: node linkType: hard +"@unrs/resolver-binding-linux-loong64-gnu@npm:1.12.2": + version: 1.12.2 + resolution: "@unrs/resolver-binding-linux-loong64-gnu@npm:1.12.2" + conditions: os=linux & cpu=loong64 & libc=glibc + languageName: node + linkType: hard + +"@unrs/resolver-binding-linux-loong64-musl@npm:1.12.2": + version: 1.12.2 + resolution: "@unrs/resolver-binding-linux-loong64-musl@npm:1.12.2" + conditions: os=linux & cpu=loong64 & libc=musl + languageName: node + linkType: hard + +"@unrs/resolver-binding-linux-ppc64-gnu@npm:1.12.2": + version: 1.12.2 + resolution: "@unrs/resolver-binding-linux-ppc64-gnu@npm:1.12.2" + conditions: os=linux & cpu=ppc64 & libc=glibc + languageName: node + linkType: hard + "@unrs/resolver-binding-linux-ppc64-gnu@npm:1.9.0": version: 1.9.0 resolution: "@unrs/resolver-binding-linux-ppc64-gnu@npm:1.9.0" @@ -15287,6 +15364,13 @@ __metadata: languageName: node linkType: hard +"@unrs/resolver-binding-linux-riscv64-gnu@npm:1.12.2": + version: 1.12.2 + resolution: "@unrs/resolver-binding-linux-riscv64-gnu@npm:1.12.2" + conditions: os=linux & cpu=riscv64 & libc=glibc + languageName: node + linkType: hard + "@unrs/resolver-binding-linux-riscv64-gnu@npm:1.9.0": version: 1.9.0 resolution: "@unrs/resolver-binding-linux-riscv64-gnu@npm:1.9.0" @@ -15294,6 +15378,13 @@ __metadata: languageName: node linkType: hard +"@unrs/resolver-binding-linux-riscv64-musl@npm:1.12.2": + version: 1.12.2 + resolution: "@unrs/resolver-binding-linux-riscv64-musl@npm:1.12.2" + conditions: os=linux & cpu=riscv64 & libc=musl + languageName: node + linkType: hard + "@unrs/resolver-binding-linux-riscv64-musl@npm:1.9.0": version: 1.9.0 resolution: "@unrs/resolver-binding-linux-riscv64-musl@npm:1.9.0" @@ -15301,6 +15392,13 @@ __metadata: languageName: node linkType: hard +"@unrs/resolver-binding-linux-s390x-gnu@npm:1.12.2": + version: 1.12.2 + resolution: "@unrs/resolver-binding-linux-s390x-gnu@npm:1.12.2" + conditions: os=linux & cpu=s390x & libc=glibc + languageName: node + linkType: hard + "@unrs/resolver-binding-linux-s390x-gnu@npm:1.9.0": version: 1.9.0 resolution: "@unrs/resolver-binding-linux-s390x-gnu@npm:1.9.0" @@ -15308,6 +15406,13 @@ __metadata: languageName: node linkType: hard +"@unrs/resolver-binding-linux-x64-gnu@npm:1.12.2": + version: 1.12.2 + resolution: "@unrs/resolver-binding-linux-x64-gnu@npm:1.12.2" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + "@unrs/resolver-binding-linux-x64-gnu@npm:1.9.0": version: 1.9.0 resolution: "@unrs/resolver-binding-linux-x64-gnu@npm:1.9.0" @@ -15315,6 +15420,13 @@ __metadata: languageName: node linkType: hard +"@unrs/resolver-binding-linux-x64-musl@npm:1.12.2": + version: 1.12.2 + resolution: "@unrs/resolver-binding-linux-x64-musl@npm:1.12.2" + conditions: os=linux & cpu=x64 & libc=musl + languageName: node + linkType: hard + "@unrs/resolver-binding-linux-x64-musl@npm:1.9.0": version: 1.9.0 resolution: "@unrs/resolver-binding-linux-x64-musl@npm:1.9.0" @@ -15322,6 +15434,24 @@ __metadata: languageName: node linkType: hard +"@unrs/resolver-binding-openharmony-arm64@npm:1.12.2": + version: 1.12.2 + resolution: "@unrs/resolver-binding-openharmony-arm64@npm:1.12.2" + conditions: os=openharmony & cpu=arm64 + languageName: node + linkType: hard + +"@unrs/resolver-binding-wasm32-wasi@npm:1.12.2": + version: 1.12.2 + resolution: "@unrs/resolver-binding-wasm32-wasi@npm:1.12.2" + dependencies: + "@emnapi/core": "npm:1.10.0" + "@emnapi/runtime": "npm:1.10.0" + "@napi-rs/wasm-runtime": "npm:^1.1.4" + conditions: cpu=wasm32 + languageName: node + linkType: hard + "@unrs/resolver-binding-wasm32-wasi@npm:1.9.0": version: 1.9.0 resolution: "@unrs/resolver-binding-wasm32-wasi@npm:1.9.0" @@ -15331,6 +15461,13 @@ __metadata: languageName: node linkType: hard +"@unrs/resolver-binding-win32-arm64-msvc@npm:1.12.2": + version: 1.12.2 + resolution: "@unrs/resolver-binding-win32-arm64-msvc@npm:1.12.2" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + "@unrs/resolver-binding-win32-arm64-msvc@npm:1.9.0": version: 1.9.0 resolution: "@unrs/resolver-binding-win32-arm64-msvc@npm:1.9.0" @@ -15338,6 +15475,13 @@ __metadata: languageName: node linkType: hard +"@unrs/resolver-binding-win32-ia32-msvc@npm:1.12.2": + version: 1.12.2 + resolution: "@unrs/resolver-binding-win32-ia32-msvc@npm:1.12.2" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + "@unrs/resolver-binding-win32-ia32-msvc@npm:1.9.0": version: 1.9.0 resolution: "@unrs/resolver-binding-win32-ia32-msvc@npm:1.9.0" @@ -15345,6 +15489,13 @@ __metadata: languageName: node linkType: hard +"@unrs/resolver-binding-win32-x64-msvc@npm:1.12.2": + version: 1.12.2 + resolution: "@unrs/resolver-binding-win32-x64-msvc@npm:1.12.2" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + "@unrs/resolver-binding-win32-x64-msvc@npm:1.9.0": version: 1.9.0 resolution: "@unrs/resolver-binding-win32-x64-msvc@npm:1.9.0" @@ -16230,22 +16381,6 @@ __metadata: languageName: node linkType: hard -"array-includes@npm:^3.1.9": - version: 3.1.9 - resolution: "array-includes@npm:3.1.9" - dependencies: - call-bind: "npm:^1.0.8" - call-bound: "npm:^1.0.4" - define-properties: "npm:^1.2.1" - es-abstract: "npm:^1.24.0" - es-object-atoms: "npm:^1.1.1" - get-intrinsic: "npm:^1.3.0" - is-string: "npm:^1.1.1" - math-intrinsics: "npm:^1.1.0" - checksum: 10/8bfe9a58df74f326b4a76b04ee05c13d871759e888b4ee8f013145297cf5eb3c02cfa216067ebdaac5d74eb9763ac5cad77cdf2773b8ab475833701e032173aa - languageName: node - linkType: hard - "array-timsort@npm:^1.0.3": version: 1.0.3 resolution: "array-timsort@npm:1.0.3" @@ -16297,21 +16432,6 @@ __metadata: languageName: node linkType: hard -"array.prototype.findlastindex@npm:^1.2.6": - version: 1.2.6 - resolution: "array.prototype.findlastindex@npm:1.2.6" - dependencies: - call-bind: "npm:^1.0.8" - call-bound: "npm:^1.0.4" - define-properties: "npm:^1.2.1" - es-abstract: "npm:^1.23.9" - es-errors: "npm:^1.3.0" - es-object-atoms: "npm:^1.1.1" - es-shim-unscopables: "npm:^1.1.0" - checksum: 10/5ddb6420e820bef6ddfdcc08ce780d0fd5e627e97457919c27e32359916de5a11ce12f7c55073555e503856618eaaa70845d6ca11dcba724766f38eb1c22f7a2 - languageName: node - linkType: hard - "array.prototype.flat@npm:^1.3.1": version: 1.3.2 resolution: "array.prototype.flat@npm:1.3.2" @@ -16324,18 +16444,6 @@ __metadata: languageName: node linkType: hard -"array.prototype.flat@npm:^1.3.3": - version: 1.3.3 - resolution: "array.prototype.flat@npm:1.3.3" - dependencies: - call-bind: "npm:^1.0.8" - define-properties: "npm:^1.2.1" - es-abstract: "npm:^1.23.5" - es-shim-unscopables: "npm:^1.0.2" - checksum: 10/f9b992fa0775d8f7c97abc91eb7f7b2f0ed8430dd9aeb9fdc2967ac4760cdd7fc2ef7ead6528fef40c7261e4d790e117808ce0d3e7e89e91514d4963a531cd01 - languageName: node - linkType: hard - "array.prototype.flatmap@npm:^1.3.2, array.prototype.flatmap@npm:^1.3.3": version: 1.3.3 resolution: "array.prototype.flatmap@npm:1.3.3" @@ -18569,6 +18677,13 @@ __metadata: languageName: node linkType: hard +"comment-parser@npm:^1.4.1": + version: 1.4.7 + resolution: "comment-parser@npm:1.4.7" + checksum: 10/7c102b7ff0b7321f1c09f21f62c8a75996dd7522750bac06d68d125c9e039d30d30a9e248c9e0172c81f4bf61a46b72780db97f79f1e0dfff8cd9fe6edaa515f + languageName: node + linkType: hard + "commondir@npm:^1.0.1": version: 1.0.1 resolution: "commondir@npm:1.0.1" @@ -20755,7 +20870,7 @@ __metadata: languageName: node linkType: hard -"es-abstract@npm:^1.17.5, es-abstract@npm:^1.24.0, es-abstract@npm:^1.24.1": +"es-abstract@npm:^1.17.5, es-abstract@npm:^1.24.1": version: 1.24.1 resolution: "es-abstract@npm:1.24.1" dependencies: @@ -20982,15 +21097,6 @@ __metadata: languageName: node linkType: hard -"es-shim-unscopables@npm:^1.1.0": - version: 1.1.0 - resolution: "es-shim-unscopables@npm:1.1.0" - dependencies: - hasown: "npm:^2.0.2" - checksum: 10/c351f586c30bbabc62355be49564b2435468b52c3532b8a1663672e3d10dc300197e69c247869dd173e56d86423ab95fc0c10b0939cdae597094e0fdca078cba - languageName: node - linkType: hard - "es-to-primitive@npm:^1.3.0": version: 1.3.0 resolution: "es-to-primitive@npm:1.3.0" @@ -21169,7 +21275,7 @@ __metadata: languageName: node linkType: hard -"eslint-import-context@npm:^0.1.8": +"eslint-import-context@npm:^0.1.8, eslint-import-context@npm:^0.1.9": version: 0.1.9 resolution: "eslint-import-context@npm:0.1.9" dependencies: @@ -21184,17 +21290,6 @@ __metadata: languageName: node linkType: hard -"eslint-import-resolver-node@npm:^0.3.9": - version: 0.3.9 - resolution: "eslint-import-resolver-node@npm:0.3.9" - dependencies: - debug: "npm:^3.2.7" - is-core-module: "npm:^2.13.0" - resolve: "npm:^1.22.4" - checksum: 10/d52e08e1d96cf630957272e4f2644dcfb531e49dcfd1edd2e07e43369eb2ec7a7d4423d417beee613201206ff2efa4eb9a582b5825ee28802fc7c71fcd53ca83 - languageName: node - linkType: hard - "eslint-import-resolver-typescript@npm:~4.4.4": version: 4.4.4 resolution: "eslint-import-resolver-typescript@npm:4.4.4" @@ -21219,18 +21314,6 @@ __metadata: languageName: node linkType: hard -"eslint-module-utils@npm:^2.12.1": - version: 2.12.1 - resolution: "eslint-module-utils@npm:2.12.1" - dependencies: - debug: "npm:^3.2.7" - peerDependenciesMeta: - eslint: - optional: true - checksum: 10/bd25d6610ec3abaa50e8f1beb0119541562bbb8dd02c035c7e887976fe1e0c5dd8175f4607ca8d86d1146df24d52a071bd3d1dd329f6902bd58df805a8ca16d3 - languageName: node - linkType: hard - "eslint-plugin-anti-trojan-source@npm:~1.1.2": version: 1.1.2 resolution: "eslint-plugin-anti-trojan-source@npm:1.1.2" @@ -21240,32 +21323,29 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-import@npm:~2.32.0": - version: 2.32.0 - resolution: "eslint-plugin-import@npm:2.32.0" +"eslint-plugin-import-x@npm:~4.17.1": + version: 4.17.1 + resolution: "eslint-plugin-import-x@npm:4.17.1" dependencies: - "@rtsao/scc": "npm:^1.1.0" - array-includes: "npm:^3.1.9" - array.prototype.findlastindex: "npm:^1.2.6" - array.prototype.flat: "npm:^1.3.3" - array.prototype.flatmap: "npm:^1.3.3" - debug: "npm:^3.2.7" - doctrine: "npm:^2.1.0" - eslint-import-resolver-node: "npm:^0.3.9" - eslint-module-utils: "npm:^2.12.1" - hasown: "npm:^2.0.2" - is-core-module: "npm:^2.16.1" + "@typescript-eslint/types": "npm:^8.56.0" + comment-parser: "npm:^1.4.1" + debug: "npm:^4.4.1" + eslint-import-context: "npm:^0.1.9" is-glob: "npm:^4.0.3" - minimatch: "npm:^3.1.2" - object.fromentries: "npm:^2.0.8" - object.groupby: "npm:^1.0.3" - object.values: "npm:^1.2.1" - semver: "npm:^6.3.1" - string.prototype.trimend: "npm:^1.0.9" - tsconfig-paths: "npm:^3.15.0" + minimatch: "npm:^9.0.3 || ^10.1.2" + semver: "npm:^7.7.2" + stable-hash-x: "npm:^0.2.0" + unrs-resolver: "npm:^1.9.2" peerDependencies: - eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9 - checksum: 10/1bacf4967e9ebf99e12176a795f0d6d3a87d1c9a030c2207f27b267e10d96a1220be2647504c7fc13ab543cdf13ffef4b8f5620e0447032dba4ff0d3922f7c9e + "@typescript-eslint/utils": ^8.56.0 + eslint: ^8.57.0 || ^9.0.0 || ^10.0.0 + eslint-import-resolver-node: "*" + peerDependenciesMeta: + "@typescript-eslint/utils": + optional: true + eslint-import-resolver-node: + optional: true + checksum: 10/1cb95284765cf0ff937f7ab44cf965278939c25dedc72ac41d00d954f4c0bd607bcaffacdeb22a3796aa8f2775c63dd25f818c7f897f061f2339035826cbaf5c languageName: node linkType: hard @@ -26412,17 +26492,6 @@ __metadata: languageName: node linkType: hard -"json5@npm:^1.0.2": - version: 1.0.2 - resolution: "json5@npm:1.0.2" - dependencies: - minimist: "npm:^1.2.0" - bin: - json5: lib/cli.js - checksum: 10/a78d812dbbd5642c4f637dd130954acfd231b074965871c3e28a5bbd571f099d623ecf9161f1960c4ddf68e0cc98dee8bebfdb94a71ad4551f85a1afc94b63f6 - languageName: node - linkType: hard - "json5@npm:^2.1.2, json5@npm:^2.2.2, json5@npm:^2.2.3": version: 2.2.3 resolution: "json5@npm:2.2.3" @@ -28050,7 +28119,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:10.2.5, minimatch@npm:^10.1.1, minimatch@npm:^10.2.5": +"minimatch@npm:10.2.5, minimatch@npm:^10.1.1, minimatch@npm:^10.2.5, minimatch@npm:^9.0.3 || ^10.1.2": version: 10.2.5 resolution: "minimatch@npm:10.2.5" dependencies: @@ -28616,6 +28685,15 @@ __metadata: languageName: node linkType: hard +"napi-postinstall@npm:^0.3.4": + version: 0.3.4 + resolution: "napi-postinstall@npm:0.3.4" + bin: + napi-postinstall: lib/cli.js + checksum: 10/5541381508f9e1051ff3518701c7130ebac779abb3a1ffe9391fcc3cab4cc0569b0ba0952357db3f6b12909c3bb508359a7a60261ffd795feebbdab967175832 + languageName: node + linkType: hard + "nats@npm:^2.28.2": version: 2.28.2 resolution: "nats@npm:2.28.2" @@ -29213,17 +29291,6 @@ __metadata: languageName: node linkType: hard -"object.groupby@npm:^1.0.3": - version: 1.0.3 - resolution: "object.groupby@npm:1.0.3" - dependencies: - call-bind: "npm:^1.0.7" - define-properties: "npm:^1.2.1" - es-abstract: "npm:^1.23.2" - checksum: 10/44cb86dd2c660434be65f7585c54b62f0425b0c96b5c948d2756be253ef06737da7e68d7106e35506ce4a44d16aa85a413d11c5034eb7ce5579ec28752eb42d0 - languageName: node - linkType: hard - "object.values@npm:^1.1.6, object.values@npm:^1.2.1": version: 1.2.1 resolution: "object.values@npm:1.2.1" @@ -32775,7 +32842,7 @@ __metadata: languageName: node linkType: hard -"resolve@npm:^1.1.7, resolve@npm:^1.10.0, resolve@npm:^1.11.1, resolve@npm:^1.20.0, resolve@npm:^1.22.1, resolve@npm:^1.22.2, resolve@npm:^1.22.4, resolve@npm:^1.22.8": +"resolve@npm:^1.1.7, resolve@npm:^1.10.0, resolve@npm:^1.11.1, resolve@npm:^1.20.0, resolve@npm:^1.22.1, resolve@npm:^1.22.2, resolve@npm:^1.22.8": version: 1.22.8 resolution: "resolve@npm:1.22.8" dependencies: @@ -32831,7 +32898,7 @@ __metadata: languageName: node linkType: hard -"resolve@patch:resolve@npm%3A^1.1.7#optional!builtin, resolve@patch:resolve@npm%3A^1.10.0#optional!builtin, resolve@patch:resolve@npm%3A^1.11.1#optional!builtin, resolve@patch:resolve@npm%3A^1.20.0#optional!builtin, resolve@patch:resolve@npm%3A^1.22.1#optional!builtin, resolve@patch:resolve@npm%3A^1.22.2#optional!builtin, resolve@patch:resolve@npm%3A^1.22.4#optional!builtin, resolve@patch:resolve@npm%3A^1.22.8#optional!builtin": +"resolve@patch:resolve@npm%3A^1.1.7#optional!builtin, resolve@patch:resolve@npm%3A^1.10.0#optional!builtin, resolve@patch:resolve@npm%3A^1.11.1#optional!builtin, resolve@patch:resolve@npm%3A^1.20.0#optional!builtin, resolve@patch:resolve@npm%3A^1.22.1#optional!builtin, resolve@patch:resolve@npm%3A^1.22.2#optional!builtin, resolve@patch:resolve@npm%3A^1.22.8#optional!builtin": version: 1.22.8 resolution: "resolve@patch:resolve@npm%3A1.22.8#optional!builtin::version=1.22.8&hash=c3c19d" dependencies: @@ -35750,18 +35817,6 @@ __metadata: languageName: node linkType: hard -"tsconfig-paths@npm:^3.15.0": - version: 3.15.0 - resolution: "tsconfig-paths@npm:3.15.0" - dependencies: - "@types/json5": "npm:^0.0.29" - json5: "npm:^1.0.2" - minimist: "npm:^1.2.6" - strip-bom: "npm:^3.0.0" - checksum: 10/2041beaedc6c271fc3bedd12e0da0cc553e65d030d4ff26044b771fac5752d0460944c0b5e680f670c2868c95c664a256cec960ae528888db6ded83524e33a14 - languageName: node - linkType: hard - "tsconfig-paths@npm:^4.2.0": version: 4.2.0 resolution: "tsconfig-paths@npm:4.2.0" @@ -36457,6 +36512,82 @@ __metadata: languageName: node linkType: hard +"unrs-resolver@npm:^1.9.2": + version: 1.12.2 + resolution: "unrs-resolver@npm:1.12.2" + dependencies: + "@unrs/resolver-binding-android-arm-eabi": "npm:1.12.2" + "@unrs/resolver-binding-android-arm64": "npm:1.12.2" + "@unrs/resolver-binding-darwin-arm64": "npm:1.12.2" + "@unrs/resolver-binding-darwin-x64": "npm:1.12.2" + "@unrs/resolver-binding-freebsd-x64": "npm:1.12.2" + "@unrs/resolver-binding-linux-arm-gnueabihf": "npm:1.12.2" + "@unrs/resolver-binding-linux-arm-musleabihf": "npm:1.12.2" + "@unrs/resolver-binding-linux-arm64-gnu": "npm:1.12.2" + "@unrs/resolver-binding-linux-arm64-musl": "npm:1.12.2" + "@unrs/resolver-binding-linux-loong64-gnu": "npm:1.12.2" + "@unrs/resolver-binding-linux-loong64-musl": "npm:1.12.2" + "@unrs/resolver-binding-linux-ppc64-gnu": "npm:1.12.2" + "@unrs/resolver-binding-linux-riscv64-gnu": "npm:1.12.2" + "@unrs/resolver-binding-linux-riscv64-musl": "npm:1.12.2" + "@unrs/resolver-binding-linux-s390x-gnu": "npm:1.12.2" + "@unrs/resolver-binding-linux-x64-gnu": "npm:1.12.2" + "@unrs/resolver-binding-linux-x64-musl": "npm:1.12.2" + "@unrs/resolver-binding-openharmony-arm64": "npm:1.12.2" + "@unrs/resolver-binding-wasm32-wasi": "npm:1.12.2" + "@unrs/resolver-binding-win32-arm64-msvc": "npm:1.12.2" + "@unrs/resolver-binding-win32-ia32-msvc": "npm:1.12.2" + "@unrs/resolver-binding-win32-x64-msvc": "npm:1.12.2" + napi-postinstall: "npm:^0.3.4" + dependenciesMeta: + "@unrs/resolver-binding-android-arm-eabi": + optional: true + "@unrs/resolver-binding-android-arm64": + optional: true + "@unrs/resolver-binding-darwin-arm64": + optional: true + "@unrs/resolver-binding-darwin-x64": + optional: true + "@unrs/resolver-binding-freebsd-x64": + optional: true + "@unrs/resolver-binding-linux-arm-gnueabihf": + optional: true + "@unrs/resolver-binding-linux-arm-musleabihf": + optional: true + "@unrs/resolver-binding-linux-arm64-gnu": + optional: true + "@unrs/resolver-binding-linux-arm64-musl": + optional: true + "@unrs/resolver-binding-linux-loong64-gnu": + optional: true + "@unrs/resolver-binding-linux-loong64-musl": + optional: true + "@unrs/resolver-binding-linux-ppc64-gnu": + optional: true + "@unrs/resolver-binding-linux-riscv64-gnu": + optional: true + "@unrs/resolver-binding-linux-riscv64-musl": + optional: true + "@unrs/resolver-binding-linux-s390x-gnu": + optional: true + "@unrs/resolver-binding-linux-x64-gnu": + optional: true + "@unrs/resolver-binding-linux-x64-musl": + optional: true + "@unrs/resolver-binding-openharmony-arm64": + optional: true + "@unrs/resolver-binding-wasm32-wasi": + optional: true + "@unrs/resolver-binding-win32-arm64-msvc": + optional: true + "@unrs/resolver-binding-win32-ia32-msvc": + optional: true + "@unrs/resolver-binding-win32-x64-msvc": + optional: true + checksum: 10/ef2fc38e7a7c5e0cad9a5fb3a70abead3c8073955b444908f35a55f54ced1c08433324220810b04d9ef5adeff62982ade136793dcde8297505ca3556ee0bbb82 + languageName: node + linkType: hard + "update-browserslist-db@npm:^1.1.3": version: 1.1.3 resolution: "update-browserslist-db@npm:1.1.3" From cc63c0ff1220be0f4eaeaf58a3e7b0bd19cb80ec Mon Sep 17 00:00:00 2001 From: Tasso Evangelista Date: Thu, 16 Jul 2026 00:46:37 -0300 Subject: [PATCH 146/220] test: Remove virtual flag from CodeMirror spec mocks to fix flaky suite (#41407) --- .../Setting/inputs/CodeMirror/CodeMirror.spec.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/meteor/client/views/admin/settings/Setting/inputs/CodeMirror/CodeMirror.spec.tsx b/apps/meteor/client/views/admin/settings/Setting/inputs/CodeMirror/CodeMirror.spec.tsx index 65687901a0d17..95ff4597c908f 100644 --- a/apps/meteor/client/views/admin/settings/Setting/inputs/CodeMirror/CodeMirror.spec.tsx +++ b/apps/meteor/client/views/admin/settings/Setting/inputs/CodeMirror/CodeMirror.spec.tsx @@ -20,13 +20,13 @@ jest.mock('codemirror', () => ({ default: { fromTextArea: (...args: unknown[]) => fromTextArea(...(args as [])) }, })); -jest.mock('codemirror/addon/edit/matchbrackets', () => ({}), { virtual: true }); -jest.mock('codemirror/addon/edit/closebrackets', () => ({}), { virtual: true }); -jest.mock('codemirror/addon/edit/matchtags', () => ({}), { virtual: true }); -jest.mock('codemirror/addon/edit/trailingspace', () => ({}), { virtual: true }); -jest.mock('codemirror/addon/search/match-highlighter', () => ({}), { virtual: true }); -jest.mock('codemirror/lib/codemirror.css', () => ({}), { virtual: true }); -jest.mock('../../../../../../../app/ui/client/lib/codeMirror/codeMirror', () => ({}), { virtual: true }); +jest.mock('codemirror/addon/edit/matchbrackets', () => ({})); +jest.mock('codemirror/addon/edit/closebrackets', () => ({})); +jest.mock('codemirror/addon/edit/matchtags', () => ({})); +jest.mock('codemirror/addon/edit/trailingspace', () => ({})); +jest.mock('codemirror/addon/search/match-highlighter', () => ({})); +jest.mock('codemirror/lib/codemirror.css', () => ({})); +jest.mock('../../../../../../../app/ui/client/lib/codeMirror/codeMirror', () => ({})); const flushAsync = () => act(() => Promise.resolve()); From 8bbd1c6b50aaa578152ae300dd13ce800c496815 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Thu, 16 Jul 2026 00:58:10 -0300 Subject: [PATCH 147/220] refactor(api): pass this.user to permission checks in REST endpoints (#41367) --- apps/meteor/ee/server/api/ldap.ts | 2 +- apps/meteor/ee/server/api/licenses.ts | 4 +-- apps/meteor/ee/server/api/roles.ts | 2 +- .../ee/server/api/v1/omnichannel/rooms.ts | 4 +-- .../ee/server/api/v1/omnichannel/units.ts | 2 +- apps/meteor/server/api/v1/channels.ts | 12 +++---- apps/meteor/server/api/v1/chat.ts | 6 +--- apps/meteor/server/api/v1/e2e.ts | 2 +- apps/meteor/server/api/v1/groups.ts | 6 ++-- apps/meteor/server/api/v1/im.ts | 2 +- apps/meteor/server/api/v1/oauthapps.ts | 2 +- .../meteor/server/api/v1/omnichannel/agent.ts | 2 +- .../server/api/v1/omnichannel/departments.ts | 4 +-- apps/meteor/server/api/v1/omnichannel/room.ts | 2 +- .../meteor/server/api/v1/omnichannel/rooms.ts | 5 ++- .../meteor/server/api/v1/omnichannel/users.ts | 4 +-- apps/meteor/server/api/v1/roles.ts | 2 +- apps/meteor/server/api/v1/rooms.ts | 4 +-- apps/meteor/server/api/v1/settings.ts | 2 +- apps/meteor/server/api/v1/teams.ts | 36 +++++++++---------- apps/meteor/server/api/v1/users.ts | 30 ++++++++-------- 21 files changed, 65 insertions(+), 70 deletions(-) diff --git a/apps/meteor/ee/server/api/ldap.ts b/apps/meteor/ee/server/api/ldap.ts index 1472c87ae4773..e478ebc96b470 100644 --- a/apps/meteor/ee/server/api/ldap.ts +++ b/apps/meteor/ee/server/api/ldap.ts @@ -32,7 +32,7 @@ API.v1.post( throw new Error('error-invalid-user'); } - if (!(await hasPermissionAsync(this.userId, 'sync-auth-services-users'))) { + if (!(await hasPermissionAsync(this.user, 'sync-auth-services-users'))) { throw new Error('error-not-authorized'); } diff --git a/apps/meteor/ee/server/api/licenses.ts b/apps/meteor/ee/server/api/licenses.ts index 37eb0a6aead91..187bb3a496b1c 100644 --- a/apps/meteor/ee/server/api/licenses.ts +++ b/apps/meteor/ee/server/api/licenses.ts @@ -14,7 +14,7 @@ API.v1.addRoute( { authRequired: true, validateParams: isLicensesInfoProps }, { async get() { - const unrestrictedAccess = await hasPermissionAsync(this.userId, 'view-privileged-setting'); + const unrestrictedAccess = await hasPermissionAsync(this.user, 'view-privileged-setting'); const loadCurrentValues = unrestrictedAccess && Boolean(this.queryParams.loadValues); const license = await License.getInfo({ @@ -26,7 +26,7 @@ API.v1.addRoute( try { // TODO: Remove this logic after setting type object is implemented. const cloudSyncAnnouncement = JSON.parse(settings.get('Cloud_Sync_Announcement_Payload') ?? null); - const canManageCloud = await hasPermissionAsync(this.userId, 'manage-cloud'); + const canManageCloud = await hasPermissionAsync(this.user, 'manage-cloud'); return API.v1.success({ license, ...(canManageCloud && cloudSyncAnnouncement && { cloudSyncAnnouncement }), diff --git a/apps/meteor/ee/server/api/roles.ts b/apps/meteor/ee/server/api/roles.ts index ca2327fd1fa01..f28769fa22887 100644 --- a/apps/meteor/ee/server/api/roles.ts +++ b/apps/meteor/ee/server/api/roles.ts @@ -141,7 +141,7 @@ API.v1.addRoute( throw new Meteor.Error('error-invalid-role-properties', 'The role properties are invalid.'); } - if (!(await hasPermissionAsync(this.userId, 'access-permissions'))) { + if (!(await hasPermissionAsync(this.user, 'access-permissions'))) { throw new Meteor.Error('error-action-not-allowed', 'Accessing permissions is not allowed'); } diff --git a/apps/meteor/ee/server/api/v1/omnichannel/rooms.ts b/apps/meteor/ee/server/api/v1/omnichannel/rooms.ts index aba888a001110..73fa212c8aba2 100644 --- a/apps/meteor/ee/server/api/v1/omnichannel/rooms.ts +++ b/apps/meteor/ee/server/api/v1/omnichannel/rooms.ts @@ -30,7 +30,7 @@ API.v1.addRoute( } const subscription = await Subscriptions.findOneByRoomIdAndUserId(roomId, this.userId, { projection: { _id: 1 } }); - if (!subscription && !(await hasPermissionAsync(this.userId, 'on-hold-others-livechat-room'))) { + if (!subscription && !(await hasPermissionAsync(this.user, 'on-hold-others-livechat-room'))) { throw new Error('Not_authorized'); } @@ -71,7 +71,7 @@ API.v1.addRoute( } const subscription = await Subscriptions.findOneByRoomIdAndUserId(roomId, this.userId, { projection: { _id: 1 } }); - if (!subscription && !(await hasPermissionAsync(this.userId, 'on-hold-others-livechat-room'))) { + if (!subscription && !(await hasPermissionAsync(this.user, 'on-hold-others-livechat-room'))) { throw new Error('Not_authorized'); } diff --git a/apps/meteor/ee/server/api/v1/omnichannel/units.ts b/apps/meteor/ee/server/api/v1/omnichannel/units.ts index 04d312904f5fb..8c1e7d0fadbef 100644 --- a/apps/meteor/ee/server/api/v1/omnichannel/units.ts +++ b/apps/meteor/ee/server/api/v1/omnichannel/units.ts @@ -55,7 +55,7 @@ API.v1.addRoute( const { sort } = await this.parseJsonQuery(); const { text } = this.queryParams; - if (!(await hasPermissionAsync(this.userId, 'manage-livechat-units'))) { + if (!(await hasPermissionAsync(this.user, 'manage-livechat-units'))) { return API.v1.success(await findUnitsOfUser({ text, userId: this.userId, pagination: { offset, count, sort } })); } diff --git a/apps/meteor/server/api/v1/channels.ts b/apps/meteor/server/api/v1/channels.ts index d433b823ac749..b26e89221547d 100644 --- a/apps/meteor/server/api/v1/channels.ts +++ b/apps/meteor/server/api/v1/channels.ts @@ -328,7 +328,7 @@ API.v1.addRoute( // Special check for the permissions if ( - (await hasPermissionAsync(this.userId, 'view-joined-room')) && + (await hasPermissionAsync(this.user, 'view-joined-room')) && !(await Subscriptions.findOneByRoomIdAndUserId(findResult._id, this.userId, { projection: { _id: 1 } })) ) { return API.v1.forbidden(); @@ -532,7 +532,7 @@ API.v1.addRoute( return API.v1.failure('Channel not found'); } - if (!(await hasAllPermissionAsync(this.userId, ['create-team', 'edit-room'], room._id))) { + if (!(await hasAllPermissionAsync(this.user, ['create-team', 'edit-room'], room._id))) { return API.v1.forbidden(); } @@ -625,7 +625,7 @@ API.v1.addRoute( { authRequired: true }, { async get() { - const access = await hasPermissionAsync(this.userId, 'view-room-administration'); + const access = await hasPermissionAsync(this.user, 'view-room-administration'); const { userId } = this.queryParams; let user = this.userId; let unreads = null; @@ -787,7 +787,7 @@ API.v1.addRoute( } if (bodyParams.teams) { - const canSeeAllTeams = await hasPermissionAsync(this.userId, 'view-all-teams'); + const canSeeAllTeams = await hasPermissionAsync(this.user, 'view-all-teams'); const teams = await Team.listByNames(bodyParams.teams, { projection: { _id: 1 } }); const teamMembers = []; @@ -994,7 +994,7 @@ API.v1.addRoute( async get() { const { offset, count } = await getPaginationItems(this.queryParams); const { sort, fields, query } = await this.parseJsonQuery(); - const hasPermissionToSeeAllPublicChannels = await hasPermissionAsync(this.userId, 'view-c-room'); + const hasPermissionToSeeAllPublicChannels = await hasPermissionAsync(this.user, 'view-c-room'); const { _id } = this.queryParams; @@ -1106,7 +1106,7 @@ API.v1.addRoute( return API.v1.forbidden(); } - if (findResult.broadcast && !(await hasPermissionAsync(this.userId, 'view-broadcast-member-list', findResult._id))) { + if (findResult.broadcast && !(await hasPermissionAsync(this.user, 'view-broadcast-member-list', findResult._id))) { return API.v1.forbidden(); } diff --git a/apps/meteor/server/api/v1/chat.ts b/apps/meteor/server/api/v1/chat.ts index a5d0f940eb4a3..f47a1950b9f7d 100644 --- a/apps/meteor/server/api/v1/chat.ts +++ b/apps/meteor/server/api/v1/chat.ts @@ -565,11 +565,7 @@ const chatEndpoints = API.v1 return API.v1.failure('The room id provided does not match where the message is from.'); } - if ( - this.bodyParams.asUser && - msg.u._id !== this.userId && - !(await hasPermissionAsync(this.userId, 'force-delete-message', msg.rid)) - ) { + if (this.bodyParams.asUser && msg.u._id !== this.userId && !(await hasPermissionAsync(this.user, 'force-delete-message', msg.rid))) { return API.v1.failure('Unauthorized. You must have the permission "force-delete-message" to delete other\'s message as them.'); } diff --git a/apps/meteor/server/api/v1/e2e.ts b/apps/meteor/server/api/v1/e2e.ts index 0d1d003d3be9b..3266cf4f2a599 100644 --- a/apps/meteor/server/api/v1/e2e.ts +++ b/apps/meteor/server/api/v1/e2e.ts @@ -438,7 +438,7 @@ const e2eEndpoints = API.v1 async function action() { const { rid, e2eKey, e2eKeyId } = this.bodyParams; - if (!(await hasPermissionAsync(this.userId, 'toggle-room-e2e-encryption', rid))) { + if (!(await hasPermissionAsync(this.user, 'toggle-room-e2e-encryption', rid))) { return API.v1.forbidden('error-not-allowed'); } if (LockMap.has(rid)) { diff --git a/apps/meteor/server/api/v1/groups.ts b/apps/meteor/server/api/v1/groups.ts index 7836cd0f7ee3c..c1c85defeb810 100644 --- a/apps/meteor/server/api/v1/groups.ts +++ b/apps/meteor/server/api/v1/groups.ts @@ -258,7 +258,7 @@ API.v1.addRoute( { authRequired: true }, { async get() { - const access = await hasPermissionAsync(this.userId, 'view-room-administration'); + const access = await hasPermissionAsync(this.user, 'view-room-administration'); const params = this.queryParams; let user = this.userId; let room; @@ -744,7 +744,7 @@ API.v1.addRoute( userId: this.userId, }); - if (findResult.broadcast && !(await hasPermissionAsync(this.userId, 'view-broadcast-member-list', findResult.rid))) { + if (findResult.broadcast && !(await hasPermissionAsync(this.user, 'view-broadcast-member-list', findResult.rid))) { return API.v1.forbidden(); } @@ -1288,7 +1288,7 @@ API.v1.addRoute( return API.v1.failure('Private group not found'); } - if (!(await hasAllPermissionAsync(this.userId, ['create-team', 'edit-room'], room.rid))) { + if (!(await hasAllPermissionAsync(this.user, ['create-team', 'edit-room'], room.rid))) { return API.v1.forbidden(); } diff --git a/apps/meteor/server/api/v1/im.ts b/apps/meteor/server/api/v1/im.ts index 3cdbb172fe397..cae4eafadaaac 100644 --- a/apps/meteor/server/api/v1/im.ts +++ b/apps/meteor/server/api/v1/im.ts @@ -170,7 +170,7 @@ const dmDeleteAction = (_path: Path): TypedAction = {}; if (username) { @@ -556,7 +556,7 @@ API.v1.post( return API.v1.failure('team-does-not-exist'); } - if (!(await hasAtLeastOnePermissionAsync(this.userId, ['add-team-member', 'edit-team-member'], team.roomId))) { + if (!(await hasAtLeastOnePermissionAsync(this.user, ['add-team-member', 'edit-team-member'], team.roomId))) { return API.v1.forbidden(); } @@ -587,7 +587,7 @@ API.v1.post( return API.v1.failure('team-does-not-exist'); } - if (!(await hasAtLeastOnePermissionAsync(this.userId, ['edit-team-member'], team.roomId))) { + if (!(await hasAtLeastOnePermissionAsync(this.user, ['edit-team-member'], team.roomId))) { return API.v1.forbidden(); } @@ -618,7 +618,7 @@ API.v1.post( return API.v1.failure('team-does-not-exist'); } - if (!(await hasAtLeastOnePermissionAsync(this.userId, ['edit-team-member'], team.roomId))) { + if (!(await hasAtLeastOnePermissionAsync(this.user, ['edit-team-member'], team.roomId))) { return API.v1.forbidden(); } @@ -712,7 +712,7 @@ API.v1.get( return API.v1.failure('Room not found'); } - const canViewInfo = (await canAccessRoomAsync(room, { _id: this.userId })) || (await hasPermissionAsync(this.userId, 'view-all-teams')); + const canViewInfo = (await canAccessRoomAsync(room, { _id: this.userId })) || (await hasPermissionAsync(this.user, 'view-all-teams')); if (!canViewInfo) { return API.v1.forbidden(); @@ -743,7 +743,7 @@ API.v1.post( return API.v1.failure('team-does-not-exist'); } - if (!(await hasPermissionAsync(this.userId, 'delete-team', team.roomId))) { + if (!(await hasPermissionAsync(this.user, 'delete-team', team.roomId))) { return API.v1.forbidden(); } @@ -801,7 +801,7 @@ API.v1.post( return API.v1.failure('team-does-not-exist'); } - if (!(await hasPermissionAsync(this.userId, 'edit-team', team.roomId))) { + if (!(await hasPermissionAsync(this.user, 'edit-team', team.roomId))) { return API.v1.forbidden(); } diff --git a/apps/meteor/server/api/v1/users.ts b/apps/meteor/server/api/v1/users.ts index f5f2350bac349..551841632a3ee 100644 --- a/apps/meteor/server/api/v1/users.ts +++ b/apps/meteor/server/api/v1/users.ts @@ -237,7 +237,7 @@ API.v1 if ( this.bodyParams.userId && this.bodyParams.userId !== this.userId && - !(await hasPermissionAsync(this.userId, 'edit-other-user-info')) + !(await hasPermissionAsync(this.user, 'edit-other-user-info')) ) { throw new Meteor.Error('error-action-not-allowed', 'Editing user is not allowed'); } @@ -284,7 +284,7 @@ API.v1 }, }, async function action() { - const canEditOtherUserAvatar = await hasPermissionAsync(this.userId, 'edit-other-user-avatar'); + const canEditOtherUserAvatar = await hasPermissionAsync(this.user, 'edit-other-user-avatar'); if (!settings.get('Accounts_AllowUserAvatarChange') && !canEditOtherUserAvatar) { throw new Meteor.Error('error-not-allowed', 'Change avatar is not allowed', { @@ -338,7 +338,7 @@ API.v1 } const isAnotherUser = this.userId !== user._id; - if (isAnotherUser && !(await hasPermissionAsync(this.userId, 'edit-other-user-avatar'))) { + if (isAnotherUser && !(await hasPermissionAsync(this.user, 'edit-other-user-avatar'))) { throw new Meteor.Error('error-not-allowed', 'Not allowed'); } } @@ -615,7 +615,7 @@ API.v1.get( const myself = user._id === this.userId; - if (this.queryParams.includeUserRooms === 'true' && (myself || (await hasPermissionAsync(this.userId, 'view-other-user-channels')))) { + if (this.queryParams.includeUserRooms === 'true' && (myself || (await hasPermissionAsync(this.user, 'view-other-user-channels')))) { return API.v1.success({ user: { ...user, @@ -657,11 +657,11 @@ API.v1.addRoute( async get() { if ( settings.get('API_Apply_permission_view-outside-room_on_users-list') && - !(await hasPermissionAsync(this.userId, 'view-outside-room')) + !(await hasPermissionAsync(this.user, 'view-outside-room')) ) { return API.v1.forbidden(); } - const canViewFullOtherUserInfo = await hasPermissionAsync(this.userId, 'view-full-other-user-info'); + const canViewFullOtherUserInfo = await hasPermissionAsync(this.user, 'view-full-other-user-info'); const { offset, count } = await getPaginationItems(this.queryParams); const { sort, fields, query } = await this.parseJsonQuery(); @@ -800,7 +800,7 @@ API.v1.get( async function action() { if ( settings.get('API_Apply_permission_view-outside-room_on_users-list') && - !(await hasPermissionAsync(this.userId, 'view-outside-room')) + !(await hasPermissionAsync(this.user, 'view-outside-room')) ) { return API.v1.forbidden(); } @@ -963,8 +963,8 @@ API.v1.post( if (settings.get('Accounts_AllowUserAvatarChange') && user._id === this.userId) { await resetAvatar(this.userId, this.userId); } else if ( - (await hasPermissionAsync(this.userId, 'edit-other-user-avatar')) || - (await hasPermissionAsync(this.userId, 'manage-moderation-actions')) + (await hasPermissionAsync(this.user, 'edit-other-user-avatar')) || + (await hasPermissionAsync(this.user, 'manage-moderation-actions')) ) { await resetAvatar(this.userId, user._id); } else { @@ -1696,7 +1696,7 @@ API.v1.get( try { if (selector?.conditions) { - const canViewFullInfo = await hasPermissionAsync(this.userId, 'view-full-other-user-info'); + const canViewFullInfo = await hasPermissionAsync(this.user, 'view-full-other-user-info'); const allowedFields = canViewFullInfo ? [...Object.keys(defaultFields), ...Object.keys(fullFields)] : Object.keys(defaultFields); if (!isValidQuery(selector.conditions, allowedFields, ['$and', '$ne', '$exists'])) { @@ -1759,7 +1759,7 @@ API.v1 throw new Meteor.Error('error-invalid-user-id', 'Invalid user id'); } - if (!(await hasPermissionAsync(this.userId, 'edit-other-user-e2ee'))) { + if (!(await hasPermissionAsync(this.user, 'edit-other-user-e2ee'))) { throw new Meteor.Error('error-not-allowed', 'Not allowed'); } @@ -1796,7 +1796,7 @@ API.v1 }, async function action() { if ('userId' in this.bodyParams || 'username' in this.bodyParams || 'user' in this.bodyParams) { - if (!(await hasPermissionAsync(this.userId, 'edit-other-user-totp'))) { + if (!(await hasPermissionAsync(this.user, 'edit-other-user-totp'))) { throw new Meteor.Error('error-not-allowed', 'Not allowed'); } @@ -1849,7 +1849,7 @@ API.v1 const { userId } = this.queryParams; // If the caller has permission to view all teams, there's no need to filter the teams - const adminId = (await hasPermissionAsync(this.userId, 'view-all-teams')) ? undefined : this.userId; + const adminId = (await hasPermissionAsync(this.user, 'view-all-teams')) ? undefined : this.userId; const teams = await Team.findBySubscribedUserIds(userId, adminId); @@ -1881,7 +1881,7 @@ API.v1 async function action() { const userId = this.bodyParams.userId || this.userId; - if (userId !== this.userId && !(await hasPermissionAsync(this.userId, 'logout-other-user'))) { + if (userId !== this.userId && !(await hasPermissionAsync(this.user, 'logout-other-user'))) { return API.v1.forbidden(); } @@ -2000,7 +2000,7 @@ API.v1 if (isUserFromParams(this.bodyParams, this.userId, this.user)) { return Users.findOneById(this.userId); } - if (await hasPermissionAsync(this.userId, 'edit-other-user-info')) { + if (await hasPermissionAsync(this.user, 'edit-other-user-info')) { return getUserFromParams(this.bodyParams); } })(); From cff23f92392dc783851cf5f9d529e8d7a851f711 Mon Sep 17 00:00:00 2001 From: Yash Rajpal <58601732+yash-rajpal@users.noreply.github.com> Date: Thu, 16 Jul 2026 15:56:45 +0530 Subject: [PATCH 148/220] fix: Disable composer actions without subscription to channel (#41202) Co-authored-by: Douglas Fabris --- .changeset/light-geckos-start.md | 5 +++ .../MessageBoxActionsToolbar.tsx | 24 +++++++------ .../hooks/useCreateDiscussionAction.tsx | 4 +-- .../hooks/useShareLocationAction.tsx | 4 +-- .../hooks/useTimestampAction.tsx | 3 +- .../tests/e2e/page-objects/directory.ts | 15 +++++++- .../tests/e2e/preview-public-channel.spec.ts | 35 +++++++++++-------- 7 files changed, 59 insertions(+), 31 deletions(-) create mode 100644 .changeset/light-geckos-start.md diff --git a/.changeset/light-geckos-start.md b/.changeset/light-geckos-start.md new file mode 100644 index 0000000000000..4730b2b67b0d0 --- /dev/null +++ b/.changeset/light-geckos-start.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/meteor': patch +--- + +Disables more actions on message composer during public channel preview. diff --git a/apps/meteor/client/views/room/composer/messageBox/MessageBoxActionsToolbar/MessageBoxActionsToolbar.tsx b/apps/meteor/client/views/room/composer/messageBox/MessageBoxActionsToolbar/MessageBoxActionsToolbar.tsx index 5b9deef2845ec..30dfd370831d4 100644 --- a/apps/meteor/client/views/room/composer/messageBox/MessageBoxActionsToolbar/MessageBoxActionsToolbar.tsx +++ b/apps/meteor/client/views/room/composer/messageBox/MessageBoxActionsToolbar/MessageBoxActionsToolbar.tsx @@ -1,11 +1,10 @@ import type { IRoom, IMessage } from '@rocket.chat/core-typings'; -import type { Icon } from '@rocket.chat/fuselage'; import { isTruthy } from '@rocket.chat/tools'; import { GenericMenu, type GenericMenuItemProps } from '@rocket.chat/ui-client'; import { MessageComposerAction, MessageComposerActionsDivider } from '@rocket.chat/ui-composer'; import type { TranslationKey } from '@rocket.chat/ui-contexts'; import { useTranslation, useLayoutHiddenActions } from '@rocket.chat/ui-contexts'; -import type { ComponentProps, MouseEvent } from 'react'; +import type { MouseEvent } from 'react'; import { memo } from 'react'; import { useAudioMessageAction } from './hooks/useAudioMessageAction'; @@ -55,13 +54,15 @@ const MessageBoxActionsToolbar = ({ const room = useRoom(); - const audioMessageAction = useAudioMessageAction(!canSend || isRecording || isMicrophoneDenied, isMicrophoneDenied); - const videoMessageAction = useVideoMessageAction(!canSend || isRecording); - const fileUploadAction = useFileUploadAction(!canSend || isRecording || isEditing); - const webdavActions = useWebdavActions(!canSend || isRecording || isEditing); - const createDiscussionAction = useCreateDiscussionAction(room); - const shareLocationAction = useShareLocationAction(room, tmid); - const timestampAction = useTimestampAction(chatContext.composer); + const disableBasicActions = !canSend || isRecording || isEditing; + + const audioMessageAction = useAudioMessageAction(disableBasicActions || isMicrophoneDenied, isMicrophoneDenied); + const videoMessageAction = useVideoMessageAction(disableBasicActions); + const fileUploadAction = useFileUploadAction(disableBasicActions); + const webdavActions = useWebdavActions(disableBasicActions); + const createDiscussionAction = useCreateDiscussionAction(disableBasicActions, room); + const shareLocationAction = useShareLocationAction(disableBasicActions, room, tmid); + const timestampAction = useTimestampAction(!canSend || isRecording, chatContext.composer); const apps = useMessageboxAppsActionButtons(); const { composerToolbox: hiddenActions } = useLayoutHiddenActions(); @@ -112,7 +113,7 @@ const MessageBoxActionsToolbar = ({ .filter((item) => !hiddenActions.includes(item.id)) .map((item) => ({ id: item.id, - icon: item.icon as ComponentProps['name'], + icon: item.icon, content: t(item.label), onClick: (event?: MouseEvent) => item.action({ @@ -122,6 +123,7 @@ const MessageBoxActionsToolbar = ({ chat: chatContext, }), gap: Boolean(!item.icon), + disabled: disableBasicActions, })); return { @@ -147,7 +149,7 @@ const MessageBoxActionsToolbar = ({ {featured.map((action) => action && renderAction(action))} { +export const useCreateDiscussionAction = (disabled: boolean, room?: IRoom): GenericMenuItemProps => { const t = useTranslation(); const setModal = useSetModal(); @@ -28,7 +28,7 @@ export const useCreateDiscussionAction = (room?: IRoom): GenericMenuItemProps => id: 'create-discussion', content: t('Discussion'), icon: 'discussion', - disabled: !allowDiscussion, + disabled: !allowDiscussion || disabled, onClick: handleCreateDiscussion, }; }; diff --git a/apps/meteor/client/views/room/composer/messageBox/MessageBoxActionsToolbar/hooks/useShareLocationAction.tsx b/apps/meteor/client/views/room/composer/messageBox/MessageBoxActionsToolbar/hooks/useShareLocationAction.tsx index 71b0c35ce516c..34d20abb6ca9c 100644 --- a/apps/meteor/client/views/room/composer/messageBox/MessageBoxActionsToolbar/hooks/useShareLocationAction.tsx +++ b/apps/meteor/client/views/room/composer/messageBox/MessageBoxActionsToolbar/hooks/useShareLocationAction.tsx @@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next'; import ShareLocationModal from '../../../../ShareLocation/ShareLocationModal'; -export const useShareLocationAction = (room?: IRoom, tmid?: IMessage['tmid']): GenericMenuItemProps => { +export const useShareLocationAction = (disabled: boolean, room?: IRoom, tmid?: IMessage['tmid']): GenericMenuItemProps => { if (!room) { throw new Error('Invalid room'); } @@ -28,6 +28,6 @@ export const useShareLocationAction = (room?: IRoom, tmid?: IMessage['tmid']): G content: t('Location'), icon: 'map-pin', onClick: handleShareLocation, - disabled: !allowGeolocation, + disabled: !allowGeolocation || disabled, }; }; diff --git a/apps/meteor/client/views/room/composer/messageBox/MessageBoxActionsToolbar/hooks/useTimestampAction.tsx b/apps/meteor/client/views/room/composer/messageBox/MessageBoxActionsToolbar/hooks/useTimestampAction.tsx index 07d48d6cba0a8..6a5fa90ebb201 100644 --- a/apps/meteor/client/views/room/composer/messageBox/MessageBoxActionsToolbar/hooks/useTimestampAction.tsx +++ b/apps/meteor/client/views/room/composer/messageBox/MessageBoxActionsToolbar/hooks/useTimestampAction.tsx @@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next'; import { TimestampPickerModal } from '../../../../../../components/message/toolbar/items/actions/Timestamp/TimestampPicker/TimestampPickerModal'; import type { ComposerAPI } from '../../../../../../lib/chats/ChatAPI'; -export const useTimestampAction = (composer: ComposerAPI | undefined): GenericMenuItemProps | undefined => { +export const useTimestampAction = (disabled: boolean, composer: ComposerAPI | undefined): GenericMenuItemProps | undefined => { const setModal = useSetModal(); const { t } = useTranslation(); @@ -22,5 +22,6 @@ export const useTimestampAction = (composer: ComposerAPI | undefined): GenericMe icon: 'clock', content: t('Timestamp'), onClick: handleClick, + disabled, }; }; diff --git a/apps/meteor/tests/e2e/page-objects/directory.ts b/apps/meteor/tests/e2e/page-objects/directory.ts index 8d2c6ca605fd9..21ae3e8ea1c67 100644 --- a/apps/meteor/tests/e2e/page-objects/directory.ts +++ b/apps/meteor/tests/e2e/page-objects/directory.ts @@ -1,4 +1,4 @@ -import type { Page } from '@playwright/test'; +import type { Locator, Page } from '@playwright/test'; export class Directory { public readonly page: Page; @@ -19,4 +19,17 @@ export class Directory { await this.searchChannel(name); await this.getSearchByChannelName(name).click(); } + + async goto() { + await this.page.goto('/directory'); + await this.waitForDirectory(); + } + + private get directoryHeader(): Locator { + return this.page.locator('main').getByRole('heading', { name: 'Directory', exact: true }); + } + + private async waitForDirectory(): Promise { + await this.directoryHeader.waitFor(); + } } diff --git a/apps/meteor/tests/e2e/preview-public-channel.spec.ts b/apps/meteor/tests/e2e/preview-public-channel.spec.ts index 3fa4357174260..a33fd2011423b 100644 --- a/apps/meteor/tests/e2e/preview-public-channel.spec.ts +++ b/apps/meteor/tests/e2e/preview-public-channel.spec.ts @@ -35,15 +35,28 @@ test.describe('Preview public channel', () => { test.describe('User', () => { test.use({ storageState: Users.user1.state }); - test('should let user preview public rooms messages', async ({ page }) => { - await page.goto('/home'); - - await poHomeChannel.navbar.btnDirectory.click(); + test('should let user preview public rooms messages', async () => { + await poDirectory.goto(); await poDirectory.openChannel(targetChannel); await expect(poHomeChannel.content.lastUserMessageBody).toContainText(targetChannelMessage); }); + test('should disable all composer toolbar actions during channel preview', async () => { + await poDirectory.goto(); + await poDirectory.openChannel(targetChannel); + await poHomeChannel.content.waitForChannel(); + + await expect(poHomeChannel.composer.btnJoinRoom).toBeVisible(); + + const actions = await poHomeChannel.composer.allPrimaryActions.all(); + await Promise.all( + actions.map(async (action) => { + await expect(action).toBeDisabled(); + }), + ); + }); + test('should let user view direct rooms', async ({ api, page }) => { await api.post('/permissions.update', { permissions: [{ _id: 'preview-c-room', roles: ['admin'] }] }); await createDirectMessage(api); @@ -56,12 +69,10 @@ test.describe('Preview public channel', () => { await expect(poHomeChannel.composer.inputMessage).toBeEnabled(); }); - test('should not let user role preview public rooms', async ({ api, page }) => { + test('should not let user role preview public rooms', async ({ api }) => { await api.post('/permissions.update', { permissions: [{ _id: 'preview-c-room', roles: ['admin'] }] }); - await page.goto('/home'); - - await poHomeChannel.navbar.btnDirectory.click(); + await poDirectory.goto(); await poDirectory.openChannel(targetChannel); await expect(poHomeChannel.btnJoinChannel).toBeVisible(); @@ -76,9 +87,7 @@ test.describe('Preview public channel', () => { test('should prevent user from join the room', async ({ api, page }) => { await api.post('/permissions.update', { permissions: [{ _id: 'preview-c-room', roles: ['admin', 'user', 'anonymous'] }] }); - await page.goto('/home'); - - await poHomeChannel.navbar.btnDirectory.click(); + await poDirectory.goto(); await poDirectory.openChannel(targetChannel); await expect(poHomeChannel.content.lastUserMessageBody).toContainText(targetChannelMessage); @@ -95,9 +104,7 @@ test.describe('Preview public channel', () => { test('should prevent user from join the room without preview permission', async ({ api, page }) => { await api.post('/permissions.update', { permissions: [{ _id: 'preview-c-room', roles: ['admin'] }] }); - await page.goto('/home'); - - await poHomeChannel.navbar.btnDirectory.click(); + await poDirectory.goto(); await poDirectory.openChannel(targetChannel); await expect(poHomeChannel.content.lastUserMessageBody).not.toBeVisible(); From ae72939305517f47c08b5315bdb862554844e23b Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Thu, 16 Jul 2026 11:32:22 -0300 Subject: [PATCH 149/220] refactor(authorization): forward only { _id, roles } from hasPermission wrappers (#41413) --- apps/meteor/server/lib/authorization/hasPermission.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/meteor/server/lib/authorization/hasPermission.ts b/apps/meteor/server/lib/authorization/hasPermission.ts index aef811ef3a6fd..2cf2fa5cb6412 100644 --- a/apps/meteor/server/lib/authorization/hasPermission.ts +++ b/apps/meteor/server/lib/authorization/hasPermission.ts @@ -2,18 +2,23 @@ import { Authorization } from '@rocket.chat/core-services'; import type { UserWithRoles } from '@rocket.chat/core-services'; import type { IUser, IPermission, IRoom } from '@rocket.chat/core-typings'; +// Forward only the fields the permission check needs, so a full user document +// (with services, e2e keys, etc.) isn't serialized to the authorization service. +const toSubject = (user: IUser['_id'] | UserWithRoles): IUser['_id'] | UserWithRoles => + typeof user === 'string' ? user : { _id: user._id, roles: user.roles }; + export const hasAllPermissionAsync = async ( user: IUser['_id'] | UserWithRoles, permissions: IPermission['_id'][], scope?: IRoom['_id'], -): Promise => Authorization.hasAllPermission(user, permissions, scope); +): Promise => Authorization.hasAllPermission(toSubject(user), permissions, scope); export const hasPermissionAsync = async ( user: IUser['_id'] | UserWithRoles, permissionId: IPermission['_id'], scope?: IRoom['_id'], -): Promise => Authorization.hasPermission(user, permissionId, scope); +): Promise => Authorization.hasPermission(toSubject(user), permissionId, scope); export const hasAtLeastOnePermissionAsync = async ( user: IUser['_id'] | UserWithRoles, permissions: IPermission['_id'][], scope?: IRoom['_id'], -): Promise => Authorization.hasAtLeastOnePermission(user, permissions, scope); +): Promise => Authorization.hasAtLeastOnePermission(toSubject(user), permissions, scope); From abab8a02355991687851ee0281d03e751ad84c87 Mon Sep 17 00:00:00 2001 From: Tasso Evangelista Date: Thu, 16 Jul 2026 11:58:45 -0300 Subject: [PATCH 150/220] refactor: replace Fuselage styling prop shorthands with full prop names (#41418) --- .../apps/gameCenter/GameCenterContainer.tsx | 2 +- .../GameCenterInvitePlayersModal.tsx | 4 +- .../components/ActionManagerBusyState.tsx | 4 +- apps/meteor/client/components/Backdrop.tsx | 2 +- .../CreateDiscussion/CreateDiscussion.tsx | 2 +- .../meteor/client/components/FilterByText.tsx | 4 +- .../components/FingerprintChangeModal.tsx | 4 +- .../FingerprintChangeModalConfirmation.tsx | 4 +- .../GenericNoResults.stories.tsx | 2 +- .../GenericResourceUsage.tsx | 6 +-- .../GenericResourceUsageSkeleton.tsx | 15 ++++-- .../GenericUpsellModal/GenericUpsellModal.tsx | 2 +- .../client/components/ListItem.stories.tsx | 16 +++--- .../meteor/client/components/ListSkeleton.tsx | 4 +- .../client/components/NotFoundState.tsx | 2 +- .../RoomAutoComplete/RoomAutoComplete.tsx | 4 +- .../RoomAutoCompleteMultiple.tsx | 2 +- .../client/components/Sidebar/Content.tsx | 2 +- .../client/components/Sidebar/Header.tsx | 4 +- .../client/components/Sidebar/Sidebar.tsx | 4 +- .../components/Sidebar/SidebarGenericItem.tsx | 2 +- .../Sidebar/SidebarNavigationItem.tsx | 4 +- apps/meteor/client/components/Skeleton.tsx | 14 ++--- apps/meteor/client/components/TextCopy.tsx | 12 ++++- .../TwoFactorModal/TwoFactorEmailModal.tsx | 2 +- .../client/components/UrlChangeModal.tsx | 2 +- .../UserAndRoomAutoCompleteMultiple.tsx | 4 +- .../UserAutoCompleteMultiple.tsx | 4 +- .../UserAvatarChip.tsx | 2 +- .../client/components/UserCard/UserCard.tsx | 21 +++++--- .../components/UserCard/UserCardDialog.tsx | 4 +- .../components/UserCard/UserCardInfo.tsx | 2 +- .../components/UserCard/UserCardRole.tsx | 2 +- .../components/UserCard/UserCardRoles.tsx | 2 +- .../components/UserCard/UserCardSkeleton.tsx | 10 ++-- .../components/UserCard/UserCardUsername.tsx | 2 +- .../client/components/UserInfo/UserInfo.tsx | 2 +- .../UserInfo/UserInfoABACAttributes.tsx | 4 +- .../components/UserInfo/UserInfoAction.tsx | 4 +- .../UserStatusText/UserStatusText.tsx | 2 +- .../components/Wizard/WizardActions.tsx | 2 +- .../components/avatar/RoomAvatarEditor.tsx | 4 +- .../UserAvatarEditor/UserAvatarEditor.tsx | 16 +++--- .../UserAvatarSuggestions.tsx | 2 +- .../connectionStatus/ConnectionStatusBar.tsx | 4 +- .../deviceManagement/DeviceIcon.tsx | 6 +-- .../components/message/content/Action.tsx | 2 +- .../message/content/MessageActions.tsx | 2 +- .../attachments/default/ActionAttachtment.tsx | 2 +- .../content/attachments/default/Field.tsx | 2 +- .../attachments/default/FieldsAttachment.tsx | 2 +- .../attachments/file/AudioAttachment.tsx | 10 ++-- .../attachments/structure/Attachment.tsx | 2 +- .../structure/AttachmentAuthor.tsx | 2 +- .../structure/AttachmentAuthorName.tsx | 2 +- .../attachments/structure/AttachmentBlock.tsx | 2 +- .../structure/AttachmentContent.tsx | 2 +- .../structure/AttachmentDetails.tsx | 2 +- .../attachments/structure/AttachmentImage.tsx | 2 +- .../structure/AttachmentMessageLink.tsx | 2 +- .../attachments/structure/AttachmentRow.tsx | 2 +- .../attachments/structure/AttachmentText.tsx | 12 ++++- .../attachments/structure/AttachmentThumb.tsx | 2 +- .../attachments/structure/AttachmentTitle.tsx | 2 +- .../notification/AllMentionNotification.tsx | 2 +- .../notification/MeMentionNotification.tsx | 2 +- .../notification/MessageNotification.tsx | 6 +-- .../UnreadMessagesNotification.tsx | 2 +- .../Timestamp/TimestampPicker/DatePicker.tsx | 2 +- .../TimestampPicker/FormatSelector.tsx | 2 +- .../Timestamp/TimestampPicker/Preview.tsx | 2 +- .../Timestamp/TimestampPicker/TimePicker.tsx | 2 +- .../TimestampPicker/TimezoneSelector.tsx | 2 +- .../client/hooks/useShowSettingAlerts.tsx | 4 +- .../meteor/client/navbar/NavBarNavigation.tsx | 2 +- .../actions/CreateChannelModal.tsx | 4 +- .../actions/CreateDirectMessage.tsx | 2 +- .../actions/CreateTeamModal.tsx | 6 +-- .../navbar/NavBarSearch/NavBarSearch.tsx | 2 +- .../NavBarSearch/NavBarSearchListbox.tsx | 14 +++-- .../UserMenu/EditStatusModal.tsx | 2 +- .../UserMenu/KeyboardShortcutsModal.tsx | 14 ++--- .../UserMenu/UserMenuButton.tsx | 2 +- .../UserMenu/UserMenuHeader.tsx | 8 +-- .../UserMenu/hooks/useStatusItems.tsx | 4 +- .../client/sidebar/Item/Condensed.stories.tsx | 4 +- .../client/sidebar/Item/Extended.stories.tsx | 6 +-- .../client/sidebar/Item/Medium.stories.tsx | 4 +- .../sidebar/badges/SidebarItemBadges.tsx | 2 +- .../sidebar/footer/SidebarFooterDefault.tsx | 4 +- .../sidebar/footer/SidebarFooterWatermark.tsx | 6 +-- .../FederatedRoomList.tsx | 2 +- .../FederatedRoomListItem.tsx | 10 ++-- .../MatrixFederationManageServerModal.tsx | 4 +- .../MatrixFederationSearchModalContent.tsx | 4 +- .../sidebar/sections/NowPlayingSection.tsx | 2 +- .../client/sidebar/sections/SidebarCard.tsx | 10 +++- .../accessibility/AccessibilityPage.tsx | 29 ++++++++--- .../AccountFeaturePreviewPage.tsx | 8 +-- .../integrations/AccountIntegrationsPage.tsx | 2 +- .../OmnichannelPreferencesPage.tsx | 2 +- .../PreferencesConversationTranscript.tsx | 6 +-- .../preferences/AccountPreferencesPage.tsx | 2 +- .../views/account/preferences/MyDataModal.tsx | 2 +- .../preferences/PreferencesSoundSection.tsx | 6 +-- .../account/profile/AccountProfileForm.tsx | 6 +-- .../account/profile/AccountProfilePage.tsx | 4 +- .../account/profile/ActionConfirmModal.tsx | 2 +- .../account/security/AccountSecurityPage.tsx | 4 +- .../account/security/BackupCodesModal.tsx | 6 +-- .../account/security/ChangePassphrase.tsx | 8 +-- .../views/account/security/EndToEnd.tsx | 2 +- .../account/security/ResetPassphrase.tsx | 4 +- .../views/account/security/TwoFactorEmail.tsx | 2 +- .../views/account/security/TwoFactorTOTP.tsx | 6 +-- .../tokens/AccountTokensTable/AddToken.tsx | 2 +- .../AttributesForm.stories.tsx | 4 +- .../ABAC/ABACAttributesTab/AttributesForm.tsx | 12 +++-- .../ABAC/ABACAttributesTab/AttributesPage.tsx | 4 +- .../views/admin/ABAC/ABACLogsTab/LogsPage.tsx | 2 +- .../admin/ABAC/ABACRoomsTab/RoomForm.tsx | 4 +- .../ABACRoomsTab/RoomFormAttributeField.tsx | 6 +-- .../ABACRoomsTab/RoomFormAttributeFields.tsx | 2 +- .../ABACRoomsTab/RoomFormAutocomplete.tsx | 2 +- .../admin/ABAC/ABACRoomsTab/RoomsPage.tsx | 6 +-- .../ABAC/ABACSettingTab/SettingsPage.tsx | 2 +- .../client/views/admin/ABAC/AdminABACPage.tsx | 2 +- .../admin/customEmoji/AddCustomEmoji.tsx | 4 +- .../views/admin/customEmoji/CustomEmoji.tsx | 4 +- .../admin/customEmoji/EditCustomEmoji.tsx | 6 +-- .../customEmoji/EditCustomEmojiWithData.tsx | 2 +- .../admin/customSounds/AddCustomSound.tsx | 2 +- .../CustomSoundsTable.stories.tsx | 2 +- .../CustomSoundsTable/CustomSoundsTable.tsx | 2 +- .../admin/customSounds/EditCustomSound.tsx | 2 +- .../views/admin/customSounds/EditSound.tsx | 4 +- .../customUserStatus/CustomUserStatusForm.tsx | 2 +- .../CustomUserStatusFormWithData.tsx | 4 +- .../CustomUserStatusService.tsx | 18 +++---- .../DeviceManagementInfo.tsx | 2 +- .../views/admin/emailInbox/EmailInboxForm.tsx | 2 +- .../EngagementDashboardCard.tsx | 4 +- .../EngagementDashboardCardFilter.tsx | 2 +- .../EngagementDashboardPage.tsx | 2 +- .../users/ContentForHours.tsx | 2 +- .../AdminFeaturePreviewPage.tsx | 6 +-- .../views/admin/import/ImportProgressPage.tsx | 2 +- .../views/admin/import/PrepareImportPage.tsx | 2 +- .../EditIntegrationsPageWithData.tsx | 16 +++--- .../admin/integrations/IntegrationsTable.tsx | 2 +- .../views/admin/integrations/NewBot.tsx | 2 +- .../views/admin/integrations/NewZapier.tsx | 6 +-- .../incoming/IncomingWebhookForm.tsx | 2 +- .../outgoing/OutgoingWebhookForm.tsx | 2 +- .../outgoing/history/HistoryContent.tsx | 18 +++---- .../outgoing/history/HistoryItem.tsx | 30 +++++------ .../views/admin/invites/InvitesPage.tsx | 10 ++-- .../client/views/admin/mailer/MailerPage.tsx | 2 +- .../views/admin/moderation/UserMessages.tsx | 4 +- .../moderation/UserReports/UserReportInfo.tsx | 4 +- .../admin/moderation/helpers/UserColumn.tsx | 2 +- .../views/admin/oauthApps/EditOauthApp.tsx | 4 +- .../admin/oauthApps/EditOauthAppWithData.tsx | 4 +- .../views/admin/oauthApps/OAuthAddApp.tsx | 4 +- .../views/admin/permissions/EditRolePage.tsx | 2 +- .../admin/permissions/PermissionsPage.tsx | 2 +- .../PermissionsTable.stories.tsx | 2 +- .../PermissionsTable/RoleHeader.tsx | 2 +- .../UsersInRole/UsersInRolePage.tsx | 6 +-- .../UsersInRoleTable.stories.tsx | 2 +- .../UsersInRoleTable/UsersInRoleTable.tsx | 2 +- .../UsersInRoleTable/UsersInRoleTableRow.tsx | 4 +- .../client/views/admin/rooms/EditRoom.tsx | 4 +- .../client/views/admin/rooms/RoomRow.tsx | 2 +- .../client/views/admin/rooms/RoomsTable.tsx | 21 +++++--- .../views/admin/rooms/RoomsTableFilters.tsx | 6 +-- .../settings/Setting/MemoizedSetting.tsx | 2 +- .../views/admin/settings/Setting/Setting.tsx | 4 +- .../Setting/inputs/BooleanSettingInput.tsx | 2 +- .../inputs/CodeMirror/CodeMirrorBox.tsx | 12 ++--- .../Setting/inputs/RangeSettingInput.tsx | 2 +- .../views/admin/settings/SettingsPage.tsx | 4 +- .../views/admin/sidebar/AdminSidebarPages.tsx | 2 +- .../SubscriptionCalloutLimits.tsx | 8 +-- .../admin/subscription/SubscriptionPage.tsx | 22 ++++---- .../subscription/SubscriptionPageSkeleton.tsx | 10 ++-- .../components/FeatureUsageCardBody.tsx | 2 +- .../components/UpgradeToGetMore.tsx | 6 +-- .../subscription/components/UsagePieGraph.tsx | 2 +- .../components/cards/ActiveSessionsCard.tsx | 2 +- .../cards/ActiveSessionsPeakCard.tsx | 2 +- .../AppsUsageCard/AppsUsageCardSection.tsx | 4 +- .../components/cards/CountMACCard.tsx | 2 +- .../components/cards/CountSeatsCard.tsx | 2 +- .../components/cards/FeaturesCard.tsx | 4 +- .../ManageLicenseModal/LicenseFilePreview.tsx | 4 +- .../ManageLicenseModal/ManageLicenseModal.tsx | 8 +-- .../cards/PlanCard/PlanCardCommunity.tsx | 4 +- .../cards/PlanCard/PlanCardHeader.tsx | 2 +- .../cards/PlanCard/PlanCardLicenseDetails.tsx | 4 +- .../cards/PlanCard/PlanCardPremium.tsx | 6 +-- .../cards/PlanCard/PlanCardTrial.tsx | 10 +++- .../views/admin/users/AdminInviteUsers.tsx | 6 +-- .../views/admin/users/AdminUserForm.tsx | 28 ++++++---- .../admin/users/AdminUserFormWithData.tsx | 6 +-- .../admin/users/AdminUserInfoWithData.tsx | 2 +- .../AdminUserSetRandomPasswordContent.tsx | 10 +++- .../AdminUserSetRandomPasswordRadios.tsx | 8 +-- .../views/admin/users/AdminUserUpgrade.tsx | 2 +- .../views/admin/users/AdminUsersPage.tsx | 4 +- .../admin/users/PasswordFieldSkeleton.tsx | 10 ++-- .../admin/users/UsersTable/UsersTable.tsx | 4 +- .../users/UsersTable/UsersTableFilters.tsx | 4 +- .../admin/users/UsersTable/UsersTableRow.tsx | 2 +- .../views/admin/viewLogs/AnalyticsReports.tsx | 20 ++++--- .../components/VersionCardActionItem.tsx | 2 +- .../components/VersionCardSkeleton.tsx | 6 +-- .../modals/RegisterWorkspaceModal.tsx | 4 +- .../RegisterWorkspaceSetupStepOneModal.tsx | 6 +-- .../RegisterWorkspaceSetupStepTwoModal.tsx | 8 +-- .../modals/RegisterWorkspaceTokenModal.tsx | 2 +- .../modals/RegisteredWorkspaceModal.tsx | 2 +- .../views/admin/workspace/WorkspacePage.tsx | 8 +-- .../components/WorkspaceCardTextSeparator.tsx | 2 +- apps/meteor/client/views/audit/AuditPage.tsx | 2 +- .../views/audit/components/AuditForm.tsx | 2 +- .../audit/components/AuditModalField.tsx | 2 +- .../audit/components/AuditModalLabel.tsx | 2 +- .../components/SecurityLogDisplayModal.tsx | 2 +- .../audit/components/SecurityLogsTable.tsx | 4 +- .../AudioMessageRecorder.tsx | 14 +++-- .../composer/EmojiPicker/EmojiCategoryRow.tsx | 2 +- .../composer/EmojiPicker/EmojiPicker.tsx | 2 +- .../EmojiPickerDesktopDropdown.tsx | 13 ++++- .../EmojiPicker/ToneSelector/ToneSelector.tsx | 2 +- .../VideoMessageRecorder.tsx | 6 +-- .../client/views/directory/RoomTags.tsx | 2 +- .../channels/ChannelsTable/ChannelsTable.tsx | 8 +-- .../ChannelsTable/ChannelsTableRow.tsx | 4 +- .../tabs/teams/TeamsTable/TeamsTable.tsx | 4 +- .../tabs/teams/TeamsTable/TeamsTableRow.tsx | 4 +- .../tabs/users/UsersTable/UsersTableRow.tsx | 4 +- .../EnterE2EPasswordModal.tsx | 2 +- .../client/views/e2e/SaveE2EPasswordModal.tsx | 6 +-- .../client/views/home/DefaultHomePage.tsx | 6 +-- .../client/views/home/HomepageGridItem.tsx | 2 +- .../views/home/cards/CustomContentCard.tsx | 4 +- .../AppDetailsPage/AppDetailsPage.tsx | 6 +-- .../AppDetailsPage/AppDetailsPageHeader.tsx | 18 +++---- .../AppDetailsPage/AppDetailsPageLoading.tsx | 10 ++-- .../tabs/AppDetails/AppDetails.tsx | 20 +++---- .../tabs/AppDetails/AppDetailsAPIs.tsx | 4 +- .../tabs/AppInstances/AppInstances.tsx | 4 +- .../AppDetailsPage/tabs/AppLogs/AppLogs.tsx | 2 +- .../tabs/AppLogs/AppLogsItem.tsx | 10 ++-- .../tabs/AppLogs/AppLogsItemField.tsx | 2 +- .../AppLogs/Components/CollapseButton.tsx | 2 +- .../AppLogs/Filters/AppLogsFilter.stories.tsx | 2 +- .../tabs/AppLogs/Filters/AppLogsFilter.tsx | 14 ++--- .../Filters/AppLogsFilterContextualBar.tsx | 12 ++--- .../AppLogs/Filters/DateTimeModal.stories.tsx | 2 +- .../tabs/AppLogs/Filters/DateTimeModal.tsx | 4 +- .../Filters/ExportLogsModal.stories.tsx | 2 +- .../tabs/AppLogs/Filters/ExportLogsModal.tsx | 4 +- .../tabs/AppReleases/AppReleasesItem.tsx | 2 +- .../tabs/AppRequests/AppRequestItem.tsx | 10 ++-- .../tabs/AppRequests/AppRequests.tsx | 6 +-- .../tabs/AppRequests/AppRequestsLoading.tsx | 6 +-- .../tabs/AppSecurity/AppSecurity.tsx | 4 +- .../tabs/AppSecurity/AppSecurityLabel.tsx | 2 +- .../tabs/AppSettings/AppSettings.tsx | 2 +- .../tabs/AppStatus/AppStatus.tsx | 6 +-- .../views/marketplace/AppExemptModal.tsx | 2 +- .../views/marketplace/AppInstallPage.tsx | 4 +- .../marketplace/AppPermissionsReviewModal.tsx | 4 +- .../views/marketplace/AppsList/AppsList.tsx | 4 +- .../marketplace/AppsPage/AppsFilters.tsx | 2 +- .../AppsPage/AppsPageConnectionError.tsx | 2 +- .../AppsPage/AppsPageContentBody.tsx | 2 +- .../AppsPage/AppsPageContentSkeleton.tsx | 14 ++--- .../AppsPage/NoAppRequestsEmptyState.tsx | 2 +- .../NoInstalledAppMatchesEmptyState.tsx | 2 +- .../AppsPage/NoInstalledAppsEmptyState.tsx | 2 +- ...etplaceOrInstalledAppMatchesEmptyState.tsx | 2 +- .../AppsPage/PrivateEmptyState.tsx | 2 +- .../AppsPage/UnsupportedEmptyState.tsx | 2 +- .../client/views/marketplace/IframeModal.tsx | 2 +- .../components/AccordionLoading.tsx | 2 +- .../CategoryDropDown.stories.tsx | 2 +- .../CategoryFilter/CategoryDropDownAnchor.tsx | 18 +++---- .../CategoryFilter/CategoryDropDownList.tsx | 4 +- .../components/MarketplaceHeader.tsx | 2 +- .../PrivateAppInstallModal.tsx | 2 +- .../components/RadioButtonList.tsx | 4 +- .../RadioDropDown/RadioDownAnchor.tsx | 8 +-- .../components/ScreenshotCarousel.tsx | 14 +++-- .../components/ScreenshotCarouselAnchor.tsx | 4 +- .../views/marketplace/hooks/useAppMenu.tsx | 12 ++--- .../CallHistoryPageFilters.tsx | 8 +-- .../sidebar/RoomList/OmnichannelFilters.tsx | 2 +- .../sidebar/RoomList/TeamCollabFilters.tsx | 2 +- .../sidebar/badges/SidebarItemBadges.tsx | 2 +- .../sidepanel/SidePanelInternal.tsx | 6 +-- .../SidepanelItem/SidePanelTagIcon.tsx | 2 +- .../SidePanelPriorityTag.tsx | 2 +- .../views/notAuthorized/NotAuthorizedPage.tsx | 2 +- .../client/views/oauth/components/Layout.tsx | 2 +- .../BusinessHoursMultiple.stories.tsx | 2 +- .../omnichannel/agents/AgentEditWithData.tsx | 2 +- .../views/omnichannel/agents/AgentInfo.tsx | 4 +- .../agents/AgentsTable/AddAgent.tsx | 2 +- .../agents/AgentsTable/AgentsTable.tsx | 2 +- .../agents/AgentsTable/AgentsTableRow.tsx | 4 +- .../omnichannel/analytics/AnalyticsPage.tsx | 18 +++---- .../omnichannel/analytics/DateRangePicker.tsx | 8 +-- .../analytics/InterchangeableChart.tsx | 4 +- .../views/omnichannel/analytics/Overview.tsx | 6 +-- .../appearance/AppearanceFieldLabel.tsx | 2 +- .../omnichannel/appearance/AppearancePage.tsx | 2 +- .../BusinessHoursForm.stories.tsx | 2 +- .../businessHours/BusinessHoursForm.tsx | 8 +-- .../BusinessHoursTable.stories.tsx | 2 +- .../businessHours/EditBusinessHours.tsx | 2 +- .../components/CannedResponseForm.tsx | 2 +- .../CannedResponsesComposer.tsx | 2 +- .../CannedResponsesComposerPreview.tsx | 12 ++++- .../InsertPlaceholderDropdown.tsx | 10 ++-- .../CannedResponse/CannedResponse.stories.tsx | 2 +- .../CannedResponse/CannedResponse.tsx | 22 ++++---- .../CannedResponse/CannedResponseList.tsx | 6 +-- .../CannedResponse/Item.stories.tsx | 2 +- .../contextualBar/CannedResponse/Item.tsx | 14 ++--- .../modals/CannedResponseEdit.tsx | 2 +- .../modals/CannedResponseEditWithData.tsx | 2 +- .../CannedResponseEditWithDepartmentData.tsx | 2 +- .../modals/CannedResponseFilter.tsx | 14 ++--- .../modals/CannedResponsesTable.tsx | 4 +- .../components/AgentInfoDetails.tsx | 4 +- .../omnichannel/components/CustomField.tsx | 2 +- .../views/omnichannel/components/Field.tsx | 2 +- .../omnichannel/components/FormSkeleton.tsx | 6 +-- .../views/omnichannel/components/Label.tsx | 2 +- .../components/OmnichannelVerificationTag.tsx | 2 +- .../views/omnichannel/components/Tags.tsx | 6 +-- .../AutoCompleteDepartmentAgent.tsx | 4 +- .../OutboundMessagePreview.tsx | 4 +- .../OutboundMessagePreview/PreviewItem.tsx | 2 +- .../OutboundMessageWizard.tsx | 2 +- .../OutboundMessageWizardSkeleton.tsx | 16 +++--- .../components/RetryButton.tsx | 2 +- .../forms/MessageForm/MessageForm.tsx | 4 +- .../forms/RecipientForm/RecipientForm.tsx | 4 +- .../RecipientForm/components/ContactField.tsx | 2 +- .../forms/RepliesForm/RepliesForm.tsx | 4 +- .../TemplatePlaceholderInput.tsx | 8 ++- .../TemplatePlaceholderSelector.tsx | 2 +- .../components/TemplatePreview.tsx | 4 +- .../OutboundMessageModal.tsx | 9 +++- .../ContactHistoryMessagesList.tsx | 6 +-- .../contactInfo/ContactInfo/ContactInfo.tsx | 8 +-- .../ContactInfo/ReviewContactModal.tsx | 2 +- .../contactInfo/EditContactInfo.tsx | 8 +-- .../ContactInfoChannels.tsx | 4 +- .../ContactInfoChannelsItem.tsx | 10 ++-- .../ContactInfoDetails/ContactInfoDetails.tsx | 2 +- .../ContactInfoDetailsEntry.tsx | 4 +- .../ContactInfoDetails/ContactManagerInfo.tsx | 4 +- .../ContactInfoHistory/ContactInfoHistory.tsx | 8 +-- .../ContactInfoHistoryItem.tsx | 14 ++--- .../ContactInfoHistoryMessages.tsx | 6 +-- .../customFields/CustomFieldsForm.stories.tsx | 2 +- .../customFields/CustomFieldsTable.tsx | 2 +- .../customFields/EditCustomFields.tsx | 2 +- .../DepartmentAgentsTable/AddAgent.tsx | 2 +- .../DepartmentAgentsTable/AgentAvatar.tsx | 2 +- .../DepartmentAgentsTable.tsx | 8 +-- .../departments/DepartmentTags.tsx | 4 +- .../DepartmentsTable/DepartmentsTable.tsx | 2 +- .../RemoveDepartmentModal.tsx | 4 +- .../departments/EditDepartment.tsx | 10 ++-- .../EditDepartmentWithAllowedForwardData.tsx | 2 +- .../departments/EditDepartmentWithData.tsx | 4 +- .../directory/OmnichannelDirectoryPage.tsx | 2 +- .../directory/chats/ChatInfo/ChatInfo.tsx | 4 +- .../chats/ChatInfo/RoomEdit/RoomEdit.tsx | 2 +- .../ChatInfo/RoomEdit/RoomEditWithData.tsx | 4 +- .../directory/chats/ChatsTable/ChatsTable.tsx | 4 +- .../chats/ChatsTable/ChatsTableFilter.tsx | 4 +- .../chats/ChatsTable/ChatsTableRow.tsx | 4 +- .../directory/components/AgentField.tsx | 7 ++- .../directory/components/ContactField.tsx | 4 +- .../directory/components/FormSkeleton.tsx | 14 ++--- .../directory/components/PriorityField.tsx | 2 +- .../directory/components/SlaField.tsx | 2 +- .../directory/components/SourceField.tsx | 2 +- .../directory/contacts/ContactTable.tsx | 4 +- .../directory/contacts/ContactTableRow.tsx | 2 +- .../directory/contacts/RemoveContactModal.tsx | 4 +- .../views/omnichannel/managers/AddManager.tsx | 2 +- .../omnichannel/managers/ManagersTable.tsx | 6 +-- .../modals/EnterpriseDepartmentsModal.tsx | 2 +- .../omnichannel/modals/ForwardChatModal.tsx | 4 +- .../omnichannel/monitors/MonitorsTable.tsx | 4 +- .../priorities/PrioritiesTable.tsx | 2 +- .../priorities/PriorityEditFormWithData.tsx | 2 +- .../omnichannel/queueList/QueueListFilter.tsx | 14 ++--- .../omnichannel/queueList/QueueListTable.tsx | 4 +- .../RealTimeMonitoringPage.tsx | 52 ++++++++++++------- .../counter/CounterItem.tsx | 4 +- .../realTimeMonitoring/counter/CounterRow.tsx | 13 ++++- .../views/omnichannel/reports/ReportsPage.tsx | 2 +- .../reports/components/ReportCard.tsx | 4 +- .../components/ReportCardLoadingState.tsx | 2 +- .../reports/sections/AgentsSection.tsx | 4 +- .../views/omnichannel/slaPolicies/SlaEdit.tsx | 2 +- .../slaPolicies/SlaEditWithData.tsx | 2 +- .../omnichannel/slaPolicies/SlaTable.tsx | 2 +- .../client/views/omnichannel/tags/TagEdit.tsx | 2 +- .../omnichannel/tags/TagEditWithData.tsx | 2 +- .../tags/TagEditWithDepartmentData.tsx | 2 +- .../views/omnichannel/tags/TagsTable.tsx | 2 +- .../views/omnichannel/units/UnitEdit.tsx | 2 +- .../omnichannel/units/UnitEditWithData.tsx | 2 +- .../views/omnichannel/units/UnitsTable.tsx | 2 +- .../omnichannel/webhooks/WebhooksPage.tsx | 12 +++-- .../OutlookEventsList/OutlookEventItem.tsx | 4 +- .../OutlookEventsList/OutlookEventsList.tsx | 2 +- .../OutlookSettingItem.tsx | 6 +-- .../Omnichannel/OmnichannelRoomHeaderTag.tsx | 2 +- .../client/views/room/Header/RoomTitle.tsx | 2 +- .../client/views/room/NotSubscribedRoom.tsx | 2 +- apps/meteor/client/views/room/RoomOpener.tsx | 2 +- .../client/views/room/RoomOpenerEmbedded.tsx | 2 +- .../room/body/RetentionPolicyWarning.tsx | 2 +- .../client/views/room/body/RoomBody.tsx | 2 +- .../room/body/RoomForeword/RoomForeword.tsx | 8 +-- .../client/views/room/body/RoomInviteBody.tsx | 4 +- .../room/body/UnreadMessagesIndicator.tsx | 2 +- .../UploadProgressIndicator.tsx | 2 +- .../composer/ComposerAirGappedRestricted.tsx | 2 +- .../views/room/composer/ComposerAnonymous.tsx | 2 +- .../views/room/composer/ComposerBoxPopup.tsx | 14 +++-- .../room/composer/ComposerBoxPopupPreview.tsx | 10 ++-- .../ComposerOmnichannelCallout.tsx | 2 +- .../ComposerUserActionIndicator.tsx | 2 +- .../composer/messageBox/MessageBoxReplies.tsx | 2 +- .../AutoTranslate/AutoTranslate.tsx | 2 +- .../contextualBar/BannedUsers/BannedUsers.tsx | 6 +-- .../Discussions/DiscussionsList.tsx | 8 +-- .../components/DiscussionsListItem.tsx | 2 +- .../Info/EditRoomInfo/EditRoomInfo.tsx | 2 +- .../RoomInfo/ABAC/RoomInfoABACSection.tsx | 18 ++++--- .../contextualBar/Info/RoomInfo/RoomInfo.tsx | 6 +-- .../MessageSearchTab/MessageSearchTab.tsx | 2 +- .../components/MessageSearchForm.tsx | 4 +- .../NotificationPreferencesForm.tsx | 2 +- .../components/NotificationByDevice.tsx | 2 +- .../PruneMessagesDateTimeRow.tsx | 6 +-- .../RoomFiles/RoomFileItemWrapper.tsx | 4 +- .../contextualBar/RoomFiles/RoomFiles.tsx | 6 +-- .../RoomFiles/components/FileItem.tsx | 2 +- .../RoomFiles/components/ImageItem.tsx | 2 +- .../AddMatrixUsers/AddMatrixUsersModal.tsx | 9 ++-- .../AddUsers/BannedUsersUnbanModal.tsx | 4 +- .../InviteUsers/EditInviteLink.tsx | 2 +- .../RoomMembers/InviteUsers/InviteLink.tsx | 4 +- .../InviteUsers/InviteUsersLoading.tsx | 2 +- .../contextualBar/RoomMembers/RoomMembers.tsx | 12 ++--- .../RoomMembers/RoomMembersItem.tsx | 2 +- .../room/contextualBar/Threads/ThreadList.tsx | 8 +-- .../Threads/components/ThreadChat.tsx | 2 +- .../Threads/components/ThreadListMessage.tsx | 4 +- .../Threads/components/ThreadSkeleton.tsx | 2 +- .../UserInfo/ReportUserModal.tsx | 6 +-- .../UserInfo/UserInfoActions.tsx | 2 +- .../UserInfo/UserInfoWithData.tsx | 2 +- .../VideoConference/VideoConfBlockModal.tsx | 4 +- .../VideoConference/VideoConfConfigModal.tsx | 6 +-- .../VideoConfList/VideoConfList.tsx | 2 +- .../VideoConfList/VideoConfListItem.tsx | 8 +-- .../client/views/room/layout/RoomLayout.tsx | 2 +- .../modals/E2EEModals/DisableE2EEModal.tsx | 6 +-- .../modals/E2EEModals/EnableE2EEModal.tsx | 2 +- .../modals/E2EEModals/ResetKeysE2EEModal.tsx | 2 +- .../FileUploadModal/FileUploadModal.tsx | 2 +- .../modals/FileUploadModal/GenericPreview.tsx | 4 +- .../modals/FileUploadModal/MediaPreview.tsx | 6 +-- .../FileUploadModal/PreviewSkeleton.tsx | 2 +- .../PinMessageModal/PinMessageModal.tsx | 4 +- .../ReactionListModal/ReactionUserTag.tsx | 2 +- .../modals/ReactionListModal/Reactions.tsx | 4 +- .../ReadReceiptsModal/ReadReceiptRow.tsx | 4 +- .../ReportMessageModal/ReportMessageModal.tsx | 2 +- .../FilePickerBreadcrumbs.tsx | 2 +- .../WebdavFilePickerGrid.tsx | 4 +- .../WebdavFilePickerTable.tsx | 4 +- .../root/MainLayout/LayoutWithSidebar.tsx | 2 +- .../root/MainLayout/RegisterUsername.tsx | 2 +- .../MainLayout/TwoFactorAuthSetupCheck.tsx | 2 +- .../ChannelDesertionTable.tsx | 4 +- .../AddExistingModal/AddExistingModal.tsx | 2 +- .../RoomsAvailableForTeamsAutoComplete.tsx | 4 +- .../channels/TeamsChannelItem.tsx | 2 +- .../contextualBar/channels/TeamsChannels.tsx | 12 ++--- .../ModalSteps/FirstStep.tsx | 4 +- .../ChannelDeletionTable.tsx | 4 +- .../info/DeleteTeam/DeleteTeamChannels.tsx | 2 +- .../teams/contextualBar/info/TeamsInfo.tsx | 6 +-- .../RemoveUsersModal/RemoveUsersFirstStep.tsx | 2 +- apps/uikit-playground/src/App.tsx | 2 +- .../ComponentSideBar/ScrollableSideBar.tsx | 4 +- .../Components/ComponentSideBar/SideBar.tsx | 2 +- .../Components/ComponentSideBar/SliderBtn.tsx | 2 +- .../CreateNewScreenContainer.tsx | 4 +- .../src/Components/DropDown/DropDown.tsx | 2 +- .../src/Components/DropDown/Items.tsx | 2 +- .../UIKitWrapper/UIKitWrapper.tsx | 4 +- .../HomeContainer/HomeContainer.tsx | 2 +- .../ProjectsList/ProjectsList.tsx | 2 +- .../src/Components/NavBar/Divider.tsx | 2 +- .../src/Components/NavBar/NavBar.tsx | 4 +- .../src/Components/NavBar/RightNavBtn.tsx | 2 +- .../Display/Surface/ContextualBarSurface.tsx | 2 +- .../Preview/Display/Surface/Surface.tsx | 2 +- .../Preview/Editor/ActionBlockEditor.tsx | 2 +- .../Preview/Editor/ActionPreviewEditor.tsx | 2 +- .../Components/Preview/Editor/EditorPanel.tsx | 2 +- .../Components/Preview/NavPanel/NavPanel.tsx | 6 +-- .../src/Components/Preview/Preview.tsx | 4 +- .../PrototypeRender/PrototypeRender.tsx | 6 +-- .../PtototypeContainer/PrototypeContainer.tsx | 2 +- .../ScreenThumbnail/EditMenu/EditMenu.tsx | 8 +-- .../EditableLabel/EditableLabel.tsx | 4 +- .../ScreenThumbnailWrapper.tsx | 8 +-- .../Components/ScreenThumbnail/Thumbnail.tsx | 2 +- .../Templates/Container/Payload.tsx | 2 +- .../Templates/Container/Section.tsx | 6 +-- .../src/Components/Templates/Templates.tsx | 2 +- .../src/Components/navMenu/Menu/Wrapper.tsx | 4 +- .../src/Components/navMenu/Menu/index.tsx | 2 +- .../src/Components/navMenu/NavMenu.tsx | 2 +- .../src/Pages/FlowDiagram.tsx | 2 +- apps/uikit-playground/src/Pages/Home.tsx | 2 +- .../uikit-playground/src/Pages/Playground.tsx | 9 +++- apps/uikit-playground/src/Pages/Prototype.tsx | 2 +- .../src/Pages/SignInSignUp.tsx | 16 +++--- .../fuselage-ui-kit/src/blocks/InfoCard.tsx | 6 +-- .../ChannelsSelectElement.tsx | 4 +- .../MultiChannelsSelectElement.tsx | 2 +- .../src/elements/CheckboxElement.tsx | 4 +- .../src/elements/RadioButtonElement.tsx | 4 +- .../src/elements/ToggleSwitchElement.tsx | 4 +- .../MultiUsersSelectElement.tsx | 4 +- .../UsersSelectElement/UsersSelectElement.tsx | 4 +- .../AnnouncementBanner/AnnouncementBanner.tsx | 4 +- .../Contextualbar/ContextualbarHeader.tsx | 2 +- .../ContextualbarSkeletonBody.tsx | 4 +- .../ui-client/src/components/DotLeader.tsx | 10 +++- .../EmojiPicker/EmojiPickerCategoryHeader.tsx | 2 +- .../EmojiPicker/EmojiPickerContainer.tsx | 4 +- .../EmojiPicker/EmojiPickerFooter.tsx | 11 +++- .../EmojiPicker/EmojiPickerHeader.tsx | 2 +- .../EmojiPicker/EmojiPickerListArea.tsx | 2 +- .../EmojiPicker/EmojiPickerLoadMore.tsx | 2 +- .../EmojiPicker/EmojiPickerNotFound.tsx | 2 +- .../EmojiPicker/EmojiPickerPreview.tsx | 2 +- .../EmojiPicker/EmojiPickerPreviewArea.tsx | 4 +- .../src/components/FilePreviewIcon.tsx | 2 +- .../GenericTable/GenericTable.stories.tsx | 2 +- .../components/GenericTable/GenericTable.tsx | 2 +- .../GenericTable/GenericTableLoadingRow.tsx | 2 +- .../src/components/Header/Header.tsx | 4 +- .../src/components/Header/HeaderAvatar.tsx | 2 +- .../src/components/Header/HeaderContent.tsx | 2 +- .../components/Header/HeaderContentRow.tsx | 2 +- .../src/components/Header/HeaderDivider.tsx | 2 +- .../src/components/Header/HeaderState.tsx | 2 +- .../src/components/Header/HeaderSubtitle.tsx | 2 +- .../components/Header/HeaderTag/HeaderTag.tsx | 2 +- .../Header/HeaderTag/HeaderTagIcon.tsx | 2 +- .../src/components/Header/HeaderTitle.tsx | 4 +- .../HeaderToolbar/HeaderToolbarDivider.tsx | 2 +- .../src/components/InfoPanel/InfoPanel.tsx | 2 +- .../components/InfoPanel/InfoPanelField.tsx | 2 +- .../components/InfoPanel/InfoPanelLabel.tsx | 4 +- .../components/InfoPanel/InfoPanelSection.tsx | 2 +- .../components/InfoPanel/InfoPanelText.tsx | 2 +- .../components/InfoPanel/InfoPanelTitle.tsx | 2 +- .../Modal/GenericModal/withDoNotAskAgain.tsx | 2 +- .../MultiSelectCustomAnchor.tsx | 2 +- .../MultiSelectCustomList.tsx | 27 +++++++--- .../MultiSelectCustomListWrapper.tsx | 2 +- .../ui-client/src/components/Page/Page.tsx | 2 +- .../src/components/Page/PageBlock.tsx | 4 +- .../src/components/Page/PageFooter.tsx | 2 +- .../components/Page/PageHeaderNoShadow.tsx | 4 +- .../PasswordVerifier/PasswordVerifierItem.tsx | 4 +- .../PasswordVerifier/PasswordVerifierList.tsx | 4 +- .../src/components/TextSeparator.tsx | 2 +- .../UserAutoComplete/UserAutoComplete.tsx | 4 +- .../src/components/Wizard/Wizard.stories.tsx | 6 +-- .../src/components/Wizard/WizardActions.tsx | 4 +- .../src/MessageComposer/MessageComposer.tsx | 6 +-- .../MessageComposerActionsDivider.tsx | 2 +- .../MessageComposerFile.tsx | 4 +- .../MessageComposerFileGroup.tsx | 6 +-- .../MessageComposer/MessageComposerHint.tsx | 4 +- .../MessageComposer/MessageComposerIcon.tsx | 4 +- .../MessageComposer/MessageComposerInput.tsx | 4 +- .../MessageComposerSkeleton.tsx | 2 +- .../MessageComposerToolbar.tsx | 2 +- .../MessageFooterCallout.tsx | 4 +- .../MessageFooterCalloutAction.tsx | 2 +- .../MessageFooterCalloutContent.tsx | 2 +- .../MessageFooterCalloutDivider.tsx | 2 +- .../src/VideoConfMessage/VideoConfMessage.tsx | 2 +- .../VideoConfMessageButton.tsx | 4 +- .../VideoConfMessageFooter.tsx | 2 +- .../VideoConfMessageFooterText.tsx | 2 +- .../VideoConfMessage/VideoConfMessageRow.tsx | 4 +- .../VideoConfMessageSkeleton.tsx | 4 +- .../VideoConfMessage/VideoConfMessageText.tsx | 2 +- .../VideoConfMessageUserStack.tsx | 6 +-- .../src/VideoConfPopup/VideoConfPopup.tsx | 2 +- .../VideoConfPopup/VideoConfPopupBackdrop.tsx | 2 +- .../VideoConfPopup/VideoConfPopupContent.tsx | 2 +- .../VideoConfPopup/VideoConfPopupFooter.tsx | 2 +- .../src/VideoConfPopup/VideoConfPopupInfo.tsx | 4 +- .../VideoConfPopup/VideoConfPopupSkeleton.tsx | 2 +- .../VideoConfPopup/VideoConfPopupTitle.tsx | 2 +- .../src/components/Actions/ActionStrip.tsx | 4 +- .../components/CallHistoryExternalUser.tsx | 4 +- .../components/CallHistoryInternalUser.tsx | 4 +- .../src/components/CallHistoryUnknownUser.tsx | 2 +- .../ui-voip/src/components/Cards/Card.tsx | 2 +- .../ui-voip/src/components/Cards/CardList.tsx | 4 +- .../src/components/Cards/CardListSection.tsx | 11 +++- .../components/Cards/PeerCard/PeerCard.tsx | 2 +- .../Cards/PeerCard/PeerCardSlot.tsx | 4 +- .../ui-voip/src/components/Keypad/Key.tsx | 4 +- .../src/components/PeerAutocomplete.tsx | 4 +- .../src/components/PeerInfo/InternalUser.tsx | 4 +- .../src/components/PeerInfo/PhoneNumber.tsx | 2 +- .../src/components/Widget/WidgetContent.tsx | 2 +- .../src/components/Widget/WidgetFooter.tsx | 2 +- .../src/components/Widget/WidgetHeader.tsx | 4 +- .../src/components/Widget/WidgetInfo.tsx | 8 +-- .../useDraggable.stories.tsx | 10 ++-- .../CallHistoryContextualbar.tsx | 8 +-- .../CallHistoryTableDirection.tsx | 2 +- .../CallHistoryTableStatus.tsx | 2 +- .../ui-voip/src/views/MediaCallPopoutView.tsx | 8 +-- .../src/views/MediaCallPopoutWindow.tsx | 2 +- .../MediaCallRoomActivity.tsx | 4 +- .../MediaCallRoomSection.tsx | 6 +-- .../MediaCallWidget.stories.tsx | 2 +- .../src/views/MediaCallWidget/NewCall.tsx | 2 +- .../src/views/MediaCallWidget/OngoingCall.tsx | 8 +-- .../MediaCallWidget/OngoingCallWithScreen.tsx | 2 +- .../ui-voip/src/views/PopoutDockPrompt.tsx | 8 +-- packages/ui-voip/src/views/TransferModal.tsx | 2 +- packages/web-ui-registration/src/CMSPage.tsx | 4 +- .../web-ui-registration/src/LoginServices.tsx | 2 +- .../src/ResetPasswordForm.tsx | 2 +- .../src/components/LoginPoweredBy.tsx | 2 +- .../components/LoginSwitchLanguageFooter.tsx | 2 +- .../src/template/HorizontalTemplate.tsx | 2 +- .../src/template/VerticalTemplate.tsx | 2 +- 668 files changed, 1625 insertions(+), 1364 deletions(-) diff --git a/apps/meteor/client/apps/gameCenter/GameCenterContainer.tsx b/apps/meteor/client/apps/gameCenter/GameCenterContainer.tsx index c6b9b95ffe120..5c2467482af1e 100644 --- a/apps/meteor/client/apps/gameCenter/GameCenterContainer.tsx +++ b/apps/meteor/client/apps/gameCenter/GameCenterContainer.tsx @@ -29,7 +29,7 @@ const GameCenterContainer = ({ handleClose, handleBack, game }: IGameCenterConta {handleClose && } - +