-
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 slashcommand-leave coffee to js #6470
Conversation
* @param {Object} message - The message object | ||
*/ | ||
if (Meteor.isClient) { | ||
RocketChat.slashCommands.add('leave', null, { |
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.
Why did you change undefined
to null
?
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.
because in this case, there are no difference.
the test is RocketChat.slashCommands.commands[command]?.callback?
it will test callback != null;
, but I can change if you prefer.
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.
To me undefined
reads and is more "javascripty" than null
, so I would personally prefer undefined
.
description: 'Leave_the_current_channel' | ||
}); | ||
} else { | ||
const Leave = function Leave(command, params, item) { |
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.
Why declare a variable if you are naming a function?
}); | ||
} else { | ||
const Leave = function Leave(command, params, item) { | ||
if (command !== 'leave' || command !== 'part') { |
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 invert a condition you need to invert the conditionals too:
if(command == "leave" || command == "part")
continue
Should be:
if (command !== 'leave' && command !== 'part') {
return
In your conde command part
will execute the return
cuz it's different from leave
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.
my mistake, sorry :/
e7e962c
to
0b180a8
Compare
@RocketChat/core