Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into feat…
Browse files Browse the repository at this point in the history
…/new-threads

* 'develop' of github.com:RocketChat/Rocket.Chat:
  [FIX] Push settings enabled when push gateway is selected (#17582)
  [FIX] LDAP login on Enteprise Version (#17508)
  [FIX] Login Forbidden on servers that had LDAP enabled in the past (#17579)
  [FIX] Email configs not updating after setting changes (#17578)
  [FIX] Error during data export for DMs (#17577)
  Regression: Override via env for string settings not working (#17576)
  [FIX] Emoji picker search broken (#17570)
  Add some missing metadata information (#17524)
  Bump jquery from 3.3.1 to 3.5.0 (#17486)
  [NEW] Show user's status description by the usernames in messages list (#14892)
  DPlatform is deprecated and the replacement does not support rocket.chat (#17040)
  • Loading branch information
ggazzo committed May 10, 2020
2 parents b9b19a0 + 161b5d4 commit b25b6ae
Show file tree
Hide file tree
Showing 16 changed files with 245 additions and 149 deletions.
23 changes: 22 additions & 1 deletion .github/history.json
Original file line number Diff line number Diff line change
Expand Up @@ -43321,6 +43321,13 @@
]
},
"3.2.0-rc.2": {
"node_version": "12.16.1",
"npm_version": "6.13.4",
"mongo_versions": [
"3.4",
"3.6",
"4.0"
],
"pull_requests": [
{
"pr": "17453",
Expand Down Expand Up @@ -43406,6 +43413,13 @@
]
},
"3.1.2": {
"node_version": "12.16.1",
"npm_version": "6.13.4",
"mongo_versions": [
"3.4",
"3.6",
"4.0"
],
"pull_requests": [
{
"pr": "17454",
Expand Down Expand Up @@ -43513,6 +43527,13 @@
]
},
"3.2.0": {
"node_version": "12.16.1",
"npm_version": "6.13.4",
"mongo_versions": [
"3.4",
"3.6",
"4.0"
],
"pull_requests": [
{
"pr": "17454",
Expand Down Expand Up @@ -43620,4 +43641,4 @@
]
}
}
}
}
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
* [RocketChatLauncher](#rocketchatlauncher)
* [Layershift](#layershift)
* [Yunohost.org](#yunohostorg)
* [DPlatform](#dplatform)
* [IndieHosters](#indiehosters)
* [Ubuntu 16.04](#ubuntu-1604)
* [Cloudron.io](#cloudronio)
Expand Down Expand Up @@ -127,12 +126,6 @@ Host your own Rocket.Chat server in a few seconds.

[![Install RocketChat with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=rocketchat)

## DPlatform

The easiest way to install a ready-to-run Rocket.Chat server on a Linux machine, VM, or VPS.

[![DP deploy](https://raw.githubusercontent.com/DFabric/DPlatform-ShellCore/images/logo.png)](https://dfabric.github.io/DPlatform-ShellCore)

## IndieHosters
Get your Rocket.Chat instance hosted in an "as a Service" style. You register and we manage it for you! (updates, backup...).

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 @@ -1173,6 +1173,16 @@ settings.addGroup('Mobile', 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 @@ -1207,15 +1217,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 @@ -1228,39 +1230,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
107 changes: 106 additions & 1 deletion app/settings/server/functions/settings.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe('Settings', () => {
expect(Settings.findOne({ _id: 'my_setting2' }).value).to.be.equal(false);
});

it('should respect override via environment', () => {
it('should respect override via environment as int', () => {
process.env.OVERWRITE_SETTING_my_setting = '1';

settings.addGroup('group', function() {
Expand Down Expand Up @@ -125,6 +125,111 @@ describe('Settings', () => {
expect(Settings.findOne({ _id: 'my_setting' })).to.include(expectedSetting);
});

it('should respect override via environment as boolean', () => {
process.env.OVERWRITE_SETTING_my_setting_bool = 'true';

settings.addGroup('group', function() {
this.section('section', function() {
this.add('my_setting_bool', false, {
type: 'boolean',
sorter: 0,
});
});
});

const expectedSetting = {
value: true,
processEnvValue: true,
valueSource: 'processEnvValue',
type: 'boolean',
sorter: 0,
group: 'group',
section: 'section',
packageValue: false,
hidden: false,
blocked: false,
secret: false,
i18nLabel: 'my_setting_bool',
i18nDescription: 'my_setting_bool_Description',
autocomplete: true,
};

expect(Settings.data.size).to.be.equal(2);
expect(Settings.upsertCalls).to.be.equal(2);
expect(Settings.findOne({ _id: 'my_setting_bool' })).to.include(expectedSetting);

process.env.OVERWRITE_SETTING_my_setting_bool = 'false';

settings.addGroup('group', function() {
this.section('section', function() {
this.add('my_setting_bool', false, {
type: 'boolean',
sorter: 0,
});
});
});

expectedSetting.value = false;
expectedSetting.processEnvValue = false;

expect(Settings.data.size).to.be.equal(2);
expect(Settings.upsertCalls).to.be.equal(3);
expect(Settings.findOne({ _id: 'my_setting_bool' })).to.include(expectedSetting);
});

it('should respect override via environment as string', () => {
process.env.OVERWRITE_SETTING_my_setting_str = 'hey';

settings.addGroup('group', function() {
this.section('section', function() {
this.add('my_setting_str', '', {
type: 'string',
sorter: 0,
});
});
});

const expectedSetting = {
value: 'hey',
processEnvValue: 'hey',
valueSource: 'processEnvValue',
type: 'string',
sorter: 0,
group: 'group',
section: 'section',
packageValue: '',
hidden: false,
blocked: false,
secret: false,
i18nLabel: 'my_setting_str',
i18nDescription: 'my_setting_str_Description',
autocomplete: true,
};

expect(Settings.data.size).to.be.equal(2);
expect(Settings.upsertCalls).to.be.equal(2);
expect(Settings.findOne({ _id: 'my_setting_str' })).to.include(expectedSetting);

process.env.OVERWRITE_SETTING_my_setting_str = 'hey ho';

settings.addGroup('group', function() {
this.section('section', function() {
this.add('my_setting_str', 'hey', {
type: 'string',
sorter: 0,
});
});
});

expectedSetting.value = 'hey ho';
expectedSetting.processEnvValue = 'hey ho';
expectedSetting.packageValue = 'hey';

expect(Settings.data.size).to.be.equal(2);
expect(Settings.upsertCalls).to.be.equal(3);
expect(Settings.findOne({ _id: 'my_setting_str' })).to.include(expectedSetting);
});

it('should respect initial value via environment', () => {
process.env.my_setting = '1';

Expand Down
4 changes: 4 additions & 0 deletions app/settings/server/functions/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ const overrideSetting = (_id: string, value: SettingValue, options: ISettingAddO
value = false;
} else if (options.type === 'int') {
value = parseInt(envValue);
} else {
value = envValue;
}
options.processEnvValue = value;
options.valueSource = 'processEnvValue';
Expand All @@ -41,6 +43,8 @@ const overrideSetting = (_id: string, value: SettingValue, options: ISettingAddO
value = false;
} else if (options.type === 'int') {
value = parseInt(overwriteValue);
} else {
value = overwriteValue;
}
options.value = value;
options.processEnvValue = value;
Expand Down
3 changes: 3 additions & 0 deletions app/ui-message/client/message.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
<button type="button" class="user user-card-message color-primary-font-color" data-username="{{msg.u.username}}" tabindex="1">
{{getName}}{{#if showUsername}} <span class="message-alias border-component-color color-info-font-color">@{{msg.u.username}}</span>{{/if}}
</button>
{{#if getStatus}}
<button class="rc-tooltip rc-tooltip--up rc-tooltip--start" aria-label="{{getStatus}}">💬</button>
{{/if}}
<span class="info border-component-color color-info-font-color"></span>
{{# if showRoles }}
{{#each role in roleTags}}
Expand Down
5 changes: 5 additions & 0 deletions app/ui-message/client/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import s from 'underscore.string';
import { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';
import { Template } from 'meteor/templating';
import { Session } from 'meteor/session';
import { TAPi18n } from 'meteor/rocketchat:tap-i18n';

import { timeAgo, formatDateAndTime } from '../../lib/client/lib/formatDate';
Expand Down Expand Up @@ -157,6 +158,10 @@ Template.message.helpers({
return msg.avatar.replace(/^@/, '');
}
},
getStatus() {
const { msg } = this;
return Session.get(`user_${ msg.u.username }_status_text`);
},
getName() {
const { msg, settings } = this;
if (msg.alias) {
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
Loading

0 comments on commit b25b6ae

Please sign in to comment.