Skip to content
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

Merged
merged 6 commits into from
Apr 6, 2017
Merged

Convert Message Pin Package to JS #6576

merged 6 commits into from
Apr 6, 2017

Conversation

MartinSchoeler
Copy link
Contributor

@RocketChat/core

@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-6576 April 3, 2017 19:08 Inactive
return this.autorun(() => {
return function() {
const data = Template.currentData();
return this.subscribe('pinnedMessages', data.rid, this.limit.get(), function() {
Copy link
Member

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)) {
Copy link
Member

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')) {
Copy link
Member

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)) {
Copy link
Member

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')) {
Copy link
Member

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() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use arrow function here

@engelgabriel engelgabriel added this to the 0.55.0 milestone Apr 6, 2017
@engelgabriel engelgabriel merged commit 2fa965c into develop Apr 6, 2017
@engelgabriel engelgabriel deleted the message-pin-to-js branch April 6, 2017 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants