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 slashcommand-leave coffee to js #6470

Merged
merged 2 commits into from
Mar 29, 2017

Conversation

ggazzo
Copy link
Member

@ggazzo ggazzo commented Mar 24, 2017

@RocketChat/core

* @param {Object} message - The message object
*/
if (Meteor.isClient) {
RocketChat.slashCommands.add('leave', null, {
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Contributor

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

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') {
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 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

Copy link
Member Author

Choose a reason for hiding this comment

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

my mistake, sorry :/

@engelgabriel engelgabriel modified the milestone: 0.55.0 Mar 29, 2017
@engelgabriel engelgabriel merged commit 37f9ae3 into RocketChat:develop Mar 29, 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.

5 participants