Skip to content

Commit

Permalink
fix review
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo committed Apr 4, 2017
1 parent d0f48f8 commit e6b5831
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 21 deletions.
12 changes: 4 additions & 8 deletions packages/rocketchat-lib/lib/configLogger.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
/* globals LoggerManager */
function log(fn = () => {}) {
return typeof LoggerManager !== 'undefined' && fn(LoggerManager);
}

RocketChat.settings.get('Log_Package', function(key, value) {
return log(LoggerManager => LoggerManager.showPackage = value);
return LoggerManager.showPackage = value;
});

RocketChat.settings.get('Log_File', function(key, value) {
return log(LoggerManager => LoggerManager.showFileAndLine = value);
return LoggerManager.showFileAndLine = value;
});

RocketChat.settings.get('Log_Level', function(key, value) {
if (value != null) {
log(LoggerManager => LoggerManager.logLevel = parseInt(value));
LoggerManager.logLevel = parseInt(value);
Meteor.setTimeout(() => {
return log(LoggerManager => LoggerManager.enable(true));
return LoggerManager.enable(true);
}, 200);
}
});
12 changes: 1 addition & 11 deletions packages/rocketchat-lib/server/startup/oAuthServicesUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@ const logger = new Logger('rocketchat:lib', {
}
});

function debounce(fn, delay) {
let timer = null;
return () => {
if (timer != null) {
Meteor.clearTimeout(timer);
}
return timer = Meteor.setTimeout(fn, delay);
};
}

function _OAuthServicesUpdate() {
const services = RocketChat.settings.get(/^(Accounts_OAuth_|Accounts_OAuth_Custom-)[a-z0-9_]+$/i);
services.forEach((service) => {
Expand Down Expand Up @@ -82,7 +72,7 @@ function _OAuthServicesUpdate() {
});
}

const OAuthServicesUpdate = debounce(_OAuthServicesUpdate, 2000);
const OAuthServicesUpdate = _.debounce(Meteor.bindEnvironment(_OAuthServicesUpdate), 2000);

function OAuthServicesRemove(_id) {
const serviceName = _id.replace('Accounts_OAuth_Custom-', '');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ function testWebAppInternals(fn) {
typeof WebAppInternals !== 'undefined' && fn(WebAppInternals);
}
RocketChat.settings.onload('CDN_PREFIX', function(key, value) {
if (_.isString(value || false)) {
if (_.isString(value) && value.trim()) {
return testWebAppInternals(WebAppInternals => WebAppInternals.setBundledJsCssPrefix(value));
}
});

Meteor.startup(function() {
const value = RocketChat.settings.get('CDN_PREFIX');
if (_.isString(value || false)) {
if (_.isString(value) && value.trim()) {
return testWebAppInternals(WebAppInternals => WebAppInternals.setBundledJsCssPrefix(value));
}
});

0 comments on commit e6b5831

Please sign in to comment.