Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
174 commits
Select commit Hold shift + click to select a range
81d1ab8
vite-meteor [skip ci]
cardoso Jan 14, 2026
3d11406
fix: avatar [skip ci]
cardoso Jan 15, 2026
a6c8548
fix: assets [skip ci]
cardoso Jan 15, 2026
3c28d51
fix: context exports [skip ci]
cardoso Jan 15, 2026
2fe06fd
feat: exclude meteor packages [skip ci]
cardoso Jan 15, 2026
28a2d89
chore: replace meteor/promises and meteor/fetchi [skip ci]
cardoso Jan 16, 2026
ff938dd
fix: exclude replaced packages [skip ci]
cardoso Jan 16, 2026
ba904a0
chore: remove/replace more meteor imports [skip ci]
cardoso Jan 16, 2026
488c000
chore: move vite plugin to a separate file [skip ci]
cardoso Jan 16, 2026
69ec1bb
feat: rocketchat-info plugin [skip ci]
cardoso Jan 16, 2026
ed1ab6e
chore: replace/remove more meteor packages [skip ci]
cardoso Jan 16, 2026
169fc33
chore: remove ostrio_cookies [skip ci]
cardoso Jan 16, 2026
b8ed7a2
chore: use rolldown parseAst [skip ci]
cardoso Jan 16, 2026
bac6c03
chore: simplify parsing [skip ci]
cardoso Jan 16, 2026
c8254e9
refactor: separate meteor-runtime, meteor-stubs plugins [skip ci]
cardoso Jan 18, 2026
ff2b142
chore: add lib/ast [skip ci]
cardoso Jan 18, 2026
3ff34bb
chore: clean up vite-plugin [skip ci]
cardoso Jan 19, 2026
b1df947
feat(vite): detect localhost [skip ci]
cardoso Jan 20, 2026
52b5118
feat(vite): proxy file uploads [skip ci]
cardoso Jan 20, 2026
86d03e6
chore: refactor [skip ci]
cardoso Jan 22, 2026
a5f8776
refactor: combine meteor plugins [skip ci]
cardoso Jan 22, 2026
3cc22bc
chore: update deps [skip ci]
cardoso Jan 25, 2026
415581b
chore: break circular imports [skip ci]
cardoso Jan 25, 2026
2a5dcc1
chore: break roomCoordinator import cycle [skip ci]
cardoso Jan 25, 2026
4221e46
chore: update deps [skip ci]
cardoso Jan 26, 2026
717cd75
chore: DISABLE_SOCK_JS [skip ci]
cardoso Jan 26, 2026
4d36365
chore: simplify meteor export collection [skip ci]
cardoso Jan 27, 2026
cddd7cf
refactor: reduce virtual module logic [skip ci]
cardoso Jan 27, 2026
a6021d2
chore: move require to runtime [skip ci]
cardoso Jan 27, 2026
9747e52
refactor: simplify plugins [skip ci]
cardoso Jan 28, 2026
07a9657
chore: return array of plugins [skip ci]
cardoso Jan 28, 2026
b41d6cd
feat: globals and resolve plugin
cardoso Jan 29, 2026
3bb5a08
chore: missing type export [skip ci]
cardoso Jan 29, 2026
e8bb4a7
chore: inject meteor runtime config in html [skip ci]
cardoso Jan 30, 2026
8b3b8fd
chore: fix rebase issues [skip ci]
cardoso Jan 30, 2026
72c92a4
feat: build [skip ci]
cardoso Jan 30, 2026
fedbb12
chore: update deps [skip ci]
cardoso Feb 1, 2026
d991797
feat: basic treeshaking of modules.js
cardoso Feb 1, 2026
20acb3c
chore: update vite and oxc deps [skip ci]
cardoso Feb 2, 2026
65f99bf
chore: remove stylesheet copy [skip ci]
cardoso Feb 2, 2026
5ce6b70
refactor: remove backend files [skip ci]
cardoso Feb 2, 2026
8660e36
feat: add base tag to index.html [skip ci]
cardoso Feb 2, 2026
df6c42c
refactor: css import path in index.ts [skip ci]
cardoso Feb 2, 2026
44c149b
chore: remove backend scripts [skip ci]
cardoso Feb 2, 2026
8ac3255
feat: enable manifest generation in Vite config [skip ci]
cardoso Feb 2, 2026
67168c4
fix: esm build [skip ci]
cardoso Feb 2, 2026
f13059c
feat: treeshake plugin [skip ci]
cardoso Feb 3, 2026
20a8ff6
chore: use ctx instead of console [skip ci]
cardoso Feb 3, 2026
71d5b83
chore: update deps [skip ci]
cardoso Feb 3, 2026
96925ed
chore: remove unused files and scripts [skip ci]
cardoso Feb 3, 2026
381069b
fix: clean up config and add emoji-custom proxy [skip ci]
cardoso Feb 3, 2026
4dd0abb
chore: remove rocketchat:streamer meteor package
cardoso Feb 4, 2026
44ff14e
fix: update vite entry point [skip ci]
cardoso Feb 4, 2026
4ea33a1
feat: treeshaking and dce improvements [skip ci]
cardoso Feb 5, 2026
a448ffc
chore: remove meteor/rocketchat:streamer ambient declaration
cardoso Feb 5, 2026
ff84715
chore: simplify treeshaking [skip ci]
cardoso Feb 5, 2026
f0f4eee
feat: add dockerfiles [skip ci]
cardoso Feb 5, 2026
899ed04
fix: ROOT_URL and meteor-node-stubs (electron) [skip ci]
cardoso Feb 5, 2026
6dda226
chore: update vite [skip ci]
cardoso Feb 6, 2026
4f81e2c
feat: meteor module replacement
cardoso Feb 6, 2026
e874819
chore: replace meteor/ordered-dict [skip ci]
cardoso Feb 7, 2026
1704579
chore: replace meteor/sha [skip ci]
cardoso Feb 7, 2026
f731a6f
chore: replace meteor/url [skip ci]
cardoso Feb 7, 2026
15c023c
chore: replace meteor/service-configuration [skip ci]
cardoso Feb 7, 2026
aee1517
chore: replace meteor/check [skip ci]
cardoso Feb 7, 2026
e24ada5
chore: replace meteor/logging [skip ci]
cardoso Feb 7, 2026
e4ae6e9
chore: replace meteor/{mongo, mongo-id, id-map, ddp-client} [skip ci]
cardoso Feb 7, 2026
693cf71
chore: replace meteor/{meteor,ejson,minimongo,diff-sequence} [skip ci]
cardoso Feb 7, 2026
2702b50
fix: imports/exports [skip ci]
cardoso Feb 7, 2026
02e81fb
chore: replace meteor/ddp-common [skip ci]
cardoso Feb 7, 2026
b1c3442
chore: replace meteor/allow-deny [skip ci]
cardoso Feb 7, 2026
03d2c0a
chore: replace meteor/reload [skip ci]
cardoso Feb 7, 2026
155abad
chore: replace meteor/geojson-utils [skip ci]
cardoso Feb 7, 2026
bb9a6e0
chore: refactor reload.ts [skip ci]
cardoso Feb 8, 2026
357a3ba
chore: replace meteor/accounts-base [skip ci]
cardoso Feb 8, 2026
ad458c7
chore: refactor geojson-utils.ts [skip ci]
cardoso Feb 8, 2026
beb1e5e
chore: replace meteor/oauth & meteor/accounts-oauth [skip ci]
cardoso Feb 8, 2026
67d276c
chore: replace meteor/accounts-password [skip ci]
cardoso Feb 8, 2026
52bae7e
chore: replace remaining meteor packages [skip ci]
cardoso Feb 8, 2026
ac55ffd
chore: refactor some meteor replacements [skip ci]
cardoso Feb 8, 2026
e8f0449
chore: refactor some meteor replacements [skip ci]
cardoso Feb 9, 2026
eafbe2f
chore: refactor oauth replacements [skip ci]
cardoso Feb 9, 2026
a7f68c2
chore: fix typescript errors [skip ci]
cardoso Feb 10, 2026
850f412
chore: refactor minimongo.ts [skip ci]
cardoso Feb 10, 2026
601f94c
chore: more refactors [skip ci]
cardoso Feb 10, 2026
5f1853d
chore: more refactors [skip ci]
cardoso Feb 11, 2026
d944f6d
chore: refactor mongo.ts [skip ci]
cardoso Feb 11, 2026
7fa2676
feat: add docker-vite.sh script [skip ci]
cardoso Feb 11, 2026
3e7c62f
fix: export messages [skip ci]
cardoso Feb 11, 2026
198272b
chore: refactor accounts-base.ts [skip ci]
cardoso Feb 11, 2026
b8af39c
chore: move setup to separate file [skip ci]
cardoso Feb 12, 2026
3f336b5
chore: make meteor client entry noop [skip ci]
cardoso Feb 12, 2026
0009fe1
chore: refactor ddp-client, minimongo, mongo [skip ci]
cardoso Feb 12, 2026
c7ccd39
ci: run tests using standalone client (experiment)
cardoso Feb 12, 2026
6aa87f6
ci: skip checks for now (experiment)
cardoso Feb 12, 2026
dd7bba3
ci(vite): install meteor before building backend [experiment]
cardoso Feb 12, 2026
bb2eef1
ci(vite): fix path issues
cardoso Feb 12, 2026
bee6a04
ci(vite): fix space issues
cardoso Feb 12, 2026
290cc55
ci(vite): fix traefik config
cardoso Feb 12, 2026
6640fa8
ci(vite): update traefik version
cardoso Feb 12, 2026
8c561f7
ci(vite): fix traefik routing
cardoso Feb 12, 2026
4ce4f33
ci(vite): add traefik entry points
cardoso Feb 12, 2026
8731523
ci(vite): fix docker api
cardoso Feb 12, 2026
1902d57
ci(vite): update traefik
cardoso Feb 12, 2026
ba4305f
ci(vite): fix backend path
cardoso Feb 13, 2026
23a3322
ci(vite): fix api and assets routing
cardoso Feb 13, 2026
c278541
feat(vite): typia stub plugin
cardoso Feb 13, 2026
4f9f267
feat(vite): stub require
cardoso Feb 13, 2026
95af8ba
feat: replace meteor/{reactive-dict, session}
cardoso Feb 13, 2026
6a794e3
ci(vite): proxy i18n
cardoso Feb 13, 2026
64407ef
fix(ddp-streamer): missing msg field
cardoso Feb 13, 2026
e4e45fa
chore: revert changes to server/lib/i18n.ts
cardoso Feb 15, 2026
896d125
chore: update dependencies
cardoso Feb 15, 2026
56d4c69
fix(vite): proxy meteor_runtime_config.js
cardoso Feb 15, 2026
033f8ec
fix: add missing imports to overrideLoginMethod.ts
cardoso Feb 15, 2026
f448093
fix: saml routing
cardoso Feb 15, 2026
994a185
fix(nginx): add charset
cardoso Feb 15, 2026
a4bd25d
chore(vite): add stop script
cardoso Feb 15, 2026
d2f19db
fix(vite): dedupe react-aria and react-stately
cardoso Feb 15, 2026
caf3eae
fix(vite): dedupe react-i18next, fuselage, and fuselage-hooks
cardoso Feb 16, 2026
ab043a1
chore(livechat): add missing meteor/tracker import
cardoso Feb 16, 2026
125a779
chore: undo server-side changes
cardoso Feb 16, 2026
7341dd4
fix(vite): saml redirect
cardoso Feb 16, 2026
41a75d2
ci: update nginx config to emit less logs
cardoso Feb 18, 2026
aba83aa
fix: apply meteor-run-as-user overrides
cardoso Feb 18, 2026
2cef755
fix: add some dedupes
cardoso Feb 18, 2026
edf7f03
fix: alias react-aria
cardoso Feb 18, 2026
504593e
Revert "fix: apply meteor-run-as-user overrides"
cardoso Feb 18, 2026
e3fa5de
fix: rebase mistake
cardoso Feb 20, 2026
f157181
chore: update vite
cardoso Feb 20, 2026
404dcc8
chore: skip cors test
cardoso Feb 20, 2026
2a4b070
fix: proxy hooks
cardoso Feb 20, 2026
507889e
fix: proxy oauth
cardoso Feb 20, 2026
5fa4e46
fix: proxy matrix
cardoso Feb 20, 2026
5e2c98e
fix: proxy ufs
cardoso Feb 21, 2026
18a94a3
chore: improve frontend build
cardoso Feb 21, 2026
c867066
ci: remove unneeded broken step
cardoso Feb 21, 2026
dccac72
chore: remove old nginx.conf
cardoso Feb 21, 2026
e3a4f90
chore: remove temporary code and dependencies
cardoso Feb 21, 2026
63a115a
chore: remove obsolete meteor modules
cardoso Feb 21, 2026
4f9edca
chore: improve script
cardoso Feb 22, 2026
ea99d6b
chore: sourcemaps in test mode
cardoso Feb 22, 2026
c2433b4
chore: remove dead code
cardoso Feb 22, 2026
14c6210
chore: undo more server-side changes
cardoso Feb 22, 2026
8248352
chore: remove unused files
cardoso Feb 23, 2026
357f7d8
chore: simplify dockerfiles
cardoso Feb 23, 2026
9f389ba
fix: remove SAML debounce
cardoso Feb 23, 2026
b1744e2
chore: refactor geojson-utils
cardoso Feb 23, 2026
6313034
chore: refactor diff-sequence.ts
cardoso Feb 23, 2026
2d89ec0
chore: add script for local e2e testing
cardoso Feb 23, 2026
99513ff
chore: istanbul coverage
cardoso Feb 23, 2026
437e00b
chore: update scripts
cardoso Feb 23, 2026
e68e0bd
fix: rebase issue
cardoso Feb 23, 2026
c957939
chore: safer coverage collection
cardoso Feb 23, 2026
274cca0
chore: suppress regular nginx logs
cardoso Feb 23, 2026
4143cd6
chore: always report coverage (temporary)
cardoso Feb 23, 2026
4db8e2a
chore: optimize instrumentation
cardoso Feb 23, 2026
9133368
chore: update scripts
cardoso Feb 23, 2026
0b73038
chore: use smaller nginx image for frontend
cardoso Feb 24, 2026
73b56dc
chore: undo formatting change
cardoso Feb 24, 2026
5c476a5
chore: undo api-client change
cardoso Feb 24, 2026
5cae0f5
chore: report coverage even if some tests failed
cardoso Feb 24, 2026
7da214e
fix: behavior differences in tracker
cardoso Feb 24, 2026
64403ca
chore: temporary fix for generate lcov
cardoso Feb 25, 2026
2bde89c
chore: fix formatting
cardoso Feb 26, 2026
2aac6ef
chore: fix formatting
cardoso Feb 26, 2026
a9dab22
Revert "fix: remove SAML debounce"
cardoso Feb 27, 2026
dfdb406
chore: update upload-artifact
cardoso Feb 27, 2026
b63949f
chore: update vite
cardoso Feb 27, 2026
25a9bd2
feat: allow serving vite frontend from meteor
cardoso Mar 2, 2026
475cfed
chore: update vite
cardoso Mar 2, 2026
fbf6109
chore(vite-meteor): serve frontend in monolith
cardoso Mar 2, 2026
c13a094
chore: update meteor-build step
cardoso Mar 2, 2026
4a435fd
chore: update meteor-build
cardoso Mar 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/actions/meteor-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ runs:
deno-version: ${{ inputs.deno-version }}
cache-modules: true
install: true
type: 'production'
type: 'development'
NPM_TOKEN: ${{ inputs.NPM_TOKEN }}

# - name: Free disk space
Expand Down Expand Up @@ -165,6 +165,12 @@ runs:

yarn build:ci

# Build Vite frontend and package it with the standard Meteor artifact.
(
cd apps/meteor
ROOT_URL=http://localhost:3000/ VITE_TEST_MODE=true npx vite build --outDir /tmp/dist/vite
)

declare -a meter_modules_to_remove=(
"meteor/babel-compiler/node_modules/@meteorjs/swc-core/.swc/node_modules/@swc/core-darwin-arm64" # Removes 35M
"meteor/babel-compiler/node_modules/@meteorjs/swc-core/.swc/node_modules/@swc/core-linux-x64-musl" # Removes 58M
Expand Down Expand Up @@ -201,7 +207,7 @@ runs:
if: steps.cache-build.outputs.cache-hit != 'true'
run: |
cd /tmp/dist
tar czf /tmp/Rocket.Chat.tar.gz bundle
tar czf /tmp/Rocket.Chat.tar.gz bundle vite

- name: Store build
uses: actions/upload-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ jobs:
COVERAGE_DIR: '/tmp/coverage/${{ startsWith(inputs.type, ''api'') && ''api'' || inputs.type }}'
COVERAGE_FILE_NAME: '${{ inputs.type }}-${{ matrix.shard }}.json'
COVERAGE_REPORTER: ${{ inputs.coverage == matrix.mongodb-version && 'json' || '' }}
FRONTEND_DELIVERY_MODE: meteor

strategy:
fail-fast: false
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ jobs:
test-api:
name: 🔨 Test API (CE)
needs: [checks, build-gh-docker-publish, release-versions]
if: ${{ always() && needs.build-gh-docker-publish.result == 'success' && needs.release-versions.result == 'success' }}

uses: ./.github/workflows/ci-test-e2e.yml
with:
Expand All @@ -513,6 +514,7 @@ jobs:
test-api-livechat:
name: 🔨 Test API Livechat (CE)
needs: [checks, build-gh-docker-publish, release-versions]
if: ${{ always() && needs.build-gh-docker-publish.result == 'success' && needs.release-versions.result == 'success' }}

uses: ./.github/workflows/ci-test-e2e.yml
with:
Expand All @@ -529,6 +531,7 @@ jobs:
test-ui:
name: 🔨 Test UI (CE)
needs: [checks, build-gh-docker-publish, release-versions]
if: ${{ always() && needs.build-gh-docker-publish.result == 'success' && needs.release-versions.result == 'success' }}

uses: ./.github/workflows/ci-test-e2e.yml
with:
Expand All @@ -554,6 +557,7 @@ jobs:
test-api-ee:
name: 🔨 Test API (EE)
needs: [checks, build-gh-docker-publish, release-versions]
if: ${{ always() && needs.build-gh-docker-publish.result == 'success' && needs.release-versions.result == 'success' }}

uses: ./.github/workflows/ci-test-e2e.yml
with:
Expand All @@ -574,6 +578,7 @@ jobs:
test-api-livechat-ee:
name: 🔨 Test API Livechat (EE)
needs: [checks, build-gh-docker-publish, release-versions]
if: ${{ always() && needs.build-gh-docker-publish.result == 'success' && needs.release-versions.result == 'success' }}

uses: ./.github/workflows/ci-test-e2e.yml
with:
Expand All @@ -594,6 +599,7 @@ jobs:
test-ui-ee:
name: 🔨 Test UI (EE)
needs: [checks, build-gh-docker-publish, release-versions]
if: ${{ always() && needs.build-gh-docker-publish.result == 'success' && needs.release-versions.result == 'success' }}

uses: ./.github/workflows/ci-test-e2e.yml
with:
Expand Down Expand Up @@ -622,6 +628,7 @@ jobs:
test-federation-matrix:
name: 🔨 Test Federation Matrix
needs: [checks, build-gh-docker-publish, packages-build, release-versions]
if: ${{ always() && needs.build-gh-docker-publish.result == 'success' && needs.packages-build.result == 'success' && needs.release-versions.result == 'success' }}
runs-on: ubuntu-24.04

steps:
Expand Down
3 changes: 3 additions & 0 deletions apps/meteor/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ tests/end-to-end/temporary_staged_test
/tests/e2e/.playwright
coverage
.nyc_output
.nyc_cache
/data
tests/e2e/test-failures/
out.txt
Expand All @@ -88,3 +89,5 @@ dist
matrix-federation-config/*
.eslintcache
tsconfig.typecheck.tsbuildinfo
.vite-inspect
.build
26 changes: 26 additions & 0 deletions apps/meteor/.nycrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"report-dir": "./coverage",
"temp-dir": "./.nyc_output",
"reporter": ["html", "lcov", "text", "text-summary"],
"extension": [".ts", ".tsx", ".js", ".jsx"],
"exclude": [
"**/*.spec.ts",
"**/*.test.ts",
"**/*.spec.js",
"**/*.test.js",
"**/*.stories.tsx",
"**/*.stories.ts",
"tests/**",
"node_modules/**",
"**/*.d.ts",
"**/mocks/**",
"**/fixtures/**",
"**/__mocks__/**"
],
"all": false,
"check-coverage": false,
"sourceMap": true,
"instrument": false,
"cache": true,
"cacheDir": "./.nyc_cache"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { ILivechatDepartment, ILivechatInquiryRecord, IOmnichannelAgent, Serialized } from '@rocket.chat/core-typings';
import { Tracker } from 'meteor/tracker';

import { useLivechatInquiryStore } from '../../../../../client/hooks/useLivechatInquiryStore';
import { queryClient } from '../../../../../client/lib/queryClient';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { IMessage } from '@rocket.chat/core-typings';
import { Emitter } from '@rocket.chat/emitter';
import { Accounts } from 'meteor/accounts-base';
import { Tracker } from 'meteor/tracker';
import type { RefObject } from 'react';

import { limitQuoteChain } from './limitQuoteChain';
Expand Down
3 changes: 3 additions & 0 deletions apps/meteor/client/lib/2fa/overrideLoginMethod.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { Accounts } from 'meteor/accounts-base';
import type { Meteor } from 'meteor/meteor';

import { isTotpInvalidError, isTotpMaxAttemptsError, isTotpRequiredError } from './utils';

type LoginError = globalThis.Error | Meteor.Error | Meteor.TypedError;
Expand Down
9 changes: 3 additions & 6 deletions apps/meteor/client/lib/e2ee/rocketchat.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import QueryString from 'querystring';
import URL from 'url';

import type { IE2EEMessage, IMessage, IRoom, IUser, IUploadWithUser, Serialized, IE2EEPinnedMessage } from '@rocket.chat/core-typings';
import { isE2EEMessage, isEncryptedMessageContent } from '@rocket.chat/core-typings';
import { Emitter } from '@rocket.chat/emitter';
Expand Down Expand Up @@ -721,13 +718,13 @@ class E2E extends Emitter {
return;
}

const urlObj = URL.parse(url);
const urlObj = new URL(url);
// if the URL doesn't have query params (doesn't reference message) skip
if (!urlObj.query) {
if (!urlObj?.searchParams) {
return;
}

const { msg: msgId } = QueryString.parse(urlObj.query);
const { msg: msgId } = Object.fromEntries(urlObj.searchParams.entries());

if (!msgId || Array.isArray(msgId)) {
return;
Expand Down
24 changes: 16 additions & 8 deletions apps/meteor/client/lib/rooms/roomCoordinator.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { IRoom, RoomType, IUser, AtLeast, ValueOf, ISubscription } from '@rocket.chat/core-typings';
import type { RouteName } from '@rocket.chat/ui-contexts';
import { Meteor } from 'meteor/meteor';
import type { ReactElement } from 'react';

import { hasPermission } from '../../../app/authorization/client';
import type {
Expand All @@ -15,9 +16,15 @@ import type {
import { RoomCoordinator } from '../../../lib/rooms/coordinator';
import { router } from '../../providers/RouterProvider';
import { Subscriptions } from '../../stores';
import RoomRoute from '../../views/room/RoomRoute';
import MainLayout from '../../views/root/MainLayout';
import { appLayout } from '../appLayout';

// Route element factory - set by startup code to avoid circular imports
let createRoomRouteElement:
| ((props: { name: string; extractOpenRoomParams: Required<IRoomTypeClientDirectives>['extractOpenRoomParams'] }) => ReactElement)
| null = null;

export const setRoomRouteElementFactory = (factory: typeof createRoomRouteElement): void => {
createRoomRouteElement = factory;
};

class RoomCoordinatorClient extends RoomCoordinator {
public add(roomConfig: IRoomTypeClientConfig, directives: Partial<IRoomTypeClientDirectives>): void {
Expand Down Expand Up @@ -178,15 +185,16 @@ class RoomCoordinatorClient extends RoomCoordinator {
route: { name, path },
} = roomConfig;
const { extractOpenRoomParams } = directives;

if (!createRoomRouteElement) {
throw new Error('Room route element factory not set. Call setRoomRouteElementFactory before registering room types.');
}

router.defineRoutes([
{
path,
id: name,
element: appLayout.wrap(
<MainLayout>
<RoomRoute key={name} extractOpenRoomParams={extractOpenRoomParams} />
</MainLayout>,
),
element: createRoomRouteElement({ name, extractOpenRoomParams }),
},
]);
}
Expand Down
13 changes: 13 additions & 0 deletions apps/meteor/client/lib/rooms/roomRouteFactory.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { setRoomRouteElementFactory } from './roomCoordinator';
import RoomRoute from '../../views/room/RoomRoute';
import MainLayout from '../../views/root/MainLayout';
import { appLayout } from '../appLayout';

// Set up the room route element factory before any room types are registered
setRoomRouteElementFactory(({ name, extractOpenRoomParams }) =>
appLayout.wrap(
<MainLayout>
<RoomRoute key={name} extractOpenRoomParams={extractOpenRoomParams} />
</MainLayout>,
),
);
3 changes: 3 additions & 0 deletions apps/meteor/client/lib/rooms/roomTypes/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Initialize the route factory before registering room types
import '../roomRouteFactory';

import './conversation';
import './direct';
import './favorite';
Expand Down
3 changes: 3 additions & 0 deletions apps/meteor/client/noop.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
console.error('The frontend is disabled in this Meteor build.');

export {};

Check failure on line 3 in apps/meteor/client/noop.ts

View workflow job for this annotation

GitHub Actions / 🔎 Code Check / Code Lint

Insert `⏎`
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { IRoom } from '@rocket.chat/core-typings';
import { useRoomRoute } from '@rocket.chat/ui-contexts';
import { useTranslation } from 'react-i18next';

import { roomCoordinator } from '../../../../../lib/rooms/roomCoordinator';
import ParentRoomButton from '../ParentRoomButton';

type ParentDiscussionProps = {
Expand All @@ -11,8 +11,12 @@ type ParentDiscussionProps = {

const ParentDiscussion = ({ loading = false, room }: ParentDiscussionProps) => {
const { t } = useTranslation();
const roomName = roomCoordinator.getRoomName(room.t, room);
const handleRedirect = (): void => roomCoordinator.openRouteLink(room.t, { rid: room._id, ...room });
const goToRoom = useRoomRoute();
const roomName = room.fname || room.name || '';

const handleRedirect = (): void => {
goToRoom({ rid: room._id, t: room.t, name: room.name });
};

return <ParentRoomButton loading={loading} onClick={handleRedirect} title={t('Back_to__roomName__channel', { roomName })} />;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import type { IRoom } from '@rocket.chat/core-typings';
import { TeamType } from '@rocket.chat/core-typings';
import { useUserId } from '@rocket.chat/ui-contexts';
import { useGoToRoom, useUserId } from '@rocket.chat/ui-contexts';
import { useTranslation } from 'react-i18next';

import ParentRoomButton from './ParentRoomButton';
import { useTeamInfoQuery } from '../../../../hooks/useTeamInfoQuery';
import { goToRoomById } from '../../../../lib/utils/goToRoomById';
import { useUserTeamsQuery } from '../../hooks/useUserTeamsQuery';

type APIErrorResult = { success: boolean; error: string };
Expand All @@ -19,6 +18,7 @@ const ParentTeam = ({ room }: ParentTeamProps) => {
const { teamId } = room;

const userId = useUserId();
const goToRoom = useGoToRoom();

if (!teamId) {
throw new Error('invalid rid');
Expand Down Expand Up @@ -46,7 +46,7 @@ const ParentTeam = ({ room }: ParentTeamProps) => {
return;
}

goToRoomById(rid);
goToRoom(rid);
};

if (teamInfoError || !shouldDisplayTeam) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import type { IUser } from '@rocket.chat/core-typings';
import { Margins } from '@rocket.chat/fuselage';
import { useRouter } from '@rocket.chat/ui-contexts';

import RoomForewordUsernameListItem from './RoomForewordUsernameListItem';
import { roomCoordinator } from '../../../../lib/rooms/roomCoordinator';

type RoomForewordUsernameListProps = { usernames: Array<NonNullable<IUser['username']>> };

const RoomForewordUsernameList = ({ usernames }: RoomForewordUsernameListProps) => {
const router = useRouter();

return (
<Margins inline={4}>
{usernames.map((username) => (
<RoomForewordUsernameListItem
username={username}
key={username}
href={roomCoordinator.getRouteLink('d', { name: username }) || undefined}
href={router.getRoomRoute('d', { name: username }).path || undefined}
/>
))}
</Margins>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { IRoom, ISubscription } from '@rocket.chat/core-typings';
import { useRouter } from '@rocket.chat/ui-contexts';
import { Tracker } from 'meteor/tracker';
import type { Dispatch, MutableRefObject, SetStateAction } from 'react';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';

Expand Down
1 change: 1 addition & 0 deletions apps/meteor/client/views/root/IndexRoute.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { RouteName } from '@rocket.chat/ui-contexts';
import { useRouter, useUser, useUserId } from '@rocket.chat/ui-contexts';
import { Tracker } from 'meteor/tracker';
import { useEffect } from 'react';

import PageLoading from './PageLoading';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export const useSettingsOnLoadSiteUrl = () => {
if (value == null || value.trim() === '') {
return;
}
if (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') {
return;
}
(window as any).__meteor_runtime_config__.ROOT_URL = value;
}, [siteUrl]);
};
11 changes: 11 additions & 0 deletions apps/meteor/definition/externals/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ declare global {
const __meteor_runtime_config__: {
ROOT_URL_PATH_PREFIX: string;
ROOT_URL: string;
PUBLIC_SETTINGS?: Record<string, unknown>;
accountsConfigCalled?: boolean;
meteorEnv: {
TEST_METADATA?: string;
NODE_ENV?: string;
};
ACCOUNTS_CONNECTION_URL?: string;
isModern?: boolean;
gitCommitHash?: string;
meteorRelease?: string;
debug?: boolean;
};

interface Window {
Expand Down
1 change: 1 addition & 0 deletions apps/meteor/definition/externals/meteor/mongo.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ declare module 'meteor/mongo' {
connection?: object | null;
idGeneration?: string;
transform?: (<T>(doc: T) => T) | null;
_preventAutopublish?: boolean;
},
): Collection<T>;
}
Expand Down
Loading
Loading