-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rocketchat-lib part1 #6553
rocketchat-lib part1 #6553
Conversation
@@ -0,0 +1,19 @@ | |||
/* globals LoggerManager */ | |||
RocketChat.settings.get('Log_Package', function(key, value) { | |||
return (typeof LoggerManager !== 'undefined') && LoggerManager !== null && (LoggerManager.showPackage = value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplify to LoggerManager && LoggerManager.showPackage = value;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, if the variable LoggerManager
have never been declared, It will throw an exception
LoggerManager && LoggerManager.showPackage = value; // Uncaught ReferenceError: LoggerManager is not defined
typeof LoggerManager != 'undefined' && LoggerManager.showPackage = value; // nothing happens
}); | ||
|
||
RocketChat.settings.get('Log_File', function(key, value) { | ||
return typeof LoggerManager !== 'undefined' && LoggerManager !== null && (LoggerManager.showFileAndLine = value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
|
||
RocketChat.settings.get('Log_Level', function(key, value) { | ||
if (value != null) { | ||
if (typeof LoggerManager !== 'undefined' && LoggerManager !== null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplify to LoggerManager != null
LoggerManager.logLevel = parseInt(value); | ||
} | ||
Meteor.setTimeout(() => { | ||
return typeof LoggerManager !== 'undefined' && LoggerManager !== null && LoggerManager.enable(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
@@ -0,0 +1,8 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the .coffee file?
@@ -0,0 +1,1006 @@ | |||
RocketChat.settings.add('uniqueID', process.env.DEPLOYMENT_ID || Random.id(), { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you keep the comments?
hidden: true | ||
}); | ||
|
||
RocketChat.settings.addGroup('Accounts', function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you keep the comments?
/* globals WebAppInternals*/ | ||
RocketChat.settings.onload('CDN_PREFIX', function(key, value) { | ||
if (_.isString(value || false)) { | ||
return typeof WebAppInternals !== 'undefined' && WebAppInternals !== null && WebAppInternals.setBundledJsCssPrefix(value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplify this line
|
||
Meteor.startup(function() { | ||
const value = RocketChat.settings.get('CDN_PREFIX'); | ||
if (_.isString(value || false)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any string value will be considered true
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My wish was testing if the variable is a string or it is not an empty string.
"asda"||false - > "asda"
""||false - > false
because _.isString("") === true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, but that looks strange and will allow spaces. What about if (_.isString(value) && value.trim())
just to be more clear?
Meteor.startup(function() { | ||
const value = RocketChat.settings.get('CDN_PREFIX'); | ||
if (_.isString(value || false)) { | ||
return typeof WebAppInternals !== 'undefined' && WebAppInternals !== null && WebAppInternals.setBundledJsCssPrefix(value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplify this line
RocketChat.settings.get('Log_Package', function(key, value) { | ||
return (typeof LoggerManager !== 'undefined') && LoggerManager !== null && (LoggerManager.showPackage = value); | ||
return log(LoggerManager => LoggerManager.showPackage = value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not LoggerManager && LoggerManager.showPackage = value
?
RocketChat.settings.onload('CDN_PREFIX', function(key, value) { | ||
if (_.isString(value || false)) { | ||
return typeof WebAppInternals !== 'undefined' && WebAppInternals !== null && WebAppInternals.setBundledJsCssPrefix(value); | ||
return testWebAppInternals(WebAppInternals => WebAppInternals.setBundledJsCssPrefix(value)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not WebAppInternals && WebAppInternals.setBundledJsCssPrefix(value)
?
@ggazzo Can you fix the conflicts? |
yes, I can. |
No description provided.