Skip to content

Commit

Permalink
Merge branch 'develop' into regression/apps-limits
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigok authored Oct 16, 2023
2 parents 1c6db26 + c38711b commit fa7911e
Show file tree
Hide file tree
Showing 129 changed files with 2,072 additions and 1,219 deletions.
5 changes: 5 additions & 0 deletions .changeset/cool-zoos-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

fixed threads breaking when sending messages too fast
5 changes: 5 additions & 0 deletions .changeset/eleven-gorillas-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fix trying to upload same file again and again.
5 changes: 5 additions & 0 deletions .changeset/gentle-radios-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixed DM room with "guest" user kept as "read only" after reactivating user
5 changes: 5 additions & 0 deletions .changeset/heavy-ads-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

fix: Change plan name from Enterprise to Premium on marketplace filtering
5 changes: 5 additions & 0 deletions .changeset/lucky-vans-develop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixed issue with file attachments in rooms' messages export having no content
5 changes: 5 additions & 0 deletions .changeset/old-zoos-hang.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

fix: mobile ringing notification missing call id
5 changes: 5 additions & 0 deletions .changeset/perfect-pianos-yawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/presence': minor
---

Add peak connections monitoring and methods to get and reset the counter
6 changes: 6 additions & 0 deletions .changeset/popular-actors-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@rocket.chat/meteor": patch
"@rocket.chat/model-typings": patch
---

Do not allow auto-translation to be enabled in E2E rooms
5 changes: 5 additions & 0 deletions .changeset/proud-shrimps-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

fix: Unable to send attachments via email as an omni-agent
7 changes: 7 additions & 0 deletions .changeset/slow-coats-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@rocket.chat/meteor": minor
---

Add the daily and monthly peaks of concurrent connections to statistics
- Added `dailyPeakConnections` statistic for monitoring the daily peak of concurrent connections in a workspace;
- Added `maxMonthlyPeakConnections` statistic for monitoring the last 30 days peak of concurrent connections in a workspace;
5 changes: 5 additions & 0 deletions .changeset/stale-masks-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/server-fetch': patch
---

Fixed an issue where the payload of an HTTP request made by an app wouldn't be correctly encoded in some cases
5 changes: 5 additions & 0 deletions .changeset/tough-apples-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Forward headers when using proxy for file uploads
5 changes: 5 additions & 0 deletions .changeset/wicked-jars-double.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Handle the username update in the background
2 changes: 1 addition & 1 deletion apps/meteor/app/apps/server/bridges/livechat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ export class AppLivechatBridge extends LivechatBridge {
throw new Error('Could not get the message converter to process livechat room messages');
}

const livechatMessages = await Livechat.getRoomMessages({ rid: roomId });
const livechatMessages = await LivechatTyped.getRoomMessages({ rid: roomId });

return Promise.all(livechatMessages.map((message) => messageConverter.convertMessage(message) as Promise<IAppsEngineMesage>));
}
Expand Down
9 changes: 8 additions & 1 deletion apps/meteor/app/autotranslate/server/methods/saveSettings.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Subscriptions } from '@rocket.chat/models';
import { Subscriptions, Rooms } from '@rocket.chat/models';
import type { ServerMethods } from '@rocket.chat/ui-contexts';
import { check } from 'meteor/check';
import { Meteor } from 'meteor/meteor';
Expand Down Expand Up @@ -46,6 +46,13 @@ Meteor.methods<ServerMethods>({

switch (field) {
case 'autoTranslate':
const room = await Rooms.findE2ERoomById(rid, { projection: { _id: 1 } });
if (room && value === '1') {
throw new Meteor.Error('error-e2e-enabled', 'Enabling auto-translation in E2E encrypted rooms is not allowed', {
method: 'saveAutoTranslateSettings',
});
}

await Subscriptions.updateAutoTranslateById(subscription._id, value === '1');
if (!subscription.autoTranslateLanguage && options.defaultLanguage) {
await Subscriptions.updateAutoTranslateLanguageById(subscription._id, options.defaultLanguage);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Message } from '@rocket.chat/core-services';
import type { IUser } from '@rocket.chat/core-typings';
import { isRegisterUser } from '@rocket.chat/core-typings';
import { Rooms } from '@rocket.chat/models';
import { Rooms, Subscriptions } from '@rocket.chat/models';
import { Match } from 'meteor/check';
import { Meteor } from 'meteor/meteor';
import type { UpdateResult } from 'mongodb';
Expand All @@ -25,5 +25,9 @@ export const saveRoomEncrypted = async function (rid: string, encrypted: boolean

await Message.saveSystemMessage(type, rid, user.username, user);
}

if (encrypted) {
await Subscriptions.disableAutoTranslateByRoomId(rid);
}
return update;
};
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export async function getWorkspaceLicense(): Promise<{ updated: boolean; license

const payload = await fetchCloudWorkspaceLicensePayload({ token });

if (Date.parse(payload.updatedAt) <= currentLicense._updatedAt.getTime()) {
if (currentLicense.value && Date.parse(payload.updatedAt) <= currentLicense._updatedAt.getTime()) {
return fromCurrentLicense();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export async function announcementSync() {
} catch (err) {
SystemLogger.error({
msg: 'Failed to sync with Rocket.Chat Cloud',
url: '/sync',
url: '/comms/workspace',
err,
});
}
Expand Down
6 changes: 4 additions & 2 deletions apps/meteor/app/cloud/server/functions/syncWorkspace/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { SystemLogger } from '../../../../../server/lib/logger/system';
import { CloudWorkspaceAccessTokenError } from '../getWorkspaceAccessToken';
import { getCachedSupportedVersionsToken } from '../supportedVersionsToken/supportedVersionsToken';
import { announcementSync } from './announcementSync';
Expand All @@ -7,10 +8,11 @@ export async function syncWorkspace() {
try {
await syncCloudData();
await announcementSync();
} catch (error) {
if (error instanceof CloudWorkspaceAccessTokenError) {
} catch (err) {
if (err instanceof CloudWorkspaceAccessTokenError) {
// TODO: Remove License if there is no access token
}
SystemLogger.error({ msg: 'Error during workspace sync', err });
}

await getCachedSupportedVersionsToken.reset();
Expand Down
11 changes: 7 additions & 4 deletions apps/meteor/app/file-upload/server/config/AmazonS3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@ const get: FileUploadClass['get'] = async function (this: FileUploadClass, file,

const copy: FileUploadClass['copy'] = async function (this: FileUploadClass, file, out) {
const fileUrl = await this.store.getRedirectURL(file);
if (fileUrl) {
const request = /^https:/.test(fileUrl) ? https : http;
request.get(fileUrl, (fileRes) => fileRes.pipe(out));
} else {
if (!fileUrl) {
out.end();
return;
}

const request = /^https:/.test(fileUrl) ? https : http;
return new Promise((resolve) => {
request.get(fileUrl, (fileRes) => fileRes.pipe(out).on('finish', () => resolve()));
});
};

const AmazonS3Uploads = new FileUploadClass({
Expand Down
11 changes: 7 additions & 4 deletions apps/meteor/app/file-upload/server/config/GoogleStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@ const get: FileUploadClass['get'] = async function (this: FileUploadClass, file,
const copy: FileUploadClass['copy'] = async function (this: FileUploadClass, file, out) {
const fileUrl = await this.store.getRedirectURL(file, false);

if (fileUrl) {
const request = /^https:/.test(fileUrl) ? https : http;
request.get(fileUrl, (fileRes) => fileRes.pipe(out));
} else {
if (!fileUrl) {
out.end();
return;
}

const request = /^https:/.test(fileUrl) ? https : http;
return new Promise((resolve) => {
request.get(fileUrl, (fileRes) => fileRes.pipe(out).on('finish', () => resolve()));
});
};

const GoogleCloudStorageUploads = new FileUploadClass({
Expand Down
4 changes: 3 additions & 1 deletion apps/meteor/app/file-upload/server/config/Webdav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ const get: FileUploadClass['get'] = async function (this: FileUploadClass, file,
};

const copy: FileUploadClass['copy'] = async function (this: FileUploadClass, file, out) {
(await this.store.getReadStream(file._id, file)).pipe(out);
return new Promise(async (resolve) => {
(await this.store.getReadStream(file._id, file)).pipe(out).on('finish', () => resolve());
});
};

const WebdavUploads = new FileUploadClass({
Expand Down
27 changes: 26 additions & 1 deletion apps/meteor/app/file-upload/server/lib/FileUpload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,32 @@ export const FileUpload = {
) {
res.setHeader('Content-Disposition', `${forceDownload ? 'attachment' : 'inline'}; filename="${encodeURI(fileName)}"`);

request.get(fileUrl, (fileRes) => fileRes.pipe(res));
request.get(fileUrl, (fileRes) => {
if (fileRes.statusCode !== 200) {
res.setHeader('x-rc-proxyfile-status', String(fileRes.statusCode));
res.setHeader('content-length', 0);
res.writeHead(500);
res.end();
return;
}

// eslint-disable-next-line prettier/prettier
const headersToProxy = [
'age',
'cache-control',
'content-length',
'content-type',
'date',
'expired',
'last-modified',
];

headersToProxy.forEach((header) => {
fileRes.headers[header] && res.setHeader(header, String(fileRes.headers[header]));
});

fileRes.pipe(res);
});
},

generateJWTToFileUrls({ rid, userId, fileId }: { rid: string; userId: string; fileId: string }) {
Expand Down
1 change: 1 addition & 0 deletions apps/meteor/app/lib/server/functions/saveUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ export const saveUser = async function (userId, userData) {
_id: userData._id,
username: userData.username,
name: userData.name,
updateUsernameInBackground: true,
}))
) {
throw new Meteor.Error('error-could-not-save-identity', 'Could not save user identity', {
Expand Down
Loading

0 comments on commit fa7911e

Please sign in to comment.