Skip to content
Closed
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .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 3.14.4
ENV RC_VERSION 3.14.5

MAINTAINER [email protected]

Expand Down
74 changes: 74 additions & 0 deletions .github/history.json
Original file line number Diff line number Diff line change
Expand Up @@ -59696,6 +59696,80 @@
]
}
]
},
"3.12.7": {
"node_version": "12.18.4",
"npm_version": "6.14.8",
"apps_engine_version": "1.23.0",
"mongo_versions": [
"3.4",
"3.6",
"4.0"
],
"pull_requests": [
{
"pr": "22172",
"title": "[FIX] Discussion names showing a random value",
"userLogin": "sampaiodiego",
"milestone": "3.14.4",
"contributors": [
"sampaiodiego"
]
}
]
},
"3.13.5": {
"node_version": "12.21.0",
"npm_version": "6.14.8",
"apps_engine_version": "1.24.1",
"mongo_versions": [
"3.4",
"3.6",
"4.0"
],
"pull_requests": [
{
"pr": "22172",
"title": "[FIX] Discussion names showing a random value",
"userLogin": "sampaiodiego",
"milestone": "3.14.4",
"contributors": [
"sampaiodiego"
]
}
]
},
"3.14.5": {
"node_version": "12.22.1",
"npm_version": "6.14.1",
"apps_engine_version": "1.25.0",
"mongo_versions": [
"3.4",
"3.6",
"4.0"
],
"pull_requests": [
{
"pr": "22258",
"title": "[IMPROVE] Send only relevant data via WebSocket",
"userLogin": "sampaiodiego",
"description": "Previously when any data changed on subscriptions or rooms we were getting fresh data from database, to also remove undesired fields, but sometimes the data that changed was not relevant so we were sending the whole object everytime **without** the fields that actually changed. This change aims to reduce this overhead and also send less data to clients.",
"milestone": "3.14.5",
"contributors": [
"sampaiodiego",
"web-flow"
]
},
{
"pr": "22257",
"title": "[FIX] Support DISABLE_PRESENCE_MONITOR env var in new DB watchers",
"userLogin": "sampaiodiego",
"milestone": "3.14.5",
"contributors": [
"sampaiodiego"
]
}
]
}
}
}
2 changes: 1 addition & 1 deletion .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/3.14.4/download/" -o rocket.chat.tgz
curl -SLf "https://releases.rocket.chat/3.14.5/download/" -o rocket.chat.tgz

tar xf rocket.chat.tgz --strip 1

Expand Down
2 changes: 1 addition & 1 deletion .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: 3.14.4
version: 3.14.5
summary: Rocket.Chat server
description: Have your own Slack like online chat, built with Meteor. https://rocket.chat/
confinement: strict
Expand Down
63 changes: 62 additions & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@

# 3.14.5
`2021-06-06 · 1 🚀 · 1 🐛 · 1 👩‍💻👨‍💻`

### Engine versions
- Node: `12.22.1`
- NPM: `6.14.1`
- MongoDB: `3.4, 3.6, 4.0`
- Apps-Engine: `1.25.0`

### 🚀 Improvements


- Send only relevant data via WebSocket ([#22258](https://github.com/RocketChat/Rocket.Chat/pull/22258))

Previously when any data changed on subscriptions or rooms we were getting fresh data from database, to also remove undesired fields, but sometimes the data that changed was not relevant so we were sending the whole object everytime **without** the fields that actually changed. This change aims to reduce this overhead and also send less data to clients.

### 🐛 Bug fixes


- Support DISABLE_PRESENCE_MONITOR env var in new DB watchers ([#22257](https://github.com/RocketChat/Rocket.Chat/pull/22257))

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

- [@sampaiodiego](https://github.com/sampaiodiego)

# 3.14.4
`2021-05-27 · 2 🐛 · 2 👩‍💻👨‍💻`
`2021-05-28 · 2 🐛 · 2 👩‍💻👨‍💻`

### Engine versions
- Node: `12.22.1`
Expand Down Expand Up @@ -589,6 +614,24 @@
- [@thassiov](https://github.com/thassiov)
- [@tiagoevanp](https://github.com/tiagoevanp)

# 3.13.5
`2021-05-27 · 1 🐛 · 1 👩‍💻👨‍💻`

### Engine versions
- Node: `12.21.0`
- NPM: `6.14.8`
- MongoDB: `3.4, 3.6, 4.0`
- Apps-Engine: `1.24.1`

### 🐛 Bug fixes


- Discussion names showing a random value ([#22172](https://github.com/RocketChat/Rocket.Chat/pull/22172))

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

- [@sampaiodiego](https://github.com/sampaiodiego)

# 3.13.3
`2021-04-20 · 2 🐛 · 3 👩‍💻👨‍💻`

Expand Down Expand Up @@ -1279,6 +1322,24 @@
- [@tassoevan](https://github.com/tassoevan)
- [@tiagoevanp](https://github.com/tiagoevanp)

# 3.12.7
`2021-05-27 · 1 🐛 · 1 👩‍💻👨‍💻`

### Engine versions
- Node: `12.18.4`
- NPM: `6.14.8`
- MongoDB: `3.4, 3.6, 4.0`
- Apps-Engine: `1.23.0`

### 🐛 Bug fixes


- Discussion names showing a random value ([#22172](https://github.com/RocketChat/Rocket.Chat/pull/22172))

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

- [@sampaiodiego](https://github.com/sampaiodiego)

# 3.12.5
`2021-04-20 · 1 🐛 · 1 👩‍💻👨‍💻`

Expand Down
6 changes: 3 additions & 3 deletions app/models/server/models/LivechatVisitors.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import { Base } from './_Base';
import Settings from './Settings';
import { escapeRegExp } from '../../../../lib/escapeRegExp';

const settingsRaw = Settings.model.rawCollection();
const findAndModify = Meteor.wrapAsync(settingsRaw.findAndModify, settingsRaw);

export class LivechatVisitors extends Base {
constructor() {
super('livechat_visitor');
Expand Down Expand Up @@ -124,9 +127,6 @@ export class LivechatVisitors extends Base {
* @return {string} The next visitor name
*/
getNextVisitorUsername() {
const settingsRaw = Settings.model.rawCollection();
const findAndModify = Meteor.wrapAsync(settingsRaw.findAndModify, settingsRaw);

const query = {
_id: 'Livechat_guest_count',
};
Expand Down
2 changes: 1 addition & 1 deletion app/utils/rocketchat.info
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "3.14.4"
"version": "3.14.5"
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const QuickActions: FC<QuickActionsProps> = ({ room, className }) => {

useEffect(() => {
getVisitorEmail();
}, [room, getVisitorEmail]);
}, [visitorRoomId, getVisitorEmail]);

const closeModal = useCallback(() => setModal(null), [setModal]);

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Rocket.Chat",
"description": "The Ultimate Open Source WebChat Platform",
"version": "3.14.4",
"version": "3.14.5",
"author": {
"name": "Rocket.Chat",
"url": "https://rocket.chat/"
Expand Down
62 changes: 45 additions & 17 deletions server/modules/watchers/watchers.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,24 @@ type Watcher = <T extends IBaseData>(model: IBaseRaw<T>, fn: (event: IChange<T>)

type BroadcastCallback = <T extends keyof EventSignatures>(event: T, ...args: Parameters<EventSignatures[T]>) => Promise<void>;

const hasKeys = (requiredKeys: string[]): (data?: Record<string, any>) => boolean =>
(data?: Record<string, any>): boolean => {
if (!data) {
return false;
}

return Object.keys(data)
.filter((key) => key !== '_id')
.map((key) => key.split('.')[0])
.some((key) => requiredKeys.includes(key));
};

const hasRoomFields = hasKeys(Object.keys(roomFields));
const hasSubscriptionFields = hasKeys(Object.keys(subscriptionFields));

const startMonitor = typeof process.env.DISABLE_PRESENCE_MONITOR === 'undefined'
|| !['true', 'yes'].includes(String(process.env.DISABLE_PRESENCE_MONITOR).toLowerCase());

export function initWatchers(models: IModelsParam, broadcast: BroadcastCallback, watch: Watcher): void {
const {
Messages,
Expand Down Expand Up @@ -122,10 +140,14 @@ export function initWatchers(models: IModelsParam, broadcast: BroadcastCallback,
}
});

watch<ISubscription>(Subscriptions, async ({ clientAction, id }) => {
watch<ISubscription>(Subscriptions, async ({ clientAction, id, data, diff }) => {
switch (clientAction) {
case 'inserted':
case 'updated': {
if (!hasSubscriptionFields(data || diff)) {
return;
}

// Override data cuz we do not publish all fields
const subscription = await Subscriptions.findOneById(id, { projection: subscriptionFields });
if (!subscription) {
Expand Down Expand Up @@ -164,22 +186,24 @@ export function initWatchers(models: IModelsParam, broadcast: BroadcastCallback,
});
});

watch<IUserSession>(UsersSessions, async ({ clientAction, id, data }) => {
switch (clientAction) {
case 'inserted':
case 'updated':
data = data ?? await UsersSessions.findOneById(id);
if (!data) {
return;
}
if (startMonitor) {
watch<IUserSession>(UsersSessions, async ({ clientAction, id, data }) => {
switch (clientAction) {
case 'inserted':
case 'updated':
data = data ?? await UsersSessions.findOneById(id);
if (!data) {
return;
}

broadcast('watch.userSessions', { clientAction, userSession: data });
break;
case 'removed':
broadcast('watch.userSessions', { clientAction, userSession: { _id: id } });
break;
}
});
broadcast('watch.userSessions', { clientAction, userSession: data });
break;
case 'removed':
broadcast('watch.userSessions', { clientAction, userSession: { _id: id } });
break;
}
});
}

watch<IInquiry>(LivechatInquiry, async ({ clientAction, id, data, diff }) => {
switch (clientAction) {
Expand Down Expand Up @@ -278,12 +302,16 @@ export function initWatchers(models: IModelsParam, broadcast: BroadcastCallback,
broadcast('watch.settings', { clientAction, setting });
});

watch<IRoom>(Rooms, async ({ clientAction, id, data }) => {
watch<IRoom>(Rooms, async ({ clientAction, id, data, diff }) => {
if (clientAction === 'removed') {
broadcast('watch.rooms', { clientAction, room: { _id: id } });
return;
}

if (!hasRoomFields(data || diff)) {
return;
}

const room = data ?? await Rooms.findOneById(id, { projection: roomFields });
if (!room) {
return;
Expand Down