Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into mess…
Browse files Browse the repository at this point in the history
…age-template-2

* 'develop' of github.com:RocketChat/Rocket.Chat: (63 commits)
  Bump @types/nodemailer from 6.4.2 to 6.4.4 (#24822)
  Bump body-parser from 1.19.0 to 1.19.2 (#24821)
  Bump @types/ws from 8.5.2 to 8.5.3 in /ee/server/services (#24820)
  Chore: Add E2E tests for livechat/visitor (#24764)
  Chore: Add E2E tests for livechat/room.close (#24729)
  [FIX] German translation for Monitore (#24785)
  [FIX] Revert AutoComplete (#24812)
  Chore: APIClass types (#24747)
  Bump is-svg from 4.3.1 to 4.3.2 (#24801)
  Bump prometheus-gc-stats from 0.6.2 to 0.6.3 (#24803)
  Chore: Skip local services changes when shutting down duplicated services (#24810)
  [FIX] "Match error" when converting a team to a channel (#24629)
  Regression: Fix ParentRoomWithEndpointData in loop (#24809)
  Chore: Get Settings Statistics (#24397)
  [FIX] `PaginatedSelectFiltered` not handling changes (#24732)
  Chore: converted more hooks to typescript (#24628)
  Chore: added settings endpoint types (#24506)
  [FIX] Handle Other Formats inside Upload Avatar (#24226)
  [FIX] Prune Message issue (#24424)
  [FIX] Critical: Incorrect visitor getting assigned to a chat from apps (#24805)
  ...
  • Loading branch information
gabriellsh committed Mar 14, 2022
2 parents 139be3b + 1fdd35b commit 72bd028
Show file tree
Hide file tree
Showing 302 changed files with 15,063 additions and 12,093 deletions.
5 changes: 1 addition & 4 deletions .github/no-js-action-config.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"added": {
"ignore": [
"packages/accounts-linkedin/**/*",
"packages/linkedin-oauth/**/*"
]
"ignore": ["packages/accounts-linkedin/**/*", "packages/linkedin-oauth/**/*", "tests/cypress/integration/08-resolutions.spec.js"]
}
}
63 changes: 58 additions & 5 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,39 @@ jobs:
- name: Unit Test (client)
run: npm run testunit-client

- name: E2E Test
- name: E2E Test API
env:
TEST_MODE: 'true'
MONGO_URL: mongodb://localhost:27017/rocketchat
MONGO_OPLOG_URL: mongodb://localhost:27017/local
run: |
echo -e 'pcm.!default {\n type hw\n card 0\n}\n\nctl.!default {\n type hw\n card 0\n}' > ~/.asoundrc
Xvfb -screen 0 1024x768x24 :99 &
for i in $(seq 1 5); do (docker exec mongo mongo rocketchat --eval 'db.dropDatabase()') && npm run testci && s=0 && break || s=$? && sleep 1; done; (exit $s)
for i in $(seq 1 5); do (docker exec mongo mongo rocketchat --eval 'db.dropDatabase()') && npm run testci -- --test=testapi && s=0 && break || s=$? && sleep 1; done; (exit $s)
- name: E2E Test UI
env:
TEST_MODE: 'true'
MONGO_URL: mongodb://localhost:27017/rocketchat
MONGO_OPLOG_URL: mongodb://localhost:27017/local
run: |
echo -e 'pcm.!default {\n type hw\n card 0\n}\n\nctl.!default {\n type hw\n card 0\n}' > ~/.asoundrc
Xvfb -screen 0 1024x768x24 :99 &
for i in $(seq 1 2); do (docker exec mongo mongo rocketchat --eval 'db.dropDatabase()') && npm run testci -- --test=testui && s=0 && break || s=$? && ([ ! -w tests/cypress/screenshots ] || mv tests/cypress/screenshots tests/cypress/screenshots-$i) && ([ ! -w tests/cypress/videos ] || mv tests/cypress/videos tests/cypress/videos-$i) && sleep 1; done; (exit $s)
- name: Store cypress test screenshots
uses: actions/upload-artifact@v2
if: failure()
with:
name: cypress-test-screenshots
path: tests/cypress/screenshots*

- name: Store cypress test videos
uses: actions/upload-artifact@v2
if: failure()
with:
name: cypress-test-videos
path: tests/cypress/videos*

test-ee:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -318,21 +342,50 @@ jobs:
cd ./ee/server/services
npm run build
- name: E2E Test
- name: E2E Test API
env:
TEST_MODE: 'true'
MONGO_URL: mongodb://localhost:27017/rocketchat
MONGO_OPLOG_URL: mongodb://localhost:27017/local
ENTERPRISE_LICENSE: ${{ secrets.ENTERPRISE_LICENSE }}
TRANSPORTER: nats://localhost:4222
TEST_URL: http://localhost:4000
SKIP_PROCESS_EVENT_REGISTRATION: 'true'
run: |
echo -e 'pcm.!default {\n type hw\n card 0\n}\n\nctl.!default {\n type hw\n card 0\n}' > ~/.asoundrc
Xvfb -screen 0 1024x768x24 :99 &
for i in $(seq 1 5); do (docker exec mongo mongo rocketchat --eval 'db.dropDatabase()') && npm run testci -- --enterprise && s=0 && break || s=$? && sleep 1; done; (exit $s)
for i in $(seq 1 5); do (docker exec mongo mongo rocketchat --eval 'db.dropDatabase()') && npm run testci -- --enterprise --test=testapi && s=0 && break || s=$? && sleep 1; done; (exit $s)
- name: E2E Test UI
env:
TEST_MODE: 'true'
MONGO_URL: mongodb://localhost:27017/rocketchat
MONGO_OPLOG_URL: mongodb://localhost:27017/local
ENTERPRISE_LICENSE: ${{ secrets.ENTERPRISE_LICENSE }}
TRANSPORTER: nats://localhost:4222
CYPRESS_BASE_URL: http://localhost:4000
CYPRESS_TEST_API_URL: http://localhost:4000
OVERWRITE_SETTING_Site_Url: http://localhost:4000
SKIP_PROCESS_EVENT_REGISTRATION: 'true'
run: |
echo -e 'pcm.!default {\n type hw\n card 0\n}\n\nctl.!default {\n type hw\n card 0\n}' > ~/.asoundrc
Xvfb -screen 0 1024x768x24 :99 &
for i in $(seq 1 2); do (docker exec mongo mongo rocketchat --eval 'db.dropDatabase()') && npm run testci -- --enterprise --test=testui && s=0 && break || s=$? && ([ ! -w tests/cypress/screenshots ] || mv tests/cypress/screenshots tests/cypress/screenshots-$i) && ([ ! -w tests/cypress/videos ] || mv tests/cypress/videos tests/cypress/videos-$i) && sleep 1; done; (exit $s)
- name: Store cypress test screenshots
uses: actions/upload-artifact@v2
if: failure()
with:
name: ee-cypress-test-screenshots
path: tests/cypress/screenshots*

- name: Store cypress test videos
uses: actions/upload-artifact@v2
if: failure()
with:
name: ee-cypress-test-videos
path: tests/cypress/videos*
# notification:
# runs-on: ubuntu-20.04
# needs: test
Expand Down
77 changes: 38 additions & 39 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Code scanning - action"
name: 'Code scanning - action'

on:
push:
Expand All @@ -8,45 +8,44 @@ on:

jobs:
CodeQL-Build:

# CodeQL runs on ubuntu-latest and windows-latest
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
# Override language selection by uncommenting this and choosing your languages
with:
languages: javascript

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Checkout repository
uses: actions/checkout@v3
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
# Override language selection by uncommenting this and choosing your languages
with:
languages: javascript

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,6 @@ tests/end-to-end/temporary_staged_test
/private/livechat
/storybook-static
/tests/cypress/screenshots
/tests/cypress/videos
coverage
.nyc_output
2 changes: 1 addition & 1 deletion .mocharc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ Object.assign(
module.exports = {
...base, // see https://github.com/mochajs/mocha/issues/3916
exit: true,
spec: ['app/**/*.spec.ts', 'app/**/*.tests.js', 'app/**/*.tests.ts', 'server/**/*.tests.ts'],
spec: ['app/**/*.spec.ts', 'app/**/*.tests.js', 'app/**/*.tests.ts', 'server/**/*.tests.ts', 'ee/**/*.tests.ts'],
};
17 changes: 11 additions & 6 deletions .scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,16 @@ async function startMicroservices() {
]);
}

function startChimp() {
function startTests(options = []) {
const testOption = options.find((i) => i.startsWith('--test='));
const testParam = testOption ? testOption.replace('--test=', '') : 'test';

console.log(`Running test "npm run ${testParam}"`);

startProcess({
name: 'Chimp',
name: 'Tests',
command: 'npm',
params: ['test'],
params: ['run', testParam],
options: {
env: {
...process.env,
Expand All @@ -173,13 +178,13 @@ function startChimp() {
}

(async () => {
const [, , options = ''] = process.argv;
const [, , ...options] = process.argv;

await startRocketChat();

if (options === '--enterprise') {
if (options.includes('--enterprise')) {
await startMicroservices();
}

startChimp();
startTests(options);
})();
12 changes: 9 additions & 3 deletions .storybook/mocks/providers/ServerProviderMock.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import { action } from '@storybook/addon-actions';
import React, { ContextType, FC } from 'react';

import { ServerContext, ServerMethodName, ServerMethodParameters, ServerMethodReturn } from '../../../client/contexts/ServerContext';
import {
ServerContext,
ServerMethodName,
ServerMethodParameters,
ServerMethodReturn,
UploadResult,
} from '../../../client/contexts/ServerContext';
import { Serialized } from '../../../definition/Serialized';
import { MatchPathPattern, Method, OperationParams, OperationResult, PathFor } from '../../../definition/rest';

const logAction = action('ServerProvider');

const randomDelay = (): Promise<void> => new Promise((resolve) => setTimeout(resolve, Math.random() * 1000));
const randomDelay = (): Promise<UploadResult> => new Promise((resolve) => setTimeout(resolve, Math.random() * 1000));

const absoluteUrl = (path: string): string => new URL(path, '/').toString();

Expand All @@ -28,7 +34,7 @@ const callEndpoint = <TMethod extends Method, TPath extends PathFor<TMethod>>(
.then(randomDelay)
.then(() => undefined as any);

const uploadToEndpoint = (endpoint: string, params: any, formData: any): Promise<void> =>
const uploadToEndpoint = (endpoint: string, params: any, formData: any): Promise<UploadResult> =>
Promise.resolve(logAction('uploadToEndpoint', endpoint, params, formData)).then(randomDelay);

const getStream = (streamName: string, options: {} = {}): (<T>(eventName: string, callback: (data: T) => void) => () => void) => {
Expand Down
4 changes: 2 additions & 2 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
Expand Down Expand Up @@ -56,7 +56,7 @@ further defined and clarified by project maintainers.

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at team@rocket.chat. The project team
will review and investigate all complaints, and will respond in a way that it deems
will review and investigate all complaints and will respond in a way that it deems
appropriate to the circumstances. The project team is obligated to maintain
confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Expand Down
10 changes: 5 additions & 5 deletions FEATURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
- Reactions
- Message editing
- Editing is as simple as using your arrow keys for picking the right message to edit
- Setup to keep history of edits or discard the previous text
- Setup to keep the history of edits or discard the previous text
- Show or hide edited/deleted status
- History
- Search
Expand All @@ -58,10 +58,10 @@
- Add stars and pins to messages
- Star messages that are important to you. Only you have access to your stars.
- Pin messages that are important to everyone.
- Access your starred/pinned and messages you were mentioned on quickly through side bar buttons
- REST Api
- Access your starred/pinned and messages you were mentioned on quickly through sidebar buttons
- REST API
- Roles and Permissions
- Public and Private multi-user rooms
- One-on-one conversations
- Off-the-record messaging (messages are encrypted and transiently saved on database)
- Slashcommands
- Off-the-record messaging (messages are encrypted and transiently saved on the database)
- Slash commands
2 changes: 1 addition & 1 deletion app/2fa/server/code/PasswordCheckFallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class PasswordCheckFallback implements ICodeCheck {
return false;
}

const passCheck = Accounts._checkPassword(user, {
const passCheck = Accounts._checkPassword(user as Meteor.User, {
digest: code.toLowerCase(),
algorithm: 'sha-256',
});
Expand Down
2 changes: 1 addition & 1 deletion app/2fa/server/functions/resetTOTP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const sendResetNotification = async function (uid: string): Promise<void> {
}

const language = user.language || settings.get('Language') || 'en';
const addresses = user.emails?.filter(({ verified }: { verified: boolean }) => verified).map((e) => e.address);
const addresses = user.emails?.filter(({ verified }) => Boolean(verified)).map((e) => e.address);
if (!addresses?.length) {
return;
}
Expand Down
10 changes: 10 additions & 0 deletions app/api/server/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ type Operations<TPathPattern extends PathPattern, TOptions extends Options = {}>
};

declare class APIClass<TBasePath extends string = '/'> {
fieldSeparator(fieldSeparator: unknown): void;

limitedUserFieldsToExclude(fields: { [x: string]: unknown }, limitedUserFieldsToExclude: unknown): { [x: string]: unknown };

limitedUserFieldsToExcludeIfIsPrivilegedUser(
fields: { [x: string]: unknown },
limitedUserFieldsToExcludeIfIsPrivilegedUser: unknown,
): { [x: string]: unknown };

processTwoFactor({
userId,
request,
Expand Down Expand Up @@ -180,4 +189,5 @@ declare class APIClass<TBasePath extends string = '/'> {
export declare const API: {
v1: APIClass<'/v1'>;
default: APIClass;
helperMethods: Map<string, (...args: any[]) => unknown>;
};
6 changes: 2 additions & 4 deletions app/api/server/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,8 @@ export class APIClass extends Restivus {
return result;
};

if (this.hasHelperMethods()) {
for (const [name, helperMethod] of this.getHelperMethods()) {
endpoints[method][name] = helperMethod;
}
for (const [name, helperMethod] of this.getHelperMethods()) {
endpoints[method][name] = helperMethod;
}

// Allow the endpoints to make usage of the logger which respects the user's settings
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { IRoom } from '../../../../definition/IRoom';
import { normalizeMessagesForUser } from '../../../utils/server/lib/normalizeMessagesForUser';
import { API } from '../api';

API.helperMethods.set('composeRoomWithLastMessage', function _composeRoomWithLastMessage(room, userId) {
API.helperMethods.set('composeRoomWithLastMessage', function _composeRoomWithLastMessage(room: IRoom, userId: string) {
if (room.lastMessage) {
const [lastMessage] = normalizeMessagesForUser([room.lastMessage], userId);
room.lastMessage = lastMessage;
Expand Down
2 changes: 1 addition & 1 deletion app/api/server/helpers/deprecationWarning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ export function deprecationWarning<T>({
return response;
}

(API as any).helperMethods.set('deprecationWarning', deprecationWarning);
API.helperMethods.set('deprecationWarning', deprecationWarning);
Loading

0 comments on commit 72bd028

Please sign in to comment.