Skip to content

Commit

Permalink
Merge branch 'develop' into fix/emoji-aliases-display
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Nov 15, 2024
2 parents cc94cdc + daa1934 commit ce9582d
Show file tree
Hide file tree
Showing 1,018 changed files with 3,896 additions and 3,432 deletions.
5 changes: 5 additions & 0 deletions .changeset/neat-flies-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Adds a divider on Create team modal - advanced settings
2 changes: 1 addition & 1 deletion .github/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ runs:

- name: Use Node.js ${{ inputs.node-version }}
id: node-version
uses: actions/setup-node@v3.7.0
uses: actions/setup-node@v4.1.0
with:
node-version: ${{ inputs.node-version }}
cache: 'yarn'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-version-durability.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4.0.4
uses: actions/setup-node@v4.1.0
with:
node-version: '20.18.0'

Expand Down
1 change: 1 addition & 0 deletions apps/meteor/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
!/client/.eslintrc.js
!/ee/client/.eslintrc.js
/storybook-static/
/packages/
2 changes: 1 addition & 1 deletion apps/meteor/app/2fa/server/code/EmailCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { Random } from '@rocket.chat/random';
import bcrypt from 'bcrypt';
import { Accounts } from 'meteor/accounts-base';

import type { ICodeCheck, IProcessInvalidCodeResult } from './ICodeCheck';
import { i18n } from '../../../../server/lib/i18n';
import * as Mailer from '../../../mailer/server/api';
import { settings } from '../../../settings/server';
import type { ICodeCheck, IProcessInvalidCodeResult } from './ICodeCheck';

export class EmailCheck implements ICodeCheck {
public readonly name = 'email';
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/2fa/server/code/PasswordCheckFallback.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { IUser } from '@rocket.chat/core-typings';
import { Accounts } from 'meteor/accounts-base';

import { settings } from '../../../settings/server';
import type { ICodeCheck, IProcessInvalidCodeResult } from './ICodeCheck';
import { settings } from '../../../settings/server';

export class PasswordCheckFallback implements ICodeCheck {
public readonly name = 'password';
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/2fa/server/code/TOTPCheck.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { IUser } from '@rocket.chat/core-typings';

import type { ICodeCheck, IProcessInvalidCodeResult } from './ICodeCheck';
import { settings } from '../../../settings/server';
import { TOTP } from '../lib/totp';
import type { ICodeCheck, IProcessInvalidCodeResult } from './ICodeCheck';

export class TOTPCheck implements ICodeCheck {
public readonly name = 'totp';
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/2fa/server/code/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { Users } from '@rocket.chat/models';
import { Accounts } from 'meteor/accounts-base';
import { Meteor } from 'meteor/meteor';

import { settings } from '../../../settings/server';
import { EmailCheck } from './EmailCheck';
import type { ICodeCheck } from './ICodeCheck';
import { PasswordCheckFallback } from './PasswordCheckFallback';
import { TOTPCheck } from './TOTPCheck';
import { settings } from '../../../settings/server';

export interface ITwoFactorOptions {
disablePasswordFallback?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/2fa/server/loginHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { check } from 'meteor/check';
import { Meteor } from 'meteor/meteor';
import { OAuth } from 'meteor/oauth';

import { callbacks } from '../../../lib/callbacks';
import { checkCodeForUser } from './code/index';
import { callbacks } from '../../../lib/callbacks';

const isMeteorError = (error: any): error is Meteor.Error => {
return error?.meteorError !== undefined;
Expand Down
18 changes: 9 additions & 9 deletions apps/meteor/app/api/server/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@ import type { Request, Response } from 'meteor/rocketchat:restivus';
import { Restivus } from 'meteor/rocketchat:restivus';
import _ from 'underscore';

import { isObject } from '../../../lib/utils/isObject';
import { getNestedProp } from '../../../server/lib/getNestedProp';
import { getRestPayload } from '../../../server/lib/logger/logPayloads';
import { checkCodeForUser } from '../../2fa/server/code';
import { hasPermissionAsync } from '../../authorization/server/functions/hasPermission';
import { notifyOnUserChangeAsync } from '../../lib/server/lib/notifyListener';
import { metrics } from '../../metrics/server';
import { settings } from '../../settings/server';
import { getDefaultUserFields } from '../../utils/server/functions/getDefaultUserFields';
import type { PermissionsPayload } from './api.helpers';
import { checkPermissionsForInvocation, checkPermissions, parseDeprecation } from './api.helpers';
import type {
Expand All @@ -37,6 +28,15 @@ import type {
} from './definition';
import { getUserInfo } from './helpers/getUserInfo';
import { parseJsonQuery } from './helpers/parseJsonQuery';
import { isObject } from '../../../lib/utils/isObject';
import { getNestedProp } from '../../../server/lib/getNestedProp';
import { getRestPayload } from '../../../server/lib/logger/logPayloads';
import { checkCodeForUser } from '../../2fa/server/code';
import { hasPermissionAsync } from '../../authorization/server/functions/hasPermission';
import { notifyOnUserChangeAsync } from '../../lib/server/lib/notifyListener';
import { metrics } from '../../metrics/server';
import { settings } from '../../settings/server';
import { getDefaultUserFields } from '../../utils/server/functions/getDefaultUserFields';

const logger = new Logger('API');

Expand Down
15 changes: 15 additions & 0 deletions apps/meteor/app/api/server/v1/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,21 @@ API.v1.addRoute(
{ authRequired: true },
{
async post() {
const { text, attachments } = this.bodyParams;
const maxAllowedSize = settings.get<number>('Message_MaxAllowedSize') ?? 0;

if (text && text.length > maxAllowedSize) {
return API.v1.failure('error-message-size-exceeded');
}

if (attachments && attachments.length > 0) {
for (const attachment of attachments) {
if (attachment.text && attachment.text.length > maxAllowedSize) {
return API.v1.failure('error-message-size-exceeded');
}
}
}

const messageReturn = (await applyAirGappedRestrictionsValidation(() => processWebhookMessage(this.bodyParams, this.user)))[0];

if (!messageReturn) {
Expand Down
5 changes: 3 additions & 2 deletions apps/meteor/app/api/server/v1/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import {
} from '@rocket.chat/rest-typings';
import { Meteor } from 'meteor/meteor';

import { PendingAvatarImporter } from '../../../importer-pending-avatars/server/PendingAvatarImporter';
import { PendingFileImporter } from '../../../importer-pending-files/server/PendingFileImporter';
import { Importers } from '../../../importer/server';
import {
executeUploadImportFile,
Expand All @@ -26,13 +24,16 @@ import {
executeStartImport,
executeGetLatestImportOperations,
} from '../../../importer/server/methods';
import { PendingAvatarImporter } from '../../../importer-pending-avatars/server/PendingAvatarImporter';
import { PendingFileImporter } from '../../../importer-pending-files/server/PendingFileImporter';
import { API } from '../api';

API.v1.addRoute(
'uploadImportFile',
{
authRequired: true,
validateParams: isUploadImportFileParamsPOST,
permissionsRequired: ['run-import'],
},
{
async post() {
Expand Down
2 changes: 0 additions & 2 deletions apps/meteor/app/api/server/v1/invites.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ API.v1.addRoute(
{
async post() {
const { token } = this.bodyParams;
// eslint-disable-next-line react-hooks/rules-of-hooks

// eslint-disable-next-line react-hooks/rules-of-hooks
return API.v1.success(await useInviteToken(this.userId, token));
},
Expand Down
7 changes: 6 additions & 1 deletion apps/meteor/app/api/server/v1/rooms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,14 @@ API.v1.addRoute(
},
);

/*
TO-DO: 8.0.0 should use the ajv validation
which will change this endpoint's
response errors.
*/
API.v1.addRoute(
'rooms.createDiscussion',
{ authRequired: true },
{ authRequired: true /* , validateParams: isRoomsCreateDiscussionProps */ },
{
async post() {
// eslint-disable-next-line @typescript-eslint/naming-convention
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/api/server/v1/voip/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import type { IVoipExtensionBase } from '@rocket.chat/core-typings';
import { Users } from '@rocket.chat/models';
import { Match, check } from 'meteor/check';

import { logger } from './logger';
import { settings } from '../../../../settings/server';
import { generateJWT } from '../../../../utils/server/lib/JWTHelper';
import { API } from '../../api';
import { logger } from './logger';

// Get the connector version and type
API.v1.addRoute(
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/api/server/v1/voip/omnichannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import type { IUser, IVoipExtensionWithAgentInfo } from '@rocket.chat/core-typin
import { Users } from '@rocket.chat/models';
import { Match, check } from 'meteor/check';

import { logger } from './logger';
import { notifyOnUserChange } from '../../../../lib/server/lib/notifyListener';
import { API } from '../../api';
import { getPaginationItems } from '../../helpers/getPaginationItems';
import { logger } from './logger';

function filter(
array: IVoipExtensionWithAgentInfo[],
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/apple/server/appleOauthRegisterService.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { KJUR } from 'jsrsasign';
import { ServiceConfiguration } from 'meteor/service-configuration';

import { AppleCustomOAuth } from './AppleCustomOAuth';
import { settings } from '../../settings/server';
import { config } from '../lib/config';
import { AppleCustomOAuth } from './AppleCustomOAuth';

new AppleCustomOAuth('apple', config);

Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/app/apps/server/converters/threads.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { IAppRoomsConverter, IAppThreadsConverter, IAppUsersConverter, IAppsMessage, IAppsUser } from '@rocket.chat/apps';
import type { IMessage as AppsEngineMessage, IMessageAttachment } from '@rocket.chat/apps-engine/definition/messages';
import type { IRoom } from '@rocket.chat/apps-engine/definition/rooms';
import type { IUser } from '@rocket.chat/core-typings';
import { isEditedMessage, type IMessage } from '@rocket.chat/core-typings';
import { isEditedMessage } from '@rocket.chat/core-typings';
import type { IUser, IMessage } from '@rocket.chat/core-typings';
import { Messages } from '@rocket.chat/models';

import { cachedFunction } from './cachedFunction';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import cloneDeep from 'lodash.clonedeep';

/**
* Transforms a `data` source object to another object,
* essentially applying a to -> from mapping provided by
Expand Down Expand Up @@ -79,7 +77,7 @@ export const transformMappedData = async <
data: DataType,
map: MapType,
): Promise<ResultType & { _unmappedProperties_: UnmappedProperties }> => {
const originalData: DataType = cloneDeep(data);
const originalData: DataType = structuredClone(data);
const transformedData: Record<string, any> = {};

for await (const [to, from] of Object.entries(map)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { IUser, IRoom } from '@rocket.chat/core-typings';
import { Rooms } from '@rocket.chat/models';

import { getValue } from '../../../settings/server/raw';
import { canAccessRoomAsync } from './canAccessRoom';
import { hasPermissionAsync } from './hasPermission';
import { getValue } from '../../../settings/server/raw';

const elapsedTime = (ts: Date): number => {
const dif = Date.now() - ts.getTime();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { IRoom, IUser } from '@rocket.chat/core-typings';
import { Subscriptions, Rooms } from '@rocket.chat/models';

import { RoomMemberActions } from '../../../../definition/IRoomTypeConfig';
import { roomCoordinator } from '../../../../server/lib/rooms/roomCoordinator';
import { canAccessRoomAsync } from './canAccessRoom';
import { hasPermissionAsync } from './hasPermission';
import { RoomMemberActions } from '../../../../definition/IRoomTypeConfig';
import { roomCoordinator } from '../../../../server/lib/rooms/roomCoordinator';

const subscriptionOptions = {
projection: {
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/autotranslate/client/lib/actionButton.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';

import { AutoTranslate } from './autotranslate';
import { roomCoordinator } from '../../../../client/lib/rooms/roomCoordinator';
import {
hasTranslationLanguageInAttachments,
Expand All @@ -11,7 +12,6 @@ import { Messages } from '../../../models/client';
import { settings } from '../../../settings/client';
import { MessageAction } from '../../../ui-utils/client/lib/MessageAction';
import { sdk } from '../../../utils/client/lib/SDKClient';
import { AutoTranslate } from './autotranslate';

Meteor.startup(() => {
AutoTranslate.init();
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/autotranslate/server/deeplTranslate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import type {
import { serverFetch as fetch } from '@rocket.chat/server-fetch';
import _ from 'underscore';

import { TranslationProviderRegistry, AutoTranslate } from './autotranslate';
import { i18n } from '../../../server/lib/i18n';
import { SystemLogger } from '../../../server/lib/logger/system';
import { settings } from '../../settings/server';
import { TranslationProviderRegistry, AutoTranslate } from './autotranslate';

const proApiEndpoint = 'https://api.deepl.com/v2/translate';
const freeApiEndpoint = 'https://api-free.deepl.com/v2/translate';
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/autotranslate/server/googleTranslate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import type {
import { serverFetch as fetch } from '@rocket.chat/server-fetch';
import _ from 'underscore';

import { AutoTranslate, TranslationProviderRegistry } from './autotranslate';
import { i18n } from '../../../server/lib/i18n';
import { SystemLogger } from '../../../server/lib/logger/system';
import { settings } from '../../settings/server';
import { AutoTranslate, TranslationProviderRegistry } from './autotranslate';

/**
* Represents google translate class
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/app/autotranslate/server/msTranslate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import type { IMessage, IProviderMetadata, ISupportedLanguage, ITranslationResul
import { serverFetch as fetch } from '@rocket.chat/server-fetch';
import _ from 'underscore';

import { i18n } from '../../../server/lib/i18n';
import { settings } from '../../settings/server';
import { TranslationProviderRegistry, AutoTranslate } from './autotranslate';
import { msLogger } from './logger';
import { i18n } from '../../../server/lib/i18n';
import { settings } from '../../settings/server';

/**
* Microsoft translation service provider class representation.
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/app/cloud/server/functions/connectWorkspace.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { serverFetch as fetch } from '@rocket.chat/server-fetch';

import { getRedirectUri } from './getRedirectUri';
import { saveRegistrationData } from './saveRegistrationData';
import { CloudWorkspaceConnectionError } from '../../../../lib/errors/CloudWorkspaceConnectionError';
import { SystemLogger } from '../../../../server/lib/logger/system';
import { settings } from '../../../settings/server';
import { getRedirectUri } from './getRedirectUri';
import { saveRegistrationData } from './saveRegistrationData';

const fetchRegistrationDataPayload = async ({
token,
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/app/cloud/server/functions/getCheckoutUrl.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { serverFetch as fetch } from '@rocket.chat/server-fetch';

import { getWorkspaceAccessTokenOrThrow } from './getWorkspaceAccessToken';
import { syncWorkspace } from './syncWorkspace';
import { SystemLogger } from '../../../../server/lib/logger/system';
import { settings } from '../../../settings/server';
import { getURL } from '../../../utils/server/getURL';
import { getWorkspaceAccessTokenOrThrow } from './getWorkspaceAccessToken';
import { syncWorkspace } from './syncWorkspace';

export const fallback = `https://go.rocket.chat/i/contact-sales`;

Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/cloud/server/functions/getWorkspaceKey.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { settings } from '../../../settings/server';
import { retrieveRegistrationStatus } from './retrieveRegistrationStatus';
import { settings } from '../../../settings/server';

export async function getWorkspaceKey() {
const { workspaceRegistered } = await retrieveRegistrationStatus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import type { IUser } from '@rocket.chat/core-typings';
import { Users } from '@rocket.chat/models';
import { serverFetch as fetch } from '@rocket.chat/server-fetch';

import { buildWorkspaceRegistrationData } from './buildRegistrationData';
import { SystemLogger } from '../../../../server/lib/logger/system';
import { settings } from '../../../settings/server';
import { buildWorkspaceRegistrationData } from './buildRegistrationData';

export async function registerPreIntentWorkspaceWizard(): Promise<boolean> {
const firstUser = (await Users.getOldest({ projection: { name: 1, emails: 1 } })) as IUser | undefined;
Expand Down
6 changes: 3 additions & 3 deletions apps/meteor/app/cloud/server/functions/removeLicense.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { serverFetch as fetch } from '@rocket.chat/server-fetch';

import { CloudWorkspaceAccessTokenEmptyError, getWorkspaceAccessToken } from './getWorkspaceAccessToken';
import { retrieveRegistrationStatus } from './retrieveRegistrationStatus';
import { syncWorkspace } from './syncWorkspace';
import { callbacks } from '../../../../lib/callbacks';
import { CloudWorkspaceConnectionError } from '../../../../lib/errors/CloudWorkspaceConnectionError';
import { CloudWorkspaceRegistrationError } from '../../../../lib/errors/CloudWorkspaceRegistrationError';
import { settings } from '../../../settings/server';
import { CloudWorkspaceAccessTokenEmptyError, getWorkspaceAccessToken } from './getWorkspaceAccessToken';
import { retrieveRegistrationStatus } from './retrieveRegistrationStatus';
import { syncWorkspace } from './syncWorkspace';

export async function removeLicense() {
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Settings, WorkspaceCredentials } from '@rocket.chat/models';

import { notifyOnSettingChangedById } from '../../../lib/server/lib/notifyListener';
import { retrieveRegistrationStatus } from './retrieveRegistrationStatus';
import { notifyOnSettingChangedById } from '../../../lib/server/lib/notifyListener';

export async function removeWorkspaceRegistrationInfo() {
const { workspaceRegistered } = await retrieveRegistrationStatus();
Expand Down
Loading

0 comments on commit ce9582d

Please sign in to comment.