Skip to content

Commit

Permalink
Merge pull request #17600 from RocketChat/release-3.2.2
Browse files Browse the repository at this point in the history
Release 3.2.2
  • Loading branch information
sampaiodiego authored May 11, 2020
2 parents 485be3b + 47d0935 commit a720d25
Show file tree
Hide file tree
Showing 14 changed files with 259 additions and 102 deletions.
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/rhscl/nodejs-8-rhel7

ENV RC_VERSION 3.2.1
ENV RC_VERSION 3.2.2

MAINTAINER buildmaster@rocket.chat

Expand Down
98 changes: 98 additions & 0 deletions .github/history.json
Original file line number Diff line number Diff line change
Expand Up @@ -43631,6 +43631,104 @@
]
}
]
},
"2.4.12": {
"node_version": "8.17.0",
"npm_version": "6.13.4",
"mongo_versions": [
"3.4",
"3.6",
"4.0"
],
"pull_requests": [
{
"pr": "17578",
"title": "[FIX] Email configs not updating after setting changes",
"userLogin": "rodrigok",
"milestone": "3.2.2",
"contributors": [
"rodrigok"
]
}
]
},
"3.2.2": {
"node_version": "12.16.1",
"npm_version": "6.13.4",
"mongo_versions": [
"3.4",
"3.6",
"4.0"
],
"pull_requests": [
{
"pr": "17582",
"title": "[FIX] Push settings enabled when push gateway is selected",
"userLogin": "geekgonecrazy",
"milestone": "3.2.2",
"contributors": [
"geekgonecrazy",
"web-flow",
"sampaiodiego"
]
},
{
"pr": "17508",
"title": "[FIX] LDAP login on Enteprise Version",
"userLogin": "pierre-lehnen-rc",
"milestone": "3.2.2",
"contributors": [
"pierre-lehnen-rc"
]
},
{
"pr": "17579",
"title": "[FIX] Login Forbidden on servers that had LDAP enabled in the past",
"userLogin": "pierre-lehnen-rc",
"milestone": "3.2.2",
"contributors": [
"pierre-lehnen-rc"
]
},
{
"pr": "17578",
"title": "[FIX] Email configs not updating after setting changes",
"userLogin": "rodrigok",
"milestone": "3.2.2",
"contributors": [
"rodrigok"
]
},
{
"pr": "17577",
"title": "[FIX] Error during data export for DMs",
"userLogin": "mtmr0x",
"milestone": "3.2.2",
"contributors": [
"mtmr0x"
]
},
{
"pr": "17570",
"title": "[FIX] Emoji picker search broken",
"userLogin": "ggazzo",
"milestone": "3.2.2",
"contributors": [
"ggazzo",
"web-flow"
]
},
{
"pr": "17536",
"title": "[FIX] Reactions may present empty names of who reacted when using Real Names",
"userLogin": "rodrigok",
"description": "When changing usernames the reactions became outdated since it's not possible to update the usernames stored there, so when the server users Real Name setting enabled the system process all messages before return to the clients and get the names of the usernames to show since the usernames are outdated the names will not be found. Now the usernames will be displayed when the name can't be found as a temporary fix until we change the architecture of the data to fix the issue.",
"milestone": "3.2.2",
"contributors": [
"rodrigok"
]
}
]
}
}
}
53 changes: 53 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,40 @@

# 3.2.2
`2020-05-11 · 7 🐛 · 6 👩‍💻👨‍💻`

### Engine versions
- Node: `12.16.1`
- NPM: `6.13.4`
- MongoDB: `3.4, 3.6, 4.0`

### 🐛 Bug fixes


- Push settings enabled when push gateway is selected ([#17582](https://github.com/RocketChat/Rocket.Chat/pull/17582))

- LDAP login on Enteprise Version ([#17508](https://github.com/RocketChat/Rocket.Chat/pull/17508))

- Login Forbidden on servers that had LDAP enabled in the past ([#17579](https://github.com/RocketChat/Rocket.Chat/pull/17579))

- Email configs not updating after setting changes ([#17578](https://github.com/RocketChat/Rocket.Chat/pull/17578))

- Error during data export for DMs ([#17577](https://github.com/RocketChat/Rocket.Chat/pull/17577))

- Emoji picker search broken ([#17570](https://github.com/RocketChat/Rocket.Chat/pull/17570))

- Reactions may present empty names of who reacted when using Real Names ([#17536](https://github.com/RocketChat/Rocket.Chat/pull/17536))

When changing usernames the reactions became outdated since it's not possible to update the usernames stored there, so when the server users Real Name setting enabled the system process all messages before return to the clients and get the names of the usernames to show since the usernames are outdated the names will not be found. Now the usernames will be displayed when the name can't be found as a temporary fix until we change the architecture of the data to fix the issue.

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

- [@geekgonecrazy](https://github.com/geekgonecrazy)
- [@ggazzo](https://github.com/ggazzo)
- [@mtmr0x](https://github.com/mtmr0x)
- [@pierre-lehnen-rc](https://github.com/pierre-lehnen-rc)
- [@rodrigok](https://github.com/rodrigok)
- [@sampaiodiego](https://github.com/sampaiodiego)

# 3.2.1
`2020-05-01 · 1 🐛 · 1 👩‍💻👨‍💻`

Expand Down Expand Up @@ -1437,6 +1473,23 @@
- [@sampaiodiego](https://github.com/sampaiodiego)
- [@tassoevan](https://github.com/tassoevan)

# 2.4.12
`2020-05-11 · 1 🐛 · 1 👩‍💻👨‍💻`

### Engine versions
- Node: `8.17.0`
- NPM: `6.13.4`
- MongoDB: `3.4, 3.6, 4.0`

### 🐛 Bug fixes


- Email configs not updating after setting changes ([#17578](https://github.com/RocketChat/Rocket.Chat/pull/17578))

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

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

# 2.4.10
`2020-02-20 · 1 🐛 · 2 👩‍💻👨‍💻`

Expand Down
2 changes: 1 addition & 1 deletion app/emoji/client/emojiPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function getEmojisBySearchTerm(searchTerm) {

if (searchRegExp.test(current)) {
const emojiObject = emoji.list[current];
const { emojiPackage, shortnames } = emojiObject;
const { emojiPackage, shortnames = [] } = emojiObject;
let tone = '';
current = current.replace(/:/g, '');
const alias = shortnames[0] !== undefined ? shortnames[0].replace(/:/g, '') : shortnames[0];
Expand Down
31 changes: 22 additions & 9 deletions app/ldap/server/loginHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,31 @@ Accounts.registerLoginHandler('ldap', function(loginRequest) {
return result;
});

callbacks.add('beforeValidateLogin', (login) => {
if (!login.allowed) {
return login;
let LDAP_Enable;
settings.get('LDAP_Enable', (key, value) => {
if (LDAP_Enable === value) {
return;
}
LDAP_Enable = value;

if (login.type === 'ldap' || login.type === 'resume') {
return login;
if (!value) {
return callbacks.remove('beforeValidateLogin', 'validateLdapLoginFallback');
}

if (login.user.services && login.user.services.ldap && login.user.services.ldap.id) {
login.allowed = !!settings.get('LDAP_Login_Fallback');
}
callbacks.add('beforeValidateLogin', (login) => {
if (!login.allowed) {
return login;
}

return login;
// The fallback setting should only block password logins, so users that have other login services can continue using them
if (login.type !== 'password') {
return login;
}

if (login.user.services && login.user.services.ldap && login.user.services.ldap.id) {
login.allowed = !!settings.get('LDAP_Login_Fallback');
}

return login;
}, callbacks.priority.MEDIUM, 'validateLdapLoginFallback');
});
28 changes: 19 additions & 9 deletions app/lib/server/startup/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,16 @@ settings.addGroup('Meta', function() {
});
});

const pushEnabledWithoutGateway = [
{
_id: 'Push_enable',
value: true,
}, {
_id: 'Push_enable_gateway',
value: false,
},
];

settings.addGroup('Push', function() {
this.add('Push_enable', true, {
type: 'boolean',
Expand Down Expand Up @@ -1200,15 +1210,7 @@ settings.addGroup('Push', function() {
type: 'boolean',
public: true,
alert: 'Push_Setting_Requires_Restart_Alert',
enableQuery: [
{
_id: 'Push_enable',
value: true,
}, {
_id: 'Push_enable_gateway',
value: false,
},
],
enableQuery: pushEnabledWithoutGateway,
});
this.add('Push_test_push', 'push_test', {
type: 'action',
Expand All @@ -1221,39 +1223,47 @@ settings.addGroup('Push', function() {
this.section('Certificates_and_Keys', function() {
this.add('Push_apn_passphrase', '', {
type: 'string',
enableQuery: pushEnabledWithoutGateway,
secret: true,
});
this.add('Push_apn_key', '', {
type: 'string',
multiline: true,
enableQuery: pushEnabledWithoutGateway,
secret: true,
});
this.add('Push_apn_cert', '', {
type: 'string',
multiline: true,
enableQuery: pushEnabledWithoutGateway,
secret: true,
});
this.add('Push_apn_dev_passphrase', '', {
type: 'string',
enableQuery: pushEnabledWithoutGateway,
secret: true,
});
this.add('Push_apn_dev_key', '', {
type: 'string',
multiline: true,
enableQuery: pushEnabledWithoutGateway,
secret: true,
});
this.add('Push_apn_dev_cert', '', {
type: 'string',
multiline: true,
enableQuery: pushEnabledWithoutGateway,
secret: true,
});
this.add('Push_gcm_api_key', '', {
type: 'string',
enableQuery: pushEnabledWithoutGateway,
secret: true,
});
return this.add('Push_gcm_project_number', '', {
type: 'string',
public: true,
enableQuery: pushEnabledWithoutGateway,
secret: true,
});
});
Expand Down
2 changes: 1 addition & 1 deletion app/user-data-download/server/cronProcessDownloads.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const loadUserSubscriptions = function(exportOperation) {
const roomId = subscription.rid;
const roomData = Rooms.findOneById(roomId);
const roomName = roomData && roomData.name && subscription.t !== 'd' ? roomData.name : roomId;
const [userId] = subscription.t === 'd' ? roomId.uids.filter((uid) => uid !== exportUserId) : [null];
const [userId] = subscription.t === 'd' ? roomData.uids.filter((uid) => uid !== exportUserId) : [null];
const fileName = exportOperation.fullExport ? roomId : roomName;
const fileType = exportOperation.fullExport ? 'json' : 'html';
const targetFile = `${ fileName }.${ fileType }`;
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.2.1"
"version": "3.2.2"
}
15 changes: 9 additions & 6 deletions app/utils/server/lib/normalizeMessagesForUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ const filterStarred = (message, uid) => {

// TODO: we should let clients get user names on demand instead of doing this

function getNameOfUsername(users, username) {
return users.get(username) || username;
}

export const normalizeMessagesForUser = (messages, uid) => {
// if not using real names, there is nothing else to do
if (!settings.get('UI_Use_Real_Name')) {
Expand All @@ -33,28 +37,27 @@ export const normalizeMessagesForUser = (messages, uid) => {
.forEach((reaction) => reaction.usernames.forEach((username) => usernames.add(username)));
});

const users = {};
const names = new Map();

Users.findUsersByUsernames([...usernames.values()], {
fields: {
username: 1,
name: 1,
},
}).forEach((user) => {
users[user.username] = user.name;
names.set(user.username, user.name);
});

messages.forEach((message) => {
if (!message.u) {
return;
}
message.u.name = users[message.u.username];
message.u.name = getNameOfUsername(names, message.u.username);

(message.mentions || []).forEach((mention) => { mention.name = users[mention.username]; });
(message.mentions || []).forEach((mention) => { mention.name = getNameOfUsername(names, mention.username); });

Object.keys(message.reactions || {}).forEach((reaction) => {
const names = message.reactions[reaction].usernames.map((username) => users[username]);
message.reactions[reaction].names = names;
message.reactions[reaction].names = message.reactions[reaction].usernames.map((username) => getNameOfUsername(names, username));
});
});

Expand Down
16 changes: 15 additions & 1 deletion ee/app/ldap-enterprise/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import './hooks/syncExistentUser';
import './hooks/beforeSearchAll';

import { callbacks } from '../../../../app/callbacks/server';
import { settings } from '../../../../app/settings';
import { onLicense } from '../../license/server';

onLicense('ldap-enterprise', () => {
Expand All @@ -14,6 +15,19 @@ onLicense('ldap-enterprise', () => {
Meteor.startup(function() {
createSettings();
validateLDAPRolesMappingChanges();
callbacks.add('afterLDAPLogin', onLdapLogin);

let LDAP_Enable_LDAP_Roles_To_RC_Roles;
settings.get('LDAP_Enable_LDAP_Roles_To_RC_Roles', (key, value) => {
if (LDAP_Enable_LDAP_Roles_To_RC_Roles === value) {
return;
}

LDAP_Enable_LDAP_Roles_To_RC_Roles = value;
if (!value) {
return callbacks.remove('afterLDAPLogin', 'checkRoleMapping');
}

callbacks.add('afterLDAPLogin', onLdapLogin, callbacks.priority.MEDIUM, 'checkRoleMapping');
});
});
});
Loading

0 comments on commit a720d25

Please sign in to comment.