Commit Graph

45 Commits

Author SHA1 Message Date
Mia
1c75a2a450 Polls: Fix /poll timer display 2021-02-26 17:56:22 -06:00
Annika
c2e97aaaed
Use optional chaining in more places (#8063) 2021-02-22 11:42:05 -08:00
Kris Johnson
82b20aaf8e
Use /msgroom in more places (#8042) 2021-02-16 20:10:05 -08:00
Guangcong Luo
ec0b96e93d Fix delete button on Poll queue page
Fixes #7832
2021-02-01 16:13:07 -08:00
Mia
76c10841ea
Lib: Add an index file for all exports (#7972) 2021-01-31 18:00:19 -08:00
Mia
a8edba9bd3
Minor activities: Don't re-display on hotpatch (#7970) 2021-01-31 00:36:07 -08:00
Kris Johnson
081326b69c
Refactor minor activities (#7766) 2021-01-28 12:12:54 -08:00
Mia
a63fb0074a
CommandContext: Add a method for refreshing html pages (#7666) 2021-01-28 12:10:50 -08:00
Guangcong Luo
1558811b03 Refactor Polls for Chat.ErrorMessage
Also adds an error message for "option already selected".
2021-01-12 19:58:34 -08:00
Guangcong Luo
8fcdf1a895 Fix people voting >1 time for one poll option
Fixes #7906

Fixes https://www.smogon.com/forums/threads/bug-reports-v4-read-original-post-before-posting.3663703/page-40#post-8685683
2021-01-11 16:23:12 -08:00
Distrib
045a15f0bd
Poll: Fix viewqueue (#7902) 2021-01-10 13:49:18 -08:00
Kris Johnson
8b78eeb011 Fix HTML polls 2020-12-31 14:16:20 -07:00
Guangcong Luo
99f5234e75 Fix a bunch of bugs in Polls/Announcements
- Polls were always starting as quizzes even when they weren't

- Hotpatching chat would reset poll/announcement timers

- A lot of bugs relating to minute/millisecond confusion in timer code

- Poll answers were called `questions` in the source code for some
  reason; they've been renamed to consistently be `answer`.

- Refactor out an extremely unnecessary manual iteration
2020-12-28 08:50:34 -05:00
Mia
2cca8bd48e
Support persisting polls and announcements (#7477) 2020-12-28 01:02:13 -08:00
Guangcong Luo
c13a9c84fb Improve /help poll 2020-12-21 21:26:51 -08:00
Distrib
393abfb056
Polls: Redesign help and add missing command (#7803) 2020-12-21 13:55:47 -08:00
Kris Johnson
fba68d5be6
Reformat old instances of CommandContext/Room#tr (#7744) 2020-12-01 06:31:55 -08:00
Mia
67ee30f2fd
Introduce Config.noipchecks (#7626) 2020-11-04 15:14:30 -08:00
Mia
22a410afea
Support basic text formatting in polls/announcements (#7623) 2020-11-02 08:42:03 -08:00
Annika
97713bad33
Validate timeout durations (#7556) 2020-10-22 13:47:26 -07:00
Mia
4279d1f3bc
Update attributions in various locations (#7354) 2020-10-06 15:55:26 -07:00
Annika
f1b4e3d43a
Modlog: Refactor to use ModlogEntry objects (#7403) 2020-09-28 11:06:30 -07:00
Mia
44fc0123ad
Chat: Refactor CommandContext and PageContext to use ErrorMessage more (#7234) 2020-09-06 00:15:16 -07:00
Annika
9d57cc096b
Use the room language to translate mod actions (#7261) 2020-08-26 09:05:34 -07:00
DieterReinert
47e780ef2c
Poll: missing < in opening tag (#7194) 2020-08-10 16:30:59 +04:00
Annika
4318d7c9bc
Fix modlog formatting (#7173) 2020-08-07 11:17:34 -07:00
Guangcong Luo
873efe91ce Refactor extractRoom to requireRoom
New in PageContext as of 9b3a986ef4ef7:

`extractRoom` no longer shows an error message if the room isn't found.
Instead, `requireRoom` does that.
2020-08-06 00:54:02 -07:00
Annika
ae11a699a6
Add a BasicRoom#tr method (#7143) 2020-08-05 19:14:41 -07:00
Annika
1b52e51ae0
Polls: Make strings translatable (#7110) 2020-08-01 16:51:41 -07:00
Lusamine
3a2ca90040
Minor cleanup of global demotion messages (#7011) 2020-07-17 01:17:36 -07:00
Mia
6690cfb037
Fix pollqueue page crash (#6986) 2020-07-09 22:19:43 -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
fart
8503a6de1f
Correct commands in poll queue help (#6916) 2020-06-25 12:43:04 +04:00
Mia
f9e79220dd
Polls: Support queuing (#6595) 2020-06-20 23:56:04 -07: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
whales
64d3cc59c8 Polls: fix blankvoting, help message 2020-03-27 17:09:04 +10:30
Guangcong Luo
125fe31d06 Improve eslintrc
Fixed some more code style, allowing these rules to be enabled:

- `comma-dangle`
- `function-paren-newline`
- `member-delimiter-style`
- `no-eval`
- `no-fallthrough`
- `no-misused-promises`
- `no-unused-vars`
- `operator-linebreak`
2020-03-06 22:35:55 -08:00
Waleed Hassan
8aa4f053bb
Use optional chaining and linter improvements (#6422)
This is mostly just a follow up to #6342.

`prefer-optional-chaining` was turned on and fixed in every location it
complained in. The transformed function [0] looks expensive from a
glance but from skimming through the replaced sites it doesn't appear
to be ran in any important place, so it should be OK.

The linter improvements are:
- Increase linter performance
	- Make `full-lint` and `lint` write to different caches so we
	  avoid overwriting their caches since they're different configs
	- Change husky's hook to `npm run lint` so as to write to the
	  same cache
	- Remove `@typescript-eslint/eslint-plugin-tslint` which is
	  essentially a wrapper to TSLint because the rules aren't worth
	  running another linter
- Convert `.eslintrc.json` and `.eslintrc-syntax.json` to two spaces
  rather than four tabs to respect PS' `.editorconfig`
- Rename `fulllint` to `full-lint` to ease spelling it

[0] - https://pastie.io/mmtxpf.js (prettified)
2020-03-06 11:44:32 -08:00
Guangcong Luo
b21c9047e2
Migrate to typescript-eslint (#6342) 2020-03-05 08:33:06 -08:00
whales
f2ac6a111e
Support polls allowing multiple responses (#6356) 2020-02-20 23:54:23 -08:00
Kris Johnson
9aaab2c57b
Typescript Help Tickets and Modlog and fix warnings (#6352) 2020-02-12 21:48:03 -08:00
Guangcong Luo
411afba392 TypeScript Announcements/Poll chat plugins 2019-11-11 02:13:48 +13:00