Skip to content

Commit

Permalink
Merge branch 'RocketChat:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaSingh-02 authored Jul 23, 2023
2 parents 2c9c344 + b011c17 commit 7243403
Show file tree
Hide file tree
Showing 261 changed files with 1,846 additions and 4,587 deletions.
6 changes: 6 additions & 0 deletions .changeset/loud-sheep-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@rocket.chat/fuselage-ui-kit": minor
"@rocket.chat/uikit-playground": minor
---

feat: Adding new UIKit components: Callout, Checkbox, Radio Button, Time Picker, Toast Bar, Toggle Switch, Tab Navigation
5 changes: 5 additions & 0 deletions .changeset/soft-yaks-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": minor
---

feat: return all broken password policies at once
11 changes: 11 additions & 0 deletions .github/workflows/ci-code-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ jobs:
if: matrix.check == 'ts'
run: yarn turbo run typecheck

- name: Cache eslint
uses: actions/cache@v3
if: matrix.check == 'lint'
with:
path: ./apps/meteor/.eslintcache
key: eslintcache-cache-${{ runner.OS }}-${{ hashFiles('yarn.lock') }}-${{ github.event.issue.number }}
restore-keys: |
eslintcache-cache-${{ runner.OS }}-${{ hashFiles('yarn.lock') }}
eslintcache-cache-${{ runner.OS }}
eslintcache-cache
- name: Lint
if: matrix.check == 'lint'
run: yarn lint
2 changes: 1 addition & 1 deletion _templates/package/new/package.json.ejs.t
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ to: packages/<%= name %>/package.json
"private": true,
"devDependencies": {
"@types/jest": "^27.4.1",
"eslint": "^8.12.0",
"eslint": "~8.45.0",
"jest": "~29.5.0",
"ts-jest": "~29.0.5",
"typescript": "~5.0.2"
Expand Down
2 changes: 1 addition & 1 deletion _templates/service/new/package.json.ejs.t
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ to: ee/apps/<%= name %>/package.json
"@rocket.chat/eslint-config": "workspace:^",
"@types/eslint": "^8.4.10",
"@types/polka": "^0.5.4",
"eslint": "^8.29.0",
"eslint": "~8.45.0",
"ts-node": "^10.9.1",
"typescript": "~4.6.4"
},
Expand Down
26 changes: 9 additions & 17 deletions apps/meteor/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
node_modules
data/
tests/e2e/test-failures/
packages/autoupdate/
packages/meteor-streams/
app/emoji-emojione/generateEmojiIndex.js
packages/rocketchat-livechat/assets/rocketchat-livechat.min.js
packages/rocketchat-livechat/assets/rocket-livechat.js
app/theme/client/vendor/
public/packages/rocketchat_videobridge/client/public/external_api.js
packages/tap-i18n/lib/tap_i18next/tap_i18next-1.7.3.js
private/moment-locales/
public/livechat/
public/pdf.worker.min.js
public/workers/**/*
imports/client/**/*
ee/server/services/dist/**
/node_modules/
/tests/e2e/
/tests/data/
/packages/
/app/emoji-emojione/generateEmojiIndex.js
/public/
/private/moment-locales/
/imports/
/ee/server/services/dist/
!/.mocharc.js
!/.mocharc.*.js
!/.scripts/
Expand Down
3 changes: 2 additions & 1 deletion apps/meteor/app/api/server/helpers/getUserInfo.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { IUser, IUserEmail } from '@rocket.chat/core-typings';

import { settings } from '../../../settings/server';
import { getUserPreference, getURL } from '../../../utils/server';
import { getUserPreference } from '../../../utils/server/lib/getUserPreference';
import { getURL } from '../../../utils/server/getURL';

const isVerifiedEmail = (me: IUser): false | IUserEmail | undefined => {
if (!me || !Array.isArray(me.emails)) {
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/api/server/lib/getServerInfo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Info } from '../../../utils/server';
import { Info } from '../../../utils/rocketchat.info';
import { hasPermissionAsync } from '../../../authorization/server/functions/hasPermission';

type ServerInfo =
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/api/server/v1/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Random } from '@rocket.chat/random';
import objectPath from 'object-path';
import { Messages } from '@rocket.chat/models';

import { slashCommands } from '../../../utils/server';
import { slashCommands } from '../../../utils/server/slashCommand';
import { canAccessRoomIdAsync } from '../../../authorization/server/functions/canAccessRoom';
import { API } from '../api';
import { getLoggedInUser } from '../helpers/getLoggedInUser';
Expand Down
8 changes: 6 additions & 2 deletions apps/meteor/app/api/server/v1/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ import { Team, api } from '@rocket.chat/core-services';

import { hasPermissionAsync } from '../../../authorization/server/functions/hasPermission';
import { settings } from '../../../settings/server';
import { validateCustomFields, saveUser, saveCustomFieldsWithoutValidation, setUserAvatar, saveCustomFields } from '../../../lib/server';
import { saveCustomFields } from '../../../lib/server/functions/saveCustomFields';
import { saveCustomFieldsWithoutValidation } from '../../../lib/server/functions/saveCustomFieldsWithoutValidation';
import { saveUser } from '../../../lib/server/functions/saveUser';
import { setUserAvatar } from '../../../lib/server/functions/setUserAvatar';
import { validateCustomFields } from '../../../lib/server/functions/validateCustomFields';
import {
checkUsernameAvailability,
checkUsernameAvailabilityWithValidation,
Expand All @@ -37,7 +41,7 @@ import { getUserForCheck, emailCheck } from '../../../2fa/server/code';
import { resetUserE2EEncriptionKey } from '../../../../server/lib/resetUserE2EKey';
import { resetTOTP } from '../../../2fa/server/functions/resetTOTP';
import { isValidQuery } from '../lib/isValidQuery';
import { getURL } from '../../../utils/server';
import { getURL } from '../../../utils/server/getURL';
import { getUploadFormData } from '../lib/getUploadFormData';
import { getPaginationItems } from '../helpers/getPaginationItems';
import { getUserFromParams } from '../helpers/getUserFromParams';
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/apps/server/bridges/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { SlashCommandContext } from '@rocket.chat/apps-engine/definition/slashco
import { CommandBridge } from '@rocket.chat/apps-engine/server/bridges/CommandBridge';
import type { IMessage, RequiredField, SlashCommand, SlashCommandCallbackParams } from '@rocket.chat/core-typings';

import { slashCommands } from '../../../utils/server';
import { slashCommands } from '../../../utils/server/slashCommand';
import { Utilities } from '../../../../ee/lib/misc/Utilities';
import type { AppServerOrchestrator } from '../../../../ee/server/apps/orchestrator';
import { parseParameters } from '../../../../lib/utils/parseParameters';
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/apps/server/bridges/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { updateMessage } from '../../../lib/server/functions/updateMessage';
import { executeSendMessage } from '../../../lib/server/methods/sendMessage';
import notifications from '../../../notifications/server/lib/Notifications';
import type { AppServerOrchestrator } from '../../../../ee/server/apps/orchestrator';
import { deleteMessage } from '../../../lib/server';
import { deleteMessage } from '../../../lib/server/functions/deleteMessage';

export class AppMessageBridge extends MessageBridge {
// eslint-disable-next-line no-empty-function
Expand Down
4 changes: 3 additions & 1 deletion apps/meteor/app/apps/server/bridges/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import { Subscriptions, Users } from '@rocket.chat/models';
import { Presence } from '@rocket.chat/core-services';
import type { UserStatus } from '@rocket.chat/core-typings';

import { setUserAvatar, deleteUser, getUserCreatedByApp } from '../../../lib/server/functions';
import { deleteUser } from '../../../lib/server/functions/deleteUser';
import { getUserCreatedByApp } from '../../../lib/server/functions/getUserCreatedByApp';
import { setUserAvatar } from '../../../lib/server/functions/setUserAvatar';
import { checkUsernameAvailability } from '../../../lib/server/functions/checkUsernameAvailability';
import type { AppServerOrchestrator } from '../../../../ee/server/apps/orchestrator';
import { setUserActiveStatus } from '../../../lib/server/functions/setUserActiveStatus';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import moment from 'moment';

import { addMinutesToADate } from '../../../../lib/utils/addMinutesToADate';
import { getClientAddress } from '../../../../server/lib/getClientAddress';
import { sendMessage } from '../../../lib/server/functions';
import { sendMessage } from '../../../lib/server/functions/sendMessage';
import { Logger } from '../../../logger/server';
import { settings } from '../../../settings/server';
import type { ILoginAttempt } from '../ILoginAttempt';
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/cas/server/cas_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { validate } from '@rocket.chat/cas-validate';

import { logger } from './cas_rocketchat';
import { settings } from '../../settings/server';
import { _setRealName } from '../../lib/server';
import { _setRealName } from '../../lib/server/functions/setRealName';
import { createRoom } from '../../lib/server/functions/createRoom';

RoutePolicy.declare('/_cas/', 'network');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { isRoomFederated } from '@rocket.chat/core-typings';
import { Message } from '@rocket.chat/core-services';
import type { Document, UpdateResult } from 'mongodb';

import { getValidRoomName } from '../../../utils/server';
import { getValidRoomName } from '../../../utils/server/lib/getValidRoomName';
import { callbacks } from '../../../../lib/callbacks';
import { checkUsernameAvailability } from '../../../lib/server/functions/checkUsernameAvailability';
import { roomCoordinator } from '../../../../server/lib/rooms/roomCoordinator';
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/app/crowd/server/crowd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { Users } from '@rocket.chat/models';
import type { IUser } from '@rocket.chat/core-typings';
import { cronJobs } from '@rocket.chat/cron';

import { _setRealName } from '../../lib/server';
import { _setRealName } from '../../lib/server/functions/setRealName';
import { settings } from '../../settings/server';
import { deleteUser } from '../../lib/server/functions';
import { deleteUser } from '../../lib/server/functions/deleteUser';
import { setUserActiveStatus } from '../../lib/server/functions/setUserActiveStatus';
import { logger } from './logger';
import { crowdIntervalValuesToCronMap } from '../../../server/settings/crowd';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Messages, Rooms } from '@rocket.chat/models';

import { callbacks } from '../../../../lib/callbacks';
import { deleteRoom } from '../../../lib/server';
import { deleteRoom } from '../../../lib/server/functions/deleteRoom';

/**
* We need to propagate the writing of new message in a discussion to the linking
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import { Message } from '@rocket.chat/core-services';

import { hasAtLeastOnePermissionAsync } from '../../../authorization/server/functions/hasPermission';
import { canSendMessageAsync } from '../../../authorization/server/functions/canSendMessage';
import { createRoom, addUserToRoom, sendMessage, attachMessage } from '../../../lib/server';
import { addUserToRoom } from '../../../lib/server/functions/addUserToRoom';
import { sendMessage } from '../../../lib/server/functions/sendMessage';
import { attachMessage } from '../../../lib/server/functions/attachMessage';
import { createRoom } from '../../../lib/server/functions/createRoom';
import { settings } from '../../../settings/server';
import { callbacks } from '../../../../lib/callbacks';
import { roomCoordinator } from '../../../../server/lib/rooms/roomCoordinator';
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/emoji-emojione/server/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Meteor } from 'meteor/meteor';
import { emoji } from '../../emoji/server';
import { getEmojiConfig } from '../lib/getEmojiConfig';
import { isSetNotNull } from '../lib/isSetNotNull';
import { getUserPreference } from '../../utils/server';
import { getUserPreference } from '../../utils/server/lib/getUserPreference';

const config = getEmojiConfig();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Meteor } from 'meteor/meteor';
import { Settings, Users, Rooms } from '@rocket.chat/models';

import { settings } from '../../../settings/server';
import { sendMessage } from '../../../lib/server';
import { sendMessage } from '../../../lib/server/functions/sendMessage';
import { throttledCounter } from '../../../../lib/utils/throttledCounter';

const incException = throttledCounter((counter) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/federation/server/endpoints/dispatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { API } from '../../../api/server';
import { serverLogger } from '../lib/logger';
import { contextDefinitions } from '../lib/context';
import { normalizers } from '../normalizers';
import { deleteRoom } from '../../../lib/server/functions';
import { deleteRoom } from '../../../lib/server/functions/deleteRoom';
import { FileUpload } from '../../../file-upload/server';
import { getFederationDomain } from '../lib/getFederationDomain';
import { decryptIfNeeded } from '../lib/crypt';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { FederationRoomEvents, Subscriptions } from '@rocket.chat/models';

import { clientLogger } from '../lib/logger';
import { normalizers } from '../normalizers';
import { deleteRoom } from '../../../lib/server/functions';
import { deleteRoom } from '../../../lib/server/functions/deleteRoom';
import { getFederationDomain } from '../lib/getFederationDomain';
import { dispatchEvents } from '../handler';
import { isFullyQualified } from '../functions/helpers';
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/federation/server/hooks/afterCreateRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { FederationRoomEvents, Users, Subscriptions } from '@rocket.chat/models'

import { clientLogger } from '../lib/logger';
import { normalizers } from '../normalizers';
import { deleteRoom } from '../../../lib/server/functions';
import { deleteRoom } from '../../../lib/server/functions/deleteRoom';
import { getFederationDomain } from '../lib/getFederationDomain';
import { dispatchEvents } from '../handler';
import { checkRoomType, checkRoomDomainsLength } from '../functions/helpers';
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/file-upload/server/lib/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type createServer from 'connect';

import { UploadFS } from '../../../../server/ufs';
import { Logger } from '../../../logger/server';
import { isDocker } from '../../../utils/server';
import { isDocker } from '../../../utils/server/functions/isDocker';

const logger = new Logger('UploadProxy');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ import type {
import { ImportData, Rooms, Users, Subscriptions } from '@rocket.chat/models';

import type { IConversionCallbacks } from '../definitions/IConversionCallbacks';
import { generateUsernameSuggestion, insertMessage, saveUserIdentity, addUserToDefaultChannels } from '../../../lib/server';
import { addUserToDefaultChannels } from '../../../lib/server/functions/addUserToDefaultChannels';
import { generateUsernameSuggestion } from '../../../lib/server/functions/getUsernameSuggestion';
import { insertMessage } from '../../../lib/server/functions/insertMessage';
import { saveUserIdentity } from '../../../lib/server/functions/saveUserIdentity';
import { setUserActiveStatus } from '../../../lib/server/functions/setUserActiveStatus';
import type { Logger } from '../../../../server/lib/logger/Logger';
import { getValidRoomName } from '../../../utils/server/lib/getValidRoomName';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Users, Rooms } from '@rocket.chat/models';

import { createRoom, addUserToRoom } from '../../../../lib/server';
import { addUserToRoom } from '../../../../lib/server/functions/addUserToRoom';
import { createRoom } from '../../../../lib/server/functions/createRoom';

// TODO doesn't seem to be used anywhere, remove
export default async function handleJoinedChannel(args) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Users, Rooms } from '@rocket.chat/models';

import { removeUserFromRoom } from '../../../../lib/server';
import { removeUserFromRoom } from '../../../../lib/server/functions/removeUserFromRoom';

export default async function handleLeftChannel(args) {
const user = await Users.findOne({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Users, Rooms } from '@rocket.chat/models';

import { sendMessage, createDirectRoom } from '../../../../lib/server';
import { sendMessage, createDirectRoom } from '../../../../lib/server/functions/sendMessage';
/*
*
* Get direct chat room helper
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/lib/server/functions/createDirectRoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Apps } from '../../../../ee/server/apps';
import { callbacks } from '../../../../lib/callbacks';
import { isTruthy } from '../../../../lib/isTruthy';
import { settings } from '../../../settings/server';
import { getDefaultSubscriptionPref } from '../../../utils/server';
import { getDefaultSubscriptionPref } from '../../../utils/lib/getDefaultSubscriptionPref';

const generateSubscription = (
fname: string,
Expand Down
30 changes: 0 additions & 30 deletions apps/meteor/app/lib/server/functions/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as Mailer from '../../../../mailer/server/api';
import { settings } from '../../../../settings/server';
import { metrics } from '../../../../metrics/server';
import { callbacks } from '../../../../../lib/callbacks';
import { getURL } from '../../../../utils/server';
import { getURL } from '../../../../utils/server/getURL';
import { roomCoordinator } from '../../../../../server/lib/rooms/roomCoordinator';
import { ltrim } from '../../../../../lib/utils/stringUtils';
import { i18n } from '../../../../../server/lib/i18n';
Expand Down
3 changes: 2 additions & 1 deletion apps/meteor/app/lib/server/functions/saveCustomFields.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { settings } from '../../../settings/server';
import { validateCustomFields, saveCustomFieldsWithoutValidation } from '.';
import { saveCustomFieldsWithoutValidation } from './saveCustomFieldsWithoutValidation';
import { validateCustomFields } from './validateCustomFields';
import { trim } from '../../../../lib/utils/stringUtils';

export const saveCustomFields = async function (userId: string, formData: Record<string, any>): Promise<void> {
Expand Down
4 changes: 3 additions & 1 deletion apps/meteor/app/lib/server/functions/saveUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import { passwordPolicy } from '../lib/passwordPolicy';
import { validateEmailDomain } from '../lib';
import { getNewUserRoles } from '../../../../server/services/user/lib/getNewUserRoles';
import { saveUserIdentity } from './saveUserIdentity';
import { checkEmailAvailability, setUserAvatar, setEmail } from '.';
import { checkEmailAvailability } from './checkEmailAvailability';
import { setEmail } from './setEmail';
import { setUserAvatar } from './setUserAvatar';
import { setStatusText } from './setStatusText';
import { checkUsernameAvailability } from './checkUsernameAvailability';
import { callbacks } from '../../../../lib/callbacks';
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/lib/server/functions/setEmail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { hasPermissionAsync } from '../../../authorization/server/functions/hasP
import { RateLimiter, validateEmailDomain } from '../lib';
import * as Mailer from '../../../mailer/server/api';
import { settings } from '../../../settings/server';
import { checkEmailAvailability } from '.';
import { checkEmailAvailability } from './checkEmailAvailability';

let html = '';
Meteor.startup(() => {
Expand Down
3 changes: 2 additions & 1 deletion apps/meteor/app/lib/server/functions/setUsername.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import { settings } from '../../../settings/server';
import { hasPermissionAsync } from '../../../authorization/server/functions/hasPermission';
import { RateLimiter } from '../lib';
import { addUserToRoom } from './addUserToRoom';
import { saveUserIdentity, setUserAvatar } from '.';
import { saveUserIdentity } from './saveUserIdentity';
import { setUserAvatar } from './setUserAvatar';
import { checkUsernameAvailability } from './checkUsernameAvailability';
import { getAvatarSuggestionForUser } from './getAvatarSuggestionForUser';
import { SystemLogger } from '../../../../server/lib/logger/system';
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/app/lib/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,3 @@ import './methods/updateMessage';
import './methods/saveCustomFields';

export * from './lib';
export * from './functions';
Loading

0 comments on commit 7243403

Please sign in to comment.