-
Notifications
You must be signed in to change notification settings - Fork 10.6k
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-Master Package to Js #6498
Conversation
@@ -0,0 +1,303 @@ | |||
/* globals toolbarSearch, menu, isRtl, fireGlobalEvent, CachedChatSubscription */ | |||
Template.body.onRendered(function() { | |||
$(document.body).on('keydown', function(e) { |
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.
What happened with clipboard
?
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 It was never used again, breaking a eslint rule
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, so remove the variable assign, but keep the Clipboard instantiation
ls: 1 | ||
} | ||
}); | ||
fetch = subscriptions.fetch(); |
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 did you declare this var?
} | ||
}); | ||
fetch = subscriptions.fetch(); | ||
const 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.
There is no need to get and return results here
fetch = subscriptions.fetch(); | ||
const results = []; | ||
|
||
Object.keys(fetch).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.
The fetch's result is not an object, it's an array
}, | ||
requirePasswordChange() { | ||
const user = Meteor.user(); | ||
return (user ? user.requirePasswordChange : null) === 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.
You can simplify:
return user && user.requirePasswordChange === true;
return; | ||
} | ||
t.touchstartX = null; | ||
t.touchstartY = 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.
Why did you change from undefined
to null
?
}, | ||
'touchmove'(e, t) { | ||
if (t.touchstartX != null) { | ||
const touch = e.originalEvent.touches[0]; |
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 use const [touch] = e.originalEvent.touches;
here
cancelButtonText: t('Cancel') | ||
}); | ||
const user = Meteor.user(); | ||
const settings = user.settings; |
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
can be undefined
}); | ||
const user = Meteor.user(); | ||
const settings = user.settings; | ||
const prefs = user ? settings ? settings.preferences : null : 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 with const prefs = settings && settings.preferences
const user = Meteor.user(); | ||
const settings = user.settings; | ||
const prefs = user ? settings ? settings.preferences : null : null; | ||
if (prefs != null ? prefs.hideUsernames : 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 with if (prefs && prefs.hideUsernames) {
@RocketChat/core