-
Notifications
You must be signed in to change notification settings - Fork 11k
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 Ui Account Package to Js #6795
Conversation
const languages = TAPi18n.getLanguages(); | ||
const result = []; | ||
|
||
Object.keys(languages).forEach((key) => { |
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 .map
checked(property, value, defaultValue) { | ||
const user = Meteor.user(); | ||
let currentValue; | ||
if (user && user.settings && user.settings.preferences && user.settings.preferences[property] && defaultValue === 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.
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])) { |
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 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'); |
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 remove (
...)
return (KonchatNotification.notificationStatus.get() === 'granted') || (window.Notification && Notification.permission === 'granted'); | ||
}, | ||
desktopNotificationDisabled() { | ||
return (KonchatNotification.notificationStatus.get() === 'denied') || (window.Notification && Notification.permission === 'denied'); |
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 remove (
...)
confirmButtonText: t('Delete'), | ||
cancelButtonText: t('Cancel') | ||
}, () => { | ||
return function(typedPassword) { |
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 are returning a function that never will be executed.
confirmButtonText: t('Delete'), | ||
cancelButtonText: t('Cancel') | ||
}, () => { | ||
return function(deleteConfirmation) { |
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 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) { |
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 are returning a function that never will be executed.
Template.avatar.helpers({ | ||
imageUrl() { | ||
let username = this.username; | ||
if ((username == null) && (this.userId != 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.
remove (
... )
const loginWithService = `loginWith${ _.capitalize(this) }`; | ||
const serviceConfig = {}; | ||
return Meteor[loginWithService](serviceConfig, function(error) { | ||
if ((error && error.error) === 'github-no-public-email') { |
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.
if (error) {
if(error.error === 'github-no-public-email') {
return alert(t('github_no_public_email'));
}
console.log(error)
return toastr.error(error.message);
}
I will Improve some things pointed by @ggazzo |
and improve code style
@RocketChat/core