This is the source of the infamous !om g issue.
The new design looks better, anyway, and allows !formatshelp to also
be braodcast since it's no longer spammy.
!om searching will also now only search OMs.
PMs no longer special-case commands. The implementation of /invite,
/me, etc in commands have been fully moved from messages.js back to
commands.js and the rest. This makes Messages command support a lot
closer to how CommandParser itself handles commands; the two files
should be mergeable soon.
/me has been refactored, and now supports /ME, /me's, etc in PMs and
regular chat exactly the same way.
context.pmTarget is now guaranteed to be `User|undefined`, rather than
its previous specification of `User|string|undefined`. The previous
use-case of putting a string in context.pmTarget was to support
errorReply when PMing a nonexistent user, but special-casing that
case is easier than having to support a possible string pmTarget
everywhere.
Aliases like /j used to not work when called from the global room while not in
lobby.
Using rest parameters for TestPattern#register instead of a
single array came out to be faster.
/roomtopic also isn't a command.
This now makes it so that if a user can broadcast but cannot declare in that room, and they attempt to broadcast it, it will now send them the error reply themselves instead of broadcasting the error reply to the room.
Credits to Slayer95 for this fix!
These changes were supposed to be in de524c1a26 but got lost in my
Git stash...
Once again, this is very experimental code; please don't base any
serious changes on it.
- /ip would display "undefined" for rooms a user isn't banned/muted in
- CrisisMonitor would report private roombans/blacklists
- Roombans/blacklists would alert for rooms you're not in
- There were crashes in /mute and /hidetext
Roombans/blacklists have been mostly rewritten from scratch.
The new code mostly uses the same patterns as global punishments.
In addition:
- /ban has been renamed /globalban
- globalbans and blacklists now require a reason
- bans and blacklists in public rooms now show up in global modlog
- blacklist syntax is different: /blacklist and /unblacklist
- ban/blacklist display in /whoare is now more detailed
This isn't all the work that needs to be done on blacklists, but it's
the highest-priority changes.
- blacklists.tsv has been renamed room-punishments.tsv
- The format everywhere has changed to roomid:userid, rather than
roomid|userid
- roompunishments.tsv's format is now `Room ID:User ID, IPs and alts`
rather than `User ID, Room ID|IPs and alts`, which is more sane and
also cuts down on repetition of room IDs
Those are the changes that affect storage format, which are highest
priority because I don't want to support the previous format.
Other changes include:
- Punishments.roombannedIps renamed to Punishments.roomIps
- Punishments.roombannedUserids renamed to Punishments.roomUserids
- Some refactoring for ES6 destructuring
- Various bugfixes
Before, an options object containing properties and values to be used
was how decorated instances of the class would be created. This meant
the constructor could assign anything you feel like to `this`. Rather
than that, the constructor now assigns a strict set of values, and
methods are redefined in subclasses.
Basic unit tests were added to test if they could be written for after
the final refactor to fix the other memory leak here.
Before, if a user was perma locked or perma banned, it would show that their lock would expire in a negative time - this fixes that.
For consistency, I also added the check to the namelock check as well.
This commit introduces Tools.html and Tools.plural, helper functions
for string construction.
Tools.html is a template tag function that escapes HTML inside the
template string.
Tools.plural is a helper function that takes a passed Number, Array,
Set, or Map and returns a string representing whether or not it's
plural.
It also starts doing some refactors of some files to make it clear how
I expect code style for template strings to look.
Previously, we used ' for IDs, " for English text, and ' for code.
We should now be using ' for IDs, ` for English text, and ` for code.
This lets regular users, or users who don't have permission to use !htmlbox to first test and validate HTML by using the same validation system PS uses across the sim for things like roomintros, for example.
Users#roomCount, previously a null-prototype roomid:count Object,
is now Users#inRooms, a roomid Set.
The new name is "inRooms" rather than "rooms" mostly for ease of
greppability. I'm kind of tired of getting Rooms.rooms when
grepping for ".rooms"
This is the next step in the process of using Maps/Sets instead of
null-proto Objects for maps/sets we add/remove to/from a lot.
I tried to get rid of the room counter completely, but that made
iterating a user's rooms take tens of milliseconds rather than
tens of microseconds, which is unacceptably slow for how often we do
that.
Not actively tracking the number of connections in a room does not
change the asymptotic complexity of any function. It slows down
leaveRoom but doesn't change its asymptotic complexity (nor does
it slow it down in any noticeable way).
leaveRoom was, incidentally, kinda gnarly code which is now a lot
cleaner. Yay!
#Zarel: >No results found.
#Zarel: why is that red???
%panpawn: I don't know
%panpawn: it was red before that commit
#Zarel: Should probably be sendReply for "No results found"
- The line that we're removing from pminfobox was checking a character limit, which isn't ideal when we're using HTML.
- The fact that bots can always use /addhtmlbox even when they aren't able to talk is a potential security issue, so we're adding a check to prevent that.
This was inspired by https://github.com/Zarel/Pokemon-Showdown/pull/2471
We are also removing the github-specific code from /htmlbox as well, removing the modchat alias of * for player, and we are giving room owners and leaders the roombot permission so they can promote to it.
Lists the rooms that a user is muted in: http://i.imgur.com/xaO8sCx.png
Similar to "banned from", this can be useful to determine if a user is
hitting multiple rooms.
Unless we want to change the syntax for data tables like pokedex.js,
'constructor' will always exist as a table key.
These changes represent the bare minimum to prevent this from
causing too-weird behavior.
The on-site FAQ and beginner's guide have been moved to a forum thread
to ease maintenance. This removes several entries from /faq because you
can't link to specific sections of a forum post. Unmatched targets now
link to the general FAQ post instead of giving error messages for
somewhat backwards compatibility with removed entries.
- 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.