Skip to content

converted slashcommand-leave coffee to js#6470

Merged
engelgabriel merged 2 commits into
RocketChat:developfrom
ggazzo:slashcommands-leave
Mar 29, 2017
Merged

converted slashcommand-leave coffee to js#6470
engelgabriel merged 2 commits into
RocketChat:developfrom
ggazzo:slashcommands-leave

Conversation

@ggazzo

@ggazzo ggazzo commented Mar 24, 2017

Copy link
Copy Markdown
Member

@RocketChat/core

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.

Why did you change undefined to null?

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

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.

Why declare a variable if you are naming a 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 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
Copy Markdown
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 :/

@ggazzo ggazzo force-pushed the slashcommands-leave branch from e7e962c to 0b180a8 Compare March 28, 2017 14:58
@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