-
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 Message Pin Package to JS #6576
Conversation
return this.autorun(() => { | ||
return function() { | ||
const data = Template.currentData(); | ||
return this.subscribe('pinnedMessages', data.rid, this.limit.get(), 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.
If you use function
here the this
inside the function will be referent to the function, as we are trying to access the this.hasMore
above you should use =>
return false; | ||
} | ||
let originalMessage = RocketChat.models.Messages.findOneById(message._id); | ||
if (!(originalMessage && originalMessage._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.
if (originalMessage == null || originalMessage._id == null) {
is more readable
action: 'Message_pinning' | ||
}); | ||
} | ||
if (RocketChat.settings.get('Message_KeepHistory')) { |
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.
Keep the comments
|
||
let originalMessage = RocketChat.models.Messages.findOneById(message._id); | ||
|
||
if (!(originalMessage && originalMessage._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.
if (originalMessage == null || originalMessage._id == null) {
action: 'Message_pinning' | ||
}); | ||
} | ||
if (RocketChat.settings.get('Message_KeepHistory')) { |
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.
Keep the comment
this.limit = new ReactiveVar(50); | ||
return this.autorun(() => { | ||
const data = Template.currentData(); | ||
return this.subscribe('pinnedMessages', data.rid, this.limit.get(), 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.
Use arrow function here
@RocketChat/core