-
Notifications
You must be signed in to change notification settings - Fork 10.9k
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
Convert Oembed Package to Js #6688
Conversation
if (this.collapsed) { | ||
return this.collapsed; | ||
} else { | ||
return (user && user.settings && user.settings.preferences && user.settings.preferences.collapseMediaByDefault); |
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.
You can move the variable declaration here. And there is no need for the parenthesis
if (this.collapsed) { | ||
return this.collapsed; | ||
} else { | ||
return (user && user.settings && user.settings.preferences && user.settings.preferences.collapseMediaByDefault) === 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 thing here
loadImage() { | ||
const user = Meteor.user(); | ||
|
||
if (user && user.settings && user.settings.preferences && user.settings.preferences.autoImageLoad === false && this.downloadImages) { |
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.
I guess the correct condition here is this.downloadImages == null
if (user && user.settings && user.settings.preferences && user.settings.preferences.autoImageLoad === false && this.downloadImages) { | ||
return false; | ||
} | ||
if (Meteor.Device.isPhone() && user() && user.settings && user.settings.preferences && user.settings.preferences.saveMobileBandwidth && this.downloadImages) { |
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.
User is not a function here, you already called the function to get the data. The correct condition for downloadImage is this.downloadImages == null
if (this.collapsed != null) { | ||
return this.collapsed; | ||
} else { | ||
return (user && user.settings && user.settings.preferences && user.settings.preferences.collapseMediaByDefault) === 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.
Move the declaration here and remove the parenthesis
if (this.collapsed != null) { | ||
return this.collapsed; | ||
} else { | ||
return (user && user.settings && user.settings.preferences && user.settings.preferences.collapseMediaByDefault) === 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.
Move the declaration here and remove the parenthesis
if (this.collapsed) { | ||
return this.collapsed; | ||
} else { | ||
return (user && user.settings && user.settings.preferences && user.settings.preferences.collapseMediaByDefault) === 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
if (this.collapsed) { | ||
return this.collapsed; | ||
} else { | ||
return (user && user.settings && user.settings.preferences && user.settings.preferences.collapseMediaByDefault) === 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
}; | ||
|
||
const getUrlContent = function(urlObj, redirectCount, callback) { | ||
if (redirectCount == 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.
Use default value here
}); | ||
} | ||
if (content && content.statusCode !== 200) { | ||
return; |
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.
Did you forget to return the data? return data;
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.
@rodrigok But here data
would just return undefined since the variable is being created just after that return, or did i miss something here?
@rodrigok could you do another review? |
@RocketChat/core Please let me know if i something is wrong, since this is a fairly big package.