Commit Graph

129 Commits

Author SHA1 Message Date
Guangcong Luo
fe2eb27860
Refactor ip and modchat permissions (#7076)
- `ip` and `ipself` are now separate permissions. This means that `ip`
  is now a generalized permission for viewing IPs (no more need to use
  `globalban`, since `ipself` now controls the ability to see your own
  IP address)

- `alts` and `altsself` are now also separate (all users used to be
  able to `altsself`).

- `modchat`, `modchatall`, and `manageroom` are now just one `modchat`
  permission whose jurisdiction controls how high you can set modchat.
2020-07-29 00:38:52 -07:00
Annika
fc764aa8e2
Support requiring high-rated users to register (#7073) 2020-07-29 00:16:02 -07:00
Mia
5ca45205db
Add a throttle for pending challenges (#7045) 2020-07-24 12:04:29 -07:00
Annika
7e7620d301
Send information about locked users in /cmd userdetails (#7041) 2020-07-24 10:12:39 -07:00
Annika
528045a03f
Support hiding battles from /cmd userdetails (#7040) 2020-07-23 21:30:30 -07:00
Peach
e9611b7ce2
Remove unnecessary references to the global room (#7033) 2020-07-22 08:52:46 -07:00
Lusamine
3a2ca90040
Minor cleanup of global demotion messages (#7011) 2020-07-17 01:17:36 -07:00
Guangcong Luo
2e9328eada Support annotating chat commands
The nullable room refactor made it so there was no longer an easy way
to tell if a command could be used in PMs. This adds it back, as a
property on the handler function itself.

Now that we have properties on handler functions, I also added
`broadcastable` for whether or not the command is broadcastable.

It uses `Function#toString`, which is generally frowned-upon, but it's
well-specified and only happens during startup, so it shouldn't affect
performance after startup.

This also allows us not to need to repeat ourselves or give up
flexibility to have metadata about commands, which I think is worth the
tradeoff of reflection generally.
2020-07-13 00:55:23 -07:00
Annika
b590d3c907
Add /noreply command (#6953)
This command should never be used by users.

This is for scripting, like buttons, like:

    <button name="send" value="/nofeedback /ionext">

so they don't spam your PMs.
2020-07-10 22:01:15 -07:00
Kirk Scheibelhut
eea2196280
Server side changes to support persistent user settings and privacy changes (#6947)
NOTE: This is changes the semantics of `hidenext`/`ionext` from
applying to the next created *battle* to applying to the next
created *search*/*challenge*.
2020-07-06 21:18:38 -07:00
Mia
4997a47314
Commands: Allow the room parameter to be null (#6948)
Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2020-07-05 14:25:09 -07:00
Guangcong Luo
46c9afa2f3
"Remove" the global room (#6885)
I couldn't completely remove the global room in one commit, but this
solves basically every problem with it by making it no longer a `Room`.

In particular, this means:

- It's no longer of type `Room`
- It's no longer in the `Rooms.rooms` table
- Its class name is now `GlobalRoomState` rather than `GlobalRoom`
- It no longer tracks its own user list (online user count is now
  provided by `Users.onlineCount`)
- It's no longer a socket channel (there's new syntax for "send this
  message to every user")
2020-07-02 11:31:34 -07:00
Austin Couturier
25c185c010
Fix /tour forcepublic to prevent /hiddenroom (#6932) 2020-06-30 12:09:30 -07:00
Austin Couturier
f08bc21f26
Add an option to force public replays for room tournaments (#6927) 2020-06-29 19:21:21 -07:00
Guangcong Luo
6af875af8b Improve RoomPermission/GlobalPermission checks
Global permissions can no longer be used as room permissions. Instead,
the two are entirely separate lists, with only a few permissions in
both lists.
2020-06-21 03:53:06 -07:00
Guangcong Luo
0629a915a0 Support multiline /eval and /evalbattle 2020-06-10 11:23:20 -04:00
Guangcong Luo
0da724cba7 Correct /auth sorting direction
This also refactors /auth and /roomauth to both be in
moderation.ts (as good a place as any), and to use Utils.sortBy.
2020-06-10 11:23:20 -04:00
Mia
6839a1f4db
Add a library for utility functions (#6817) 2020-06-09 22:06:43 -07:00
Mia
15fed24b40
Refactor auth and room.settings (#6777)
This implements two big changes:

- All settings shared between `room.chatRoomData` and `room` have been
  merged into `room.settings` (so, for instance, `room.slowchat` is now
  only `room.settings.slowchat`).

  This makes it so we never have to worry about them getting "out of
  sync".

  - Checking to see if a room is persistent is now `if (room.persist)`
    instead of `if (room.chatRoomData)`

  - `Rooms.global.writeChatRoomData()` is now rarely called directly;
    there's a new `room.saveSettings()` which will handle it for you.

  - All properties of `room.settings` are now optional (except
    `title`).

- There's a new file `user-groups.ts` which handles authority.

  - `room.auth` and `Users.globalAuth` are now
    `Auth extends Map<ID, GroupSymbol>` objects.

  - `room.auth` is now always defined, removing the need for
    `room.auth?.[userid]` workarounds.

  - A lot of code relating to usergroups and permission checks have
    been refactored.

Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2020-06-09 08:22:25 -07:00
Annika
f4863a9444
Update references to Global Administrators post-flattening (#6815)
Co-authored-by: Charlie Kobayashi <sparkychildcharlie@gmail.com>
2020-06-08 09:41:03 -07:00
urkerab
eb84554a12
Remove last vestige of Pokebank (#6812) 2020-06-07 06:46:40 -07:00
Leonard Craft III
f7c46b7f33
Allow leaders+ to exportinputlog directly (#6668) 2020-05-08 23:46:25 -07:00
Guangcong Luo
31a81a91a2 Fix @type in .ts files
Some JSDoc type assertions failed to get converted during various .ts
refactors. This commit takes care of them.
2020-04-24 14:19:08 -07:00
Guangcong Luo
c49343b7e2 Setting a room rank can no longer demote globals
Previously, if you gave e.g. roomvoice to a global moderator, that
would demote their room rank to voice. Now, they will remain a
moderator, with "voice" only appearing in `/roomauth` and `/auth`.

(Includes a refactor of Config.groups)
2020-04-17 03:32:11 -07:00
Marty-D
8a29a46f25
Add more trainer avatars
made by Gnomowladny
2020-04-09 15:22:49 -04:00
Guangcong Luo
572342c8a0 Support listing gvoices with /auth + 2020-04-07 21:47:56 -04:00
Guangcong Luo
f8cac19340 Add more Ash avatars 2020-04-07 21:47:55 -04:00
Guangcong Luo
0afa0d49bc Fix /invite permissions
Now that roomauth bypasses modjoin, promoting anyone to roomvoice is
sufficient to give them access to any room.
2020-03-23 23:52:16 -07:00
Mia
1628258371
Typescript chat-commands/core (#6484)
Also fix TS line numbers in GitHub Actions
2020-03-23 23:50:35 -07:00