-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
converted rocketchat-message-mark-as-unread coffee/js #6445
Conversation
icon: 'icon-flag', | ||
i18nLabel: 'Mark_as_unread', | ||
context: ['message', 'message-mobile'], | ||
action: 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.
Change action: function() {
to action() {
i18nLabel: 'Mark_as_unread', | ||
context: ['message', 'message-mobile'], | ||
action: function() { | ||
var message = this._arguments[1]; |
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.
Lets never user var
, you can use const
here
@@ -0,0 +1,30 @@ | |||
Meteor.startup(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.
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({ |
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.
Remove the above declaration and use const
here
return FlowRouter.go('home'); | ||
}); | ||
}, | ||
validation: function(message) { |
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.
Same thing here, use validation() {
@@ -0,0 +1,29 @@ | |||
import logger from './logger'; | |||
Meteor.methods({ | |||
unreadMessages: function(firstUnreadMessage) { |
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 the short way here unreadMessages() {
import logger from './logger'; | ||
Meteor.methods({ | ||
unreadMessages: function(firstUnreadMessage) { | ||
var lastSeen, originalMessage; |
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.
Do not declare variables before use when there is no need.
logger.connection.debug('Provided message is already marked as unread'); | ||
} | ||
} | ||
}); |
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 are the last 2 lines of code?
@RocketChat/core