Commit Graph

18 Commits

Author SHA1 Message Date
Guangcong Luo
7017dcb8f9 Mark tests using IPTools.lookup with "(network)"
(Also mark them with "(slow)" to skip them during a normal `npm test`.)

This is mostly the result of a particularly frustrating debugging
session when I couldn't figure out why these tests were timing out
(it turns out, it was because my DNS was broken so `IPTools.lookup` was
timing out). Marking them with "(network)" should make similar
situations less frustrating in the future.
2021-11-05 21:58:28 -04:00
Guangcong Luo
66fe68e8ee Tests: Refactor users-utils
The old users-utils had an unnecessarily difficult-to-use API. This
new one should be more straightforward and unified.
2021-01-09 22:33:32 -08:00
Guangcong Luo
a65faf263f
Stop using assert.strict.strictEqual (#7515)
It turns out that when I switched us from `assert` to `assert.strict`,
I didn't actually update any existing tests or tell anyone:

0df0d234f2

So apparently everyone else just kept on using `strictEqual`.

This will be a PR and also throw an error if people continue trying to
use it, which should make it much clearer what PS policy is on this.

A lot of the problem may be that TypeScript marks assert.strict.equal
as deprecated when it's not. This was fixed 4 days ago:

https://github.com/DefinitelyTyped/DefinitelyTyped/pull/48452

But this probably hasn't made it to a thing yet. Until then, you'll
have to deal with TS marking your tests as deprecated, but it shouldn't
be too long.

Accidentally using `assert` instead of `assert.strict` should now show
an error. This protects against the probably much worse mistake of
accidentally using `assert.equal` rather than `assert.strict.equal`.

`assert.ok` is also deprecated now.
2020-10-14 01:19:03 -07:00
Annika
83e8262d12
Users: Fix bug with IP handling (#7305) 2020-09-05 08:18:42 -07:00
Annika
c9fa3fc389
Refactor User#prevNames and User#ips to arrays (#7267) 2020-08-29 10:27:03 -07:00
Guangcong Luo
ba4998350a Fix more bugs in /hiderank 2020-08-22 16:03:10 -07:00
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
Guangcong Luo
d7ba455e2b Update permissions
Permissions have gotten out-of-date, so this commit syncs them.
Default permissions are now matched with Main, in particular including
the new & rank as admin (removing the old Leader rank and ~ symbol).

Relevant changes:
- Admin (~) and Leader (&) have been merged into Admin (&)
- The 'ban' permission was split into 'globalban' and 'ban'
- The 'broadcast' permission was renamed 'show' (going forward,
  "broadcast" should only refer to the big red/blue/green
  announcement bars.)
- Bots no longer have global moderation abilities, making it
  easier to give untrustworthy bots the "bot" rank.
2020-07-03 17:32:49 -04: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
Guangcong Luo
f6f4467265 Turn on prefer-const for .js files
Not having prefer-const on the JS side makes JS -> TS refactors really
unreadable. This commit just auto-fixes it so we're using
`prefer-const` everywhere.
2020-04-23 11:37:47 -07:00
asgdf
cac033ab86
Improve handling of mobile IPs with permalocks (#6338) 2020-03-07 11:50:08 -08:00
Guangcong Luo
229f5f809d Use assert in strict mode
This makes it so we can use `assert.equal` instead of
`assert.strictEqual`, which I think is more readable.
2020-02-20 00:39:31 -08:00
Waleed Hassan
6b62cfb06a Stop using Rooms.lobby in tests (#6316)
It's not guaranteed to exist.
2020-01-26 13:41:39 -08:00
whales
fa5f1389f8 Fix a few more userid -> id changes (#5886) 2019-10-15 18:20:58 +10:30
whales
71cee7bfac Add basic tests for permissions (#5847) 2019-10-05 00:30:49 +10:00
TheJetOU
2b28c9fd6b Refactor Rooms(), Users() to Rooms.get(), Users.get() (#5725) 2019-08-25 06:33:56 -07:00
Kirk Scheibelhut
8c7abf8729 Move dev-tools/user-utils.js -> test/user-utils.js 2019-04-15 15:24:56 -07:00
Slayer95
ffb3678b0f Test: Update folder structure to match source code (#5436) 2019-04-14 23:57:06 +09:30