snapshot of https://github.com/RocketChat/Rocket.Chat.git (develop, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s

This commit is contained in:
upstream-mirror
2026-09-16 01:21:02 +05:00
commit 30810eecd7
10161 changed files with 987110 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
import type { IRoom } from '@rocket.chat/core-typings';
export const adminFields: Partial<Record<keyof IRoom, 1>> = {
_id: 1,
prid: 1,
fname: 1,
name: 1,
t: 1,
cl: 1,
u: 1,
usernames: 1,
ts: 1,
usersCount: 1,
muted: 1,
unmuted: 1,
ro: 1,
reactWhenReadOnly: 1,
default: 1,
favorite: 1,
featured: 1,
topic: 1,
msgs: 1,
archived: 1,
teamId: 1,
teamMain: 1,
announcement: 1,
description: 1,
customFields: 1,
broadcast: 1,
uids: 1,
avatarETag: 1,
federated: 1,
abacAttributes: 1,
} as const;

View File

@@ -0,0 +1,106 @@
import type { RoomType } from '@rocket.chat/core-typings';
import type { LocationPathname } from '@rocket.chat/ui-contexts';
import type {
IRoomTypeConfig,
IRoomTypeClientDirectives,
IRoomTypeServerDirectives,
RoomIdentification,
} from '../../definition/IRoomTypeConfig';
export abstract class RoomCoordinator {
protected roomTypes: Record<string, { config: IRoomTypeConfig; directives: IRoomTypeClientDirectives | IRoomTypeServerDirectives }> = {};
protected validateRoomConfig(roomConfig: IRoomTypeConfig): void {
const { identifier } = roomConfig;
if (typeof identifier !== 'string' || identifier.length === 0) {
throw new Error('The identifier must be a string.');
}
}
protected addRoomType(roomConfig: IRoomTypeConfig, directives: IRoomTypeClientDirectives | IRoomTypeServerDirectives): void {
this.validateRoomConfig(roomConfig);
if (this.roomTypes[roomConfig.identifier]) {
return;
}
this.roomTypes[roomConfig.identifier] = { config: roomConfig, directives };
}
protected getRoomTypeConfig(identifier: RoomType): IRoomTypeConfig & Pick<Required<IRoomTypeConfig>, 'route'>;
protected getRoomTypeConfig(identifier: string): IRoomTypeConfig | undefined;
protected getRoomTypeConfig(identifier: string): IRoomTypeConfig | undefined {
if (!this.roomTypes[identifier]) {
throw new Error(`Room type with identifier ${identifier} does not exist.`);
}
return this.roomTypes[identifier].config;
}
public getRouteLink(roomType: string, subData: RoomIdentification): LocationPathname | false {
const config = this.getRoomTypeConfig(roomType);
if (!config?.route) {
return false;
}
const routeData = this.getRouteData(roomType, subData);
if (!routeData) {
return false;
}
if (!config.route.path) {
console.warn(`The route for the room type ${roomType} does not have a path`);
return false;
}
const pathDef = config.route.path;
const fields = routeData;
const regExp = /(:[\w\(\)\\\+\*\.\?]+)+/g;
let path = pathDef.replace(regExp, (key) => {
const firstRegexpChar = key.indexOf('(');
// get the content behind : and (\\d+/)
key = key.substring(1, firstRegexpChar > 0 ? firstRegexpChar : undefined);
// remove +?*
key = key.replace(/[\+\*\?]+/g, '');
return fields[key] || '';
});
path = path.replace(/\/\/+/g, '/'); // Replace multiple slashes with single slash
// remove trailing slash
// but keep the root slash if it's the only one
path = path.match(/^\/{1}$/) ? path : path.replace(/\/$/, '');
return path as LocationPathname;
}
protected getRouteData(roomType: string, subData: RoomIdentification): Record<string, string> | false {
if (!subData.rid && (subData as Record<string, string>)._id) {
console.warn('Deprecated: RoomCoordinator.getRouteData received a room object');
subData.rid = (subData as Record<string, string>)._id;
}
const config = this.getRoomTypeConfig(roomType);
if (!config) {
return false;
}
let routeData = {};
if (config.route?.link) {
routeData = config.route.link(subData);
} else if (subData?.name) {
routeData = {
rid: subData.rid,
name: subData.name,
};
}
return routeData;
}
}

View File

@@ -0,0 +1,8 @@
import type { IRoomTypeConfig } from '../../../definition/IRoomTypeConfig';
import type { RoomCoordinator } from '../coordinator';
export function getConversationRoomType(_coordinator: RoomCoordinator): IRoomTypeConfig {
return {
identifier: 'merged',
};
}

View File

@@ -0,0 +1,24 @@
import type { IRoomTypeConfig } from '../../../definition/IRoomTypeConfig';
import type { RoomCoordinator } from '../coordinator';
declare module '@rocket.chat/ui-contexts' {
export interface IRouterPaths {
direct: {
pathname: `/direct/:rid${`/${string}` | ''}${`/${string}` | ''}`;
pattern: '/direct/:rid/:tab?/:context?';
};
}
}
export function getDirectMessageRoomType(_coordinator: RoomCoordinator): IRoomTypeConfig {
return {
identifier: 'd',
route: {
name: 'direct',
path: '/direct/:rid/:tab?/:context?',
link(sub): Record<string, string> {
return { rid: sub.rid || sub.name || '' };
},
},
};
}

View File

@@ -0,0 +1,8 @@
import type { IRoomTypeConfig } from '../../../definition/IRoomTypeConfig';
import type { RoomCoordinator } from '../coordinator';
export function getFavoriteRoomType(_coordinator: RoomCoordinator): IRoomTypeConfig {
return {
identifier: 'f',
};
}

View File

@@ -0,0 +1,24 @@
import type { IRoomTypeConfig } from '../../../definition/IRoomTypeConfig';
import type { RoomCoordinator } from '../coordinator';
declare module '@rocket.chat/ui-contexts' {
export interface IRouterPaths {
live: {
pathname: `/live/${string}${`/${string}` | ''}${`/${string}` | ''}`;
pattern: '/live/:id/:tab?/:context?';
};
}
}
export function getLivechatRoomType(_coordinator: RoomCoordinator): IRoomTypeConfig {
return {
identifier: 'l',
route: {
name: 'live',
path: '/live/:id/:tab?/:context?',
link({ rid, tab }): Record<string, string> {
return { id: rid || '', tab: tab ?? 'room-info' };
},
},
};
}

View File

@@ -0,0 +1,21 @@
import type { IRoomTypeConfig } from '../../../definition/IRoomTypeConfig';
import type { RoomCoordinator } from '../coordinator';
declare module '@rocket.chat/ui-contexts' {
export interface IRouterPaths {
group: {
pathname: `/group/${string}${`/${string}` | ''}${`/${string}` | ''}`;
pattern: '/group/:name/:tab?/:context?';
};
}
}
export function getPrivateRoomType(_coordinator: RoomCoordinator): IRoomTypeConfig {
return {
identifier: 'p',
route: {
name: 'group',
path: '/group/:name/:tab?/:context?',
},
};
}

View File

@@ -0,0 +1,21 @@
import type { IRoomTypeConfig } from '../../../definition/IRoomTypeConfig';
import type { RoomCoordinator } from '../coordinator';
declare module '@rocket.chat/ui-contexts' {
export interface IRouterPaths {
channel: {
pathname: `/channel/${string}${`/${string}` | ''}${`/${string}` | ''}`;
pattern: '/channel/:name/:tab?/:context?';
};
}
}
export function getPublicRoomType(_coordinator: RoomCoordinator): IRoomTypeConfig {
return {
identifier: 'c',
route: {
name: 'channel',
path: '/channel/:name/:tab?/:context?',
},
};
}

View File

@@ -0,0 +1,8 @@
import type { IRoomTypeConfig } from '../../../definition/IRoomTypeConfig';
import type { RoomCoordinator } from '../coordinator';
export function getUnreadRoomType(_coordinator: RoomCoordinator): IRoomTypeConfig {
return {
identifier: 'unread',
};
}