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

converted rocketchat-message-mark-as-unread coffee/js #6445

Merged
merged 3 commits into from
Mar 23, 2017

Conversation

ggazzo
Copy link
Member

@ggazzo ggazzo commented Mar 23, 2017

@RocketChat/core

icon: 'icon-flag',
i18nLabel: 'Mark_as_unread',
context: ['message', 'message-mobile'],
action: function() {
Copy link
Member

Choose a reason for hiding this comment

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

Change action: function() { to action() {

i18nLabel: 'Mark_as_unread',
context: ['message', 'message-mobile'],
action: function() {
var message = this._arguments[1];
Copy link
Member

Choose a reason for hiding this comment

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

Lets never user var, you can use const here

@@ -0,0 +1,30 @@
Meteor.startup(function() {
Copy link
Member

Choose a reason for hiding this comment

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

Places where you don't want to access the scope (this) you can use () => { instead of function() {

if (error) {
return handleError(error);
}
subscription = ChatSubscription.findOne({
Copy link
Member

Choose a reason for hiding this comment

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

Remove the above declaration and use const here

return FlowRouter.go('home');
});
},
validation: function(message) {
Copy link
Member

Choose a reason for hiding this comment

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

Same thing here, use validation() {

@@ -0,0 +1,29 @@
import logger from './logger';
Meteor.methods({
unreadMessages: function(firstUnreadMessage) {
Copy link
Member

Choose a reason for hiding this comment

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

Use the short way here unreadMessages() {

import logger from './logger';
Meteor.methods({
unreadMessages: function(firstUnreadMessage) {
var lastSeen, originalMessage;
Copy link
Member

Choose a reason for hiding this comment

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

Do not declare variables before use when there is no need.

logger.connection.debug('Provided message is already marked as unread');
}
}
});
Copy link
Member

Choose a reason for hiding this comment

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

Where are the last 2 lines of code?

@engelgabriel engelgabriel modified the milestone: 0.55.0 Mar 23, 2017
@rodrigok rodrigok modified the milestone: 0.55.0 Mar 23, 2017
@rodrigok rodrigok merged commit 865eb9c into RocketChat:develop Mar 23, 2017
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