Convert Ui Account Package to Js#6795
Merged
Merged
Conversation
ggazzo
reviewed
May 10, 2017
| const languages = TAPi18n.getLanguages(); | ||
| const result = []; | ||
|
|
||
| Object.keys(languages).forEach((key) => { |
| checked(property, value, defaultValue) { | ||
| const user = Meteor.user(); | ||
| let currentValue; | ||
| if (user && user.settings && user.settings.preferences && user.settings.preferences[property] && defaultValue === true) { |
Member
There was a problem hiding this comment.
something like that is better:
checked(property, value, defaultValue) {
const user = Meteor.user();
if (user && user.settings && user.settings.preferences && user.settings.preferences[property]) {
if(defaultValue === true) {
return currentValue === value;
}
return !!user.settings.preferences[property] === value
}
},| }, | ||
| selected(property, value, defaultValue) { | ||
| const user = Meteor.user(); | ||
| if (!(user && user.settings && user.settings.preferences && user.settings.preferences[property])) { |
Member
There was a problem hiding this comment.
You can test this better if you invert the logic and test just one time user && user.settings && user.settings .....
| return user && user.settings && user.settings.preferences && user.settings.preferences['highlights'] && user.settings.preferences['highlights'].join(', '); | ||
| }, | ||
| desktopNotificationEnabled() { | ||
| return (KonchatNotification.notificationStatus.get() === 'granted') || (window.Notification && Notification.permission === 'granted'); |
| return (KonchatNotification.notificationStatus.get() === 'granted') || (window.Notification && Notification.permission === 'granted'); | ||
| }, | ||
| desktopNotificationDisabled() { | ||
| return (KonchatNotification.notificationStatus.get() === 'denied') || (window.Notification && Notification.permission === 'denied'); |
| confirmButtonText: t('Delete'), | ||
| cancelButtonText: t('Cancel') | ||
| }, () => { | ||
| return function(typedPassword) { |
Member
There was a problem hiding this comment.
you are returning a function that never will be executed.
| confirmButtonText: t('Delete'), | ||
| cancelButtonText: t('Cancel') | ||
| }, () => { | ||
| return function(deleteConfirmation) { |
Member
There was a problem hiding this comment.
you are returning a function that never will be executed.
| e.currentTarget.innerHTML = `${ e.currentTarget.innerHTML } ...`; | ||
| e.currentTarget.disabled = true; | ||
| return Meteor.call('sendConfirmationEmail', user.emails && user.emails[0] && user.emails[0].address(() => { | ||
| return function(error, results) { |
Member
There was a problem hiding this comment.
you are returning a function that never will be executed.
| Template.avatar.helpers({ | ||
| imageUrl() { | ||
| let username = this.username; | ||
| if ((username == null) && (this.userId != null)) { |
| const loginWithService = `loginWith${ _.capitalize(this) }`; | ||
| const serviceConfig = {}; | ||
| return Meteor[loginWithService](serviceConfig, function(error) { | ||
| if ((error && error.error) === 'github-no-public-email') { |
Member
There was a problem hiding this comment.
if (error) {
if(error.error === 'github-no-public-email') {
return alert(t('github_no_public_email'));
}
console.log(error)
return toastr.error(error.message);
}
Member
Author
|
I will Improve some things pointed by @ggazzo |
and improve code style
Member
Author
rodrigok
approved these changes
May 16, 2017
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@RocketChat/core