Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 4.7.2 #25580

Merged
merged 8 commits into from
May 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/packages/core-typings/ @RocketChat/chat-engine
/packages/rest-typings/ @RocketChat/chat-engine
/packages/eslint-config/ @RocketChat/chat-engine
/packages/livechat/ @RocketChat/frontend @RocketChat/chat-engine
/.vscode/ @RocketChat/chat-engine
/.github/ @RocketChat/chat-engine
/_templates/ @RocketChat/chat-engine
77 changes: 77 additions & 0 deletions .github/history.json
Original file line number Diff line number Diff line change
Expand Up @@ -74441,6 +74441,83 @@
]
}
]
},
"4.7.2": {
"node_version": "14.18.3",
"npm_version": "6.14.15",
"mongo_versions": [
"3.6",
"4.0",
"4.2",
"4.4",
"5.0"
],
"pull_requests": [
{
"pr": "25544",
"title": "[FIX] Initial User not added to default channel",
"userLogin": "geekgonecrazy",
"description": "If injecting initial user. The user wasn’t added to the default General channel",
"milestone": "4.7.2",
"contributors": [
"geekgonecrazy",
"web-flow"
]
},
{
"pr": "25520",
"title": "[FIX] User abandonment setting is working again",
"userLogin": "cauefcr",
"description": "A setting watcher and the query for grabbing abandoned chats were broken, now they're not.",
"milestone": "4.7.2",
"contributors": [
"cauefcr",
"tiagoevanp"
]
},
{
"pr": "25495",
"title": "[FIX] Dynamic load matrix is enabled and handle failure ",
"userLogin": "ggazzo",
"milestone": "4.7.2",
"contributors": [
"ggazzo",
"geekgonecrazy"
]
},
{
"pr": "25409",
"title": "[FIX] One of the triggers was not working correctly",
"userLogin": "MartinSchoeler",
"milestone": "4.7.2",
"contributors": [
"MartinSchoeler",
"tiagoevanp"
]
},
{
"pr": "25407",
"title": "[FIX] UI/UX issues on Live Chat widget",
"userLogin": "MartinSchoeler",
"milestone": "4.7.2",
"contributors": [
"MartinSchoeler",
"dougfabris"
]
},
{
"pr": "25312",
"title": "Chore: Add Livechat repo into Monorepo packages",
"userLogin": "tiagoevanp",
"milestone": "4.7.2",
"contributors": [
"tiagoevanp",
"ggazzo",
"web-flow",
"MartinSchoeler"
]
}
]
}
}
}
2 changes: 1 addition & 1 deletion .github/no-js-action-config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"added": {
"ignore": ["packages/accounts-linkedin/**/*", "packages/linkedin-oauth/**/*", "tests/cypress/integration/08-resolutions.spec.js", "**/.eslintrc.js", "packages/eslint-config/**"]
"ignore": ["packages/accounts-linkedin/**/*", "packages/linkedin-oauth/**/*", "tests/cypress/integration/08-resolutions.spec.js", "**/.eslintrc.js", "packages/eslint-config/**", "**/babel.config.js"]
}
}
42 changes: 42 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,46 @@

# 4.7.2
`2022-05-20 · 5 🐛 · 1 🔍 · 6 👩‍💻👨‍💻`

### Engine versions
- Node: `14.18.3`
- NPM: `6.14.15`
- MongoDB: `3.6, 4.0, 4.2, 4.4, 5.0`

### 🐛 Bug fixes


- Dynamic load matrix is enabled and handle failure ([#25495](https://github.com/RocketChat/Rocket.Chat/pull/25495))

- Initial User not added to default channel ([#25544](https://github.com/RocketChat/Rocket.Chat/pull/25544))

If injecting initial user. The user wasn’t added to the default General channel

- One of the triggers was not working correctly ([#25409](https://github.com/RocketChat/Rocket.Chat/pull/25409))

- UI/UX issues on Live Chat widget ([#25407](https://github.com/RocketChat/Rocket.Chat/pull/25407))

- User abandonment setting is working again ([#25520](https://github.com/RocketChat/Rocket.Chat/pull/25520))

A setting watcher and the query for grabbing abandoned chats were broken, now they're not.

<details>
<summary>🔍 Minor changes</summary>


- Chore: Add Livechat repo into Monorepo packages ([#25312](https://github.com/RocketChat/Rocket.Chat/pull/25312))

</details>

### 👩‍💻👨‍💻 Core Team 🤓

- [@MartinSchoeler](https://github.com/MartinSchoeler)
- [@cauefcr](https://github.com/cauefcr)
- [@dougfabris](https://github.com/dougfabris)
- [@geekgonecrazy](https://github.com/geekgonecrazy)
- [@ggazzo](https://github.com/ggazzo)
- [@tiagoevanp](https://github.com/tiagoevanp)

# 4.7.1
`2022-05-13 · 1 🎉 · 2 🐛 · 3 👩‍💻👨‍💻`

Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/.docker/Dockerfile.rhel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM registry.access.redhat.com/ubi8/nodejs-12

ENV RC_VERSION 4.7.1
ENV RC_VERSION 4.7.2

MAINTAINER buildmaster@rocket.chat

Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/.snapcraft/resources/prepareRocketChat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

curl -SLf "https://releases.rocket.chat/4.7.1/download/" -o rocket.chat.tgz
curl -SLf "https://releases.rocket.chat/4.7.2/download/" -o rocket.chat.tgz

tar xf rocket.chat.tgz --strip 1

Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/.snapcraft/snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# 5. `snapcraft snap`

name: rocketchat-server
version: 4.7.1
version: 4.7.2
summary: Rocket.Chat server
description: Have your own Slack like online chat, built with Meteor. https://rocket.chat/
confinement: strict
Expand Down
99 changes: 76 additions & 23 deletions apps/meteor/app/federation-v2/server/bridge.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,81 @@
import { Bridge, AppServiceRegistration } from '@rocket.chat/forked-matrix-appservice-bridge';
import type { Bridge as MatrixBridge } from '@rocket.chat/forked-matrix-appservice-bridge';

import { settings } from '../../settings/server';
import { IMatrixEvent } from './definitions/IMatrixEvent';
import { MatrixEventType } from './definitions/MatrixEventType';
import { Settings } from '../../models/server/raw';
import type { IMatrixEvent } from './definitions/IMatrixEvent';
import type { MatrixEventType } from './definitions/MatrixEventType';
import { addToQueue } from './queue';
import { getRegistrationInfo } from './config';
import { bridgeLogger } from './logger';

export const matrixBridge = new Bridge({
homeserverUrl: settings.get('Federation_Matrix_homeserver_url'),
domain: settings.get('Federation_Matrix_homeserver_domain'),
registration: AppServiceRegistration.fromObject(getRegistrationInfo()),
disableStores: true,
controller: {
onAliasQuery: (alias, matrixRoomId): void => {
console.log('onAliasQuery', alias, matrixRoomId);
},
onEvent: async (request /* , context*/): Promise<void> => {
// Get the event
const event = request.getData() as unknown as IMatrixEvent<MatrixEventType>;

addToQueue(event);
},
onLog: async (line, isError): Promise<void> => {
console.log(line, isError);
},
},
});
class Bridge {
private bridgeInstance: MatrixBridge;

private isRunning = false;

public async start(): Promise<void> {
try {
await this.stop();
await this.createInstance();

if (!this.isRunning) {
await this.bridgeInstance.run(this.getBridgePort());
this.isRunning = true;
}
} catch (e) {
bridgeLogger.error('Failed to initialize the matrix-appservice-bridge.', e);

bridgeLogger.error('Disabling Matrix Bridge. Please resolve error and try again');
Settings.updateValueById('Federation_Matrix_enabled', false);
}
}

public async stop(): Promise<void> {
if (!this.isRunning) {
return;
}
// the http server can take some minutes to shutdown and this promise to be resolved
await this.bridgeInstance?.close();
this.isRunning = false;
}

public getInstance(): MatrixBridge {
return this.bridgeInstance;
}

private async createInstance(): Promise<void> {
bridgeLogger.info('Performing Dynamic Import of matrix-appservice-bridge');

// Dynamic import to prevent Rocket.Chat from loading the module until needed and then handle if that fails
const { Bridge: MatrixBridge, AppServiceRegistration } = await import('@rocket.chat/forked-matrix-appservice-bridge');

this.bridgeInstance = new MatrixBridge({
homeserverUrl: settings.get('Federation_Matrix_homeserver_url'),
domain: settings.get('Federation_Matrix_homeserver_domain'),
registration: AppServiceRegistration.fromObject(getRegistrationInfo()),
disableStores: true,
controller: {
onAliasQuery: (alias, matrixRoomId): void => {
console.log('onAliasQuery', alias, matrixRoomId);
},
onEvent: async (request /* , context*/): Promise<void> => {
// Get the event
const event = request.getData() as unknown as IMatrixEvent<MatrixEventType>;

addToQueue(event);
},
onLog: async (line, isError): Promise<void> => {
console.log(line, isError);
},
},
});
}

private getBridgePort(): number {
const [, , port] = settings.get<string>('Federation_Matrix_bridge_url').split(':');

return parseInt(port);
}
}

export const matrixBridge = new Bridge();
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const send = async (message: IMessage): Promise<IMessage> => {
throw new Error(`Could not find room matrix id for ${message.rid}`);
}

const intent = matrixBridge.getIntent(userMatrixId);
const intent = matrixBridge.getInstance().getIntent(userMatrixId);
await intent.sendText(roomMatrixId, message.msg || '...not-supported...');

return message;
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/federation-v2/server/matrix-client/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const create = async (user: IUser, room: IRoom): Promise<ICreateRoomResul
throw new Error(`Could not find user matrix id for ${user._id}`);
}

const intent = matrixBridge.getIntent(userMatrixId);
const intent = matrixBridge.getInstance().getIntent(userMatrixId);

const roomName = `@${room.name}`;

Expand Down
12 changes: 6 additions & 6 deletions apps/meteor/app/federation-v2/server/matrix-client/user.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MatrixProfileInfo } from '@rocket.chat/forked-matrix-bot-sdk';
import type { MatrixProfileInfo } from '@rocket.chat/forked-matrix-bot-sdk';
import { IUser } from '@rocket.chat/core-typings';

import { matrixBridge } from '../bridge';
Expand Down Expand Up @@ -85,14 +85,14 @@ export const invite = async (inviterId: string, roomId: string, invitedId: strin
// Invite && Auto-join if the user is Rocket.Chat controlled
if (!invitedUserIsRemote) {
// Invite the user to the room
await matrixBridge.getIntent(inviterUser.mui).invite(matrixRoomId, invitedUserMatrixId);
await matrixBridge.getInstance().getIntent(inviterUser.mui).invite(matrixRoomId, invitedUserMatrixId);

console.log(`[${inviterId}-${invitedId}-${roomId}] Auto-join room...`);

await matrixBridge.getIntent(invitedUserMatrixId).join(matrixRoomId);
await matrixBridge.getInstance().getIntent(invitedUserMatrixId).join(matrixRoomId);
} else {
// Invite the user to the room but don't wait as this is dependent on the user accepting the invite because we don't control this user
matrixBridge.getIntent(inviterUser.mui).invite(matrixRoomId, invitedUserMatrixId);
matrixBridge.getInstance().getIntent(inviterUser.mui).invite(matrixRoomId, invitedUserMatrixId);
}

// Add the matrix user to the invited room
Expand All @@ -104,7 +104,7 @@ export const createRemote = async (u: IUser): Promise<ICreateUserResult> => {

console.log(`Creating remote user ${matrixUserId}...`);

const intent = matrixBridge.getIntent(matrixUserId);
const intent = matrixBridge.getInstance().getIntent(matrixUserId);

await intent.ensureProfile(u.name);

Expand All @@ -120,7 +120,7 @@ export const createRemote = async (u: IUser): Promise<ICreateUserResult> => {
export const createLocal = async (matrixUserId: string): Promise<ICreateUserResult> => {
console.log(`Creating local user ${matrixUserId}...`);

const intent = matrixBridge.getIntent(matrixUserId);
const intent = matrixBridge.getInstance().getIntent(matrixUserId);

let currentProfile: MatrixProfileInfo = {};

Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/federation-v2/server/startup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { isFederationMatrixEnabled } from './tools';

const [, , port] = settings.get<string>('Federation_Matrix_bridge_url').split(':') as bridgeUrlTuple;

matrixBridge.run(port);
matrixBridge.getInstance().run(port);

// TODO: Changes here should re-initialize the bridge instead of needing a restart
// Add settings listeners
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/utils/rocketchat.info
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "4.7.1"
"version": "4.7.2"
}
2 changes: 1 addition & 1 deletion apps/meteor/ee/app/livechat-enterprise/server/startup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ settings.change('Livechat_max_queue_wait_time', function () {
});

Meteor.startup(async function () {
settings.change('Livechat_abandoned_rooms_action', function (value) {
settings.watch('Livechat_abandoned_rooms_action', function (value) {
updatePredictedVisitorAbandonment();
if (!value || value === 'none') {
return visitorActivityMonitor.stop();
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@rocket.chat/meteor",
"description": "The Ultimate Open Source WebChat Platform",
"version": "4.7.1",
"version": "4.7.2",
"private": true,
"author": {
"name": "Rocket.Chat",
Expand Down Expand Up @@ -71,7 +71,7 @@
"@babel/register": "^7.14.5",
"@playwright/test": "^1.21.0",
"@rocket.chat/eslint-config": "workspace:^",
"@rocket.chat/livechat": "1.13.3",
"@rocket.chat/livechat": "workspace:^",
"@settlin/spacebars-loader": "^1.0.9",
"@storybook/addon-essentials": "~6.4.19",
"@storybook/addon-interactions": "~6.4.19",
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/packages/rocketchat-livechat/plugin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ mkdir $LIVECHAT_ASSETS_DIR
echo "Installing Livechat ${LATEST_LIVECHAT_VERSION}..."
cd $LIVECHAT_DIR

cp -a $ROOT/node_modules/\@rocket.chat/livechat/build/. ./
cp -a $ROOT/node_modules/\@rocket.chat/livechat/dist/. ./
# change to lowercase so all injected junk from rocket.chat is not sent: https://github.com/meteorhacks/meteor-inject-initial/blob/master/lib/inject-core.js#L10
# this is not harmful since doctype is case-insesitive: https://www.w3.org/TR/html5/syntax.html#the-doctype
meteor node -e 'fs.writeFileSync("index.html", fs.readFileSync("index.html").toString().replace("<!DOCTYPE", "<!doctype"));'
Expand Down
2 changes: 2 additions & 0 deletions apps/meteor/server/startup/initialData.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ Meteor.startup(async function () {
console.log('Inserting initial user:'.green);
console.log(JSON.stringify(initialUser, null, 2).green);
Users.create(initialUser);

await addUserToDefaultChannels(initialUser, true);
}
} catch (e) {
console.log('Error processing environment variable INITIAL_USER'.red, e);
Expand Down
Loading