Due to the recent refactor that changed how `this.canTalk` works, if a user was muted in a room, and then tried to do a command that wasn't allowed to be used if they can't talk, it would send two replies: "You are muted and cannot talk in this room." AND "You cannot do this while unable to talk."
This makes it so that if you're using a command while muted that isn't allowed to be used if you can't talk, it will just use the "You are muted and cannot talk in this room." errorReply.
We had a lot of discussion in Dev and a somewhat-close poll, but in
the end "Chat" was a better name than "Messages", and also has the
advantage of being shorter (which is nice for Chat.html and
Chat.plural which should be short).
The following functions have been renamed:
- Tools.html to CommandParser.html
- Tools.plural to CommandParser.plural
- Tools.escapeHTML to CommandParser.escapeHTML
- Tools.toDurationString to CommandParser.toDurationString
- Tools.toTimeStamp to CommandParser.toTimestamp
(notice the lowercase 's')
This is in preparation for a rename of Tools to Dex (by removing the
non-dex-related functions) and a rename of CommandParser to either
Messages or Chat.
I've experienced this problem before, and it's sometimes hard to replicate, but this should correct it.
The reason why this was a problem was that because of the return statement, the line this.updateTo(user); never actually happened, so it wasn't updating in one specific instance.
Before, if a button text spanned over one line, it would default to the OS buttons.
Using the button class with in-line CSS, this makes the buttons remain consistent regardless of how many lines the button spans for a poll question.
- Method `this.runBroadcast()` has been split from `this.canBroadcast()`.
It's now the only method handling command-usage and intended as the main API
for synchronous commands. Async commands will execute both separately.
Note that the `suppressMessage` parameter is now passed to `runBroadcast`.
- The semantics of `broadcasting` have been similarly split.
`this,broadcastMessage` will be set to a truthy value when `this.canBroadcast` is run.
`this,broadcasting` will only be set to `true` once `this.runBroadcast` is executed.
Now that nodejs/node#3072 is mostly fixed, we can finally start using
Node 4+ features.
This refactor:
- uses arrow functions where appropriate
Note that arrow functions still aren't used in Mocha, where `this`
is sometimes meaningful.
This also removes the need for .bind() nearly everywhere, as well
as the `self = this` trick.
- refactors Validator and Connection into ES6 classes
- no longer uses Array#forEach for iterating arrays
We strongly prefer for (let i = 0; i < arr.length; i++) because of
performance reasons. Most forEaches have been replaced with for..of,
though, which is 5x slower than the long-form loop but 2x faster
than forEach, which is good enough outside of most inner loops.
The only exception is tournaments, which is due for a more invasive
refactor soon anyway.
Some room staff or people looking in the modlog may get confused by the message "The timeout was set to...," so this specifies that it's referring to "The poll" as it does when a poll is started / ended.