Skip to content
Permalink
Browse files Browse the repository at this point in the history
Bump version to 3.11.3
  • Loading branch information
sampaiodiego committed Mar 27, 2021
1 parent 785cbf1 commit 4a0dce9
Show file tree
Hide file tree
Showing 17 changed files with 367 additions and 231 deletions.
2 changes: 1 addition & 1 deletion .docker/Dockerfile.rhel
@@ -1,6 +1,6 @@
FROM registry.access.redhat.com/ubi8/nodejs-12

ENV RC_VERSION 3.11.2
ENV RC_VERSION 3.11.3

MAINTAINER buildmaster@rocket.chat

Expand Down
16 changes: 16 additions & 0 deletions .github/history-manual.json
Expand Up @@ -63,5 +63,21 @@
"contributors": [
"sampaiodiego"
]
}],
"3.11.3": [{
"title": "[FIX] Bump Livechat widget",
"userLogin": "sampaiodiego",
"contributors": [
"sampaiodiego"
]
}, {
"title": "[FIX] Security Hotfix (https://docs.rocket.chat/guides/security/security-updates)",
"userLogin": "sampaiodiego",
"contributors": [
"sampaiodiego",
"g-thome",
"KevLehman",
"matheusbsilva137"
]
}]
}
22 changes: 22 additions & 0 deletions .github/history.json
Expand Up @@ -55349,6 +55349,28 @@
]
}
]
},
"3.10.6": {
"node_version": "12.18.4",
"npm_version": "6.14.8",
"apps_engine_version": "1.21.0-alpha.4235",
"mongo_versions": [
"3.4",
"3.6",
"4.0"
],
"pull_requests": []
},
"3.11.3": {
"node_version": "12.18.4",
"npm_version": "6.14.8",
"apps_engine_version": "1.22.2",
"mongo_versions": [
"3.4",
"3.6",
"4.0"
],
"pull_requests": []
}
}
}
1 change: 1 addition & 0 deletions .github/workflows/build_and_test.yml
Expand Up @@ -381,6 +381,7 @@ jobs:
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: 'us-east-1'
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
REDHAT_REGISTRY_PID: ${{ secrets.REDHAT_REGISTRY_PID }}
REDHAT_REGISTRY_KEY: ${{ secrets.REDHAT_REGISTRY_KEY }}
Expand Down
2 changes: 1 addition & 1 deletion .snapcraft/resources/prepareRocketChat
@@ -1,6 +1,6 @@
#!/bin/bash

curl -SLf "https://releases.rocket.chat/3.11.2/download/" -o rocket.chat.tgz
curl -SLf "https://releases.rocket.chat/3.11.3/download/" -o rocket.chat.tgz

tar xf rocket.chat.tgz --strip 1

Expand Down
2 changes: 1 addition & 1 deletion .snapcraft/snap/snapcraft.yaml
Expand Up @@ -7,7 +7,7 @@
# 5. `snapcraft snap`

name: rocketchat-server
version: 3.11.2
version: 3.11.3
summary: Rocket.Chat server
description: Have your own Slack like online chat, built with Meteor. https://rocket.chat/
confinement: strict
Expand Down
352 changes: 178 additions & 174 deletions HISTORY.md

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion app/api/server/v1/users.js
Expand Up @@ -714,7 +714,8 @@ API.v1.addRoute('users.2fa.sendEmailCode', {
const userId = this.userId || Users[method](emailOrUsername, { fields: { _id: 1 } })?._id;

if (!userId) {
throw new Meteor.Error('error-invalid-user', 'Invalid user');
this.logger.error('[2fa] User was not found when requesting 2fa email code');
return API.v1.success();
}

emailCheck.sendEmailCode(getUserForCheck(userId));
Expand Down
2 changes: 2 additions & 0 deletions app/emoji-custom/server/methods/insertOrUpdateEmoji.js
Expand Up @@ -45,6 +45,8 @@ Meteor.methods({
emojiData.aliases = [];
}

emojiData.extension = emojiData.extension === 'svg+xml' ? 'png' : emojiData.extension;

let matchingResults = [];

if (emojiData._id) {
Expand Down
18 changes: 16 additions & 2 deletions app/emoji-custom/server/methods/uploadEmojiCustom.js
@@ -1,21 +1,35 @@
import { Meteor } from 'meteor/meteor';
import limax from 'limax';
import sharp from 'sharp';

import { hasPermission } from '../../../authorization';
import { RocketChatFile } from '../../../file';
import { RocketChatFileEmojiCustomInstance } from '../startup/emoji-custom';
import { api } from '../../../../server/sdk/api';

const getFile = async (file, extension) => {
if (extension !== 'svg+xml') {
return file;
}

return sharp(file)
.png()
.toBuffer();
};

Meteor.methods({
uploadEmojiCustom(binaryContent, contentType, emojiData) {
async uploadEmojiCustom(binaryContent, contentType, emojiData) {
if (!hasPermission(this.userId, 'manage-emoji')) {
throw new Meteor.Error('not_authorized');
}

emojiData.name = limax(emojiData.name, { replacement: '_' });
// delete aliases for notification purposes. here, it is a string rather than an array
delete emojiData.aliases;
const file = new Buffer(binaryContent, 'binary');

const file = await getFile(Buffer.from(binaryContent, 'binary'), emojiData.extension);

emojiData.extension = emojiData.extension === 'svg+xml' ? 'png' : emojiData.extension;

const rs = RocketChatFile.bufferToStream(file);
RocketChatFileEmojiCustomInstance.deleteFile(encodeURIComponent(`${ emojiData.name }.${ emojiData.extension }`));
Expand Down
3 changes: 2 additions & 1 deletion app/mailer/server/api.js
Expand Up @@ -8,6 +8,7 @@ import stripHtml from 'string-strip-html';

import { settings } from '../../settings/server';
import { escapeHTML } from '../../../lib/escapeHTML';
import { replaceVariables } from './utils.js';

let contentHeader;
let contentFooter;
Expand All @@ -25,7 +26,7 @@ settings.get('Language', (key, value) => {
});

export const replacekey = (str, key, value = '') => str.replace(new RegExp(`(\\[${ key }\\]|__${ key }__)`, 'igm'), escapeHTML(value));
export const translate = (str) => str.replace(/\{ ?([^\} ]+)(( ([^\}]+))+)? ?\}/gmi, (match, key) => TAPi18n.__(key, { lng }));
export const translate = (str) => replaceVariables(str, (match, key) => TAPi18n.__(key, { lng }));
export const replace = function replace(str, data = {}) {
if (!str) {
return '';
Expand Down
1 change: 1 addition & 0 deletions app/mailer/server/utils.js
@@ -0,0 +1 @@
export const replaceVariables = (str, callback) => str.replace(/\{ *([^\{\} ]+)[^\{\}]*\}/gmi, callback);
66 changes: 66 additions & 0 deletions app/mailer/tests/api.tests.js
@@ -0,0 +1,66 @@
/* eslint-env mocha */
import assert from 'assert';

import { replaceVariables } from '../server/utils.js';

describe('Mailer-API', function() {
describe('translate', () => {
const i18n = {
key: 'value',
};

describe('single key', function functionName() {
it(`should be equal to test ${ i18n.key }`, () => {
assert.equal(`test ${ i18n.key }`, replaceVariables('test {key}', (match, key) => i18n[key]));
});
});

describe('multiple keys', function functionName() {
it(`should be equal to test ${ i18n.key } and ${ i18n.key }`, () => {
assert.equal(`test ${ i18n.key } and ${ i18n.key }`, replaceVariables('test {key} and {key}', (match, key) => i18n[key]));
});
});

describe('key with a trailing space', function functionName() {
it(`should be equal to test ${ i18n.key }`, () => {
assert.equal(`test ${ i18n.key }`, replaceVariables('test {key }', (match, key) => i18n[key]));
});
});

describe('key with a leading space', function functionName() {
it(`should be equal to test ${ i18n.key }`, () => {
assert.equal(`test ${ i18n.key }`, replaceVariables('test { key}', (match, key) => i18n[key]));
});
});

describe('key with leading and trailing spaces', function functionName() {
it(`should be equal to test ${ i18n.key }`, () => {
assert.equal(`test ${ i18n.key }`, replaceVariables('test { key }', (match, key) => i18n[key]));
});
});

describe('key with multiple words', function functionName() {
it(`should be equal to test ${ i18n.key }`, () => {
assert.equal(`test ${ i18n.key }`, replaceVariables('test {key ignore}', (match, key) => i18n[key]));
});
});

describe('key with multiple opening brackets', function functionName() {
it(`should be equal to test {${ i18n.key }`, () => {
assert.equal(`test {${ i18n.key }`, replaceVariables('test {{key}', (match, key) => i18n[key]));
});
});

describe('key with multiple closing brackets', function functionName() {
it(`should be equal to test ${ i18n.key }}`, () => {
assert.equal(`test ${ i18n.key }}`, replaceVariables('test {key}}', (match, key) => i18n[key]));
});
});

describe('key with multiple opening and closing brackets', function functionName() {
it(`should be equal to test {${ i18n.key }}`, () => {
assert.equal(`test {${ i18n.key }}`, replaceVariables('test {{key}}', (match, key) => i18n[key]));
});
});
});
});
2 changes: 1 addition & 1 deletion app/utils/rocketchat.info
@@ -1,3 +1,3 @@
{
"version": "3.11.2"
"version": "3.11.3"
}
Expand Up @@ -12,7 +12,13 @@ const getInitialValues = (data) => ({
public: !!data.public,
});

const checkInvalidOptions = (value) => value.trim() !== '' && !/^([a-zA-Z0-9-_ ]+)(,\s*[a-zA-Z0-9-_ ]+)*$/i.test(value);
const checkInvalidOptions = (value) => {
if (!value || value.trim() === '') {
return false;
}

return value.split(',').every((v) => /^[a-zA-Z0-9-_ ]+$/.test(v));
};

const CustomFieldsAdditionalFormContainer = ({ data = {}, state, onChange, className }) => {
const t = useTranslation();
Expand Down

0 comments on commit 4a0dce9

Please sign in to comment.