Skip to content

Convert Message Pin Package to JS#6576

Merged
engelgabriel merged 6 commits into
developfrom
message-pin-to-js
Apr 6, 2017
Merged

Convert Message Pin Package to JS#6576
engelgabriel merged 6 commits into
developfrom
message-pin-to-js

Conversation

@MartinSchoeler
Copy link
Copy Markdown
Member

@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

3 participants