Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release-candidate' into develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	.docker/Dockerfile
#	.scripts/set-version.js
#	packages/rocketchat-google-natural-language/.npm/package/npm-shrinkwrap.json
  • Loading branch information
rodrigok committed May 11, 2017
2 parents 2d13247 + b16650f commit 10dc2c5
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .scripts/set-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const files = [
'./package.json',
'./.sandstorm/sandstorm-pkgdef.capnp',
'./.travis/snap.sh',
'./.docker/Dockerfile.sh',
'./.docker/Dockerfile',
'./packages/rocketchat-lib/rocketchat.info'
];

Expand Down

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

2 changes: 1 addition & 1 deletion packages/rocketchat-lib/client/lib/roomTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RocketChat.roomTypes = new class extends roomTypesCommon {
return _.map(list, (t) => t.identifier);
}
getUserStatus(roomType, roomId) {
this.roomTypes[roomType] && typeof this.roomTypes[roomType].getUserStatus === 'function' && this.roomTypes[roomType].getUserStatus(roomId);
return this.roomTypes[roomType] && typeof this.roomTypes[roomType].getUserStatus === 'function' && this.roomTypes[roomType].getUserStatus(roomId);
}
findRoom(roomType, identifier, user) {
return this.roomTypes[roomType] && this.roomTypes[roomType].findRoom(identifier, user);
Expand Down
6 changes: 3 additions & 3 deletions packages/rocketchat-lib/lib/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ RocketChat.settings = {
return _(actions).reduceRight(_.wrap, (err, success) => callback(err, success))();
},
load(key, value, initialLoad) {
['*', key].forEach(key => {
if (RocketChat.settings.callbacks[key]) {
RocketChat.settings.callbacks[key].forEach(callback => callback(key, value, initialLoad));
['*', key].forEach(item => {
if (RocketChat.settings.callbacks[item]) {
RocketChat.settings.callbacks[item].forEach(callback => callback(key, value, initialLoad));
}
});
Object.keys(RocketChat.settings.regexCallbacks).forEach(cbKey => {
Expand Down
19 changes: 19 additions & 0 deletions packages/rocketchat-lib/server/startup/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,20 @@ RocketChat.settings.addGroup('Email', function() {
});
});
this.section('SMTP', function() {
this.add('SMTP_Protocol', 'smtp', {
type: 'select',
values: [
{
key: 'smtp',
i18nLabel: 'smtp'
}, {
key: 'smtps',
i18nLabel: 'smtps'
}
],
env: true,
i18nLabel: 'Protocol'
});
this.add('SMTP_Host', '', {
type: 'string',
env: true,
Expand All @@ -491,6 +505,11 @@ RocketChat.settings.addGroup('Email', function() {
env: true,
i18nLabel: 'Port'
});
this.add('SMTP_Pool', true, {
type: 'boolean',
env: true,
i18nLabel: 'Pool'
});
this.add('SMTP_Username', '', {
type: 'string',
env: true,
Expand Down
20 changes: 18 additions & 2 deletions packages/rocketchat-lib/server/startup/settingsOnLoadSMTP.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
const buildMailURL = _.debounce(function() {
console.log('Updating process.env.MAIL_URL');

if (RocketChat.settings.get('SMTP_Host')) {
process.env.MAIL_URL = 'smtp://';
process.env.MAIL_URL = `${ RocketChat.settings.get('SMTP_Protocol') }://`;

if (RocketChat.settings.get('SMTP_Username') && RocketChat.settings.get('SMTP_Password')) {
process.env.MAIL_URL += `${ encodeURIComponent(RocketChat.settings.get('SMTP_Username')) }:${ encodeURIComponent(RocketChat.settings.get('SMTP_Password')) }@`;
}

process.env.MAIL_URL += encodeURIComponent(RocketChat.settings.get('SMTP_Host'));

if (RocketChat.settings.get('SMTP_Port')) {
return process.env.MAIL_URL += `:${ parseInt(RocketChat.settings.get('SMTP_Port')) }`;
process.env.MAIL_URL += `:${ parseInt(RocketChat.settings.get('SMTP_Port')) }`;
}

process.env.MAIL_URL += `?pool=${ RocketChat.settings.get('SMTP_Pool') }`;

return process.env.MAIL_URL;
}
}, 500);

Expand All @@ -34,6 +42,14 @@ RocketChat.settings.onload('SMTP_Password', function(key, value) {
}
});

RocketChat.settings.onload('SMTP_Protocol', function() {
return buildMailURL();
});

RocketChat.settings.onload('SMTP_Pool', function() {
return buildMailURL();
});

Meteor.startup(function() {
return buildMailURL();
});
8 changes: 3 additions & 5 deletions packages/rocketchat-theme/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,25 +71,23 @@ RocketChat.theme = new class {
this.compileDelayed = _.debounce(Meteor.bindEnvironment(this.compile.bind(this)), 100);
Meteor.startup(() => {
RocketChat.settings.onAfterInitialLoad(() => {
RocketChat.settings.get('*', Meteor.bindEnvironment((key, value) => {
RocketChat.settings.get(/^theme-./, Meteor.bindEnvironment((key, value) => {
if (key === 'theme-custom-css' && value != null) {
this.customCSS = value;
} else if (/^theme-.+/.test(key) === true) {
} else {
const name = key.replace(/^theme-[a-z]+-/, '');
if (this.variables[name] != null) {
this.variables[name].value = value;
}
} else {
return;
}

this.compileDelayed();
}));
});
});
}

compile() {

let content = [this.getVariablesAsLess()];

content.push(...this.files.map((name) => Assets.getText(name)));
Expand Down
4 changes: 3 additions & 1 deletion packages/rocketchat-ui/client/lib/fireEvent.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
window.fireGlobalEvent = function _fireGlobalEvent(eventName, params) {
window.dispatchEvent(new CustomEvent(eventName, {detail: params}));

Tracker.autorun((computation) => {
const enabled = RocketChat.settings.get('Iframe_Integration_send_enable');
if (enabled === undefined) {
return;
}
computation.stop();
if (enabled) {
window.dispatchEvent(new CustomEvent(eventName, {detail: params}));
parent.postMessage({
eventName,
data: params
}, RocketChat.settings.get('Iframe_Integration_send_target_origin'));
}
});
};

0 comments on commit 10dc2c5

Please sign in to comment.