Commit Graph

118 Commits

Author SHA1 Message Date
Roardom
ec9b19ffbf refactor: use boolean for user audible
Instead of int.
2025-09-30 06:58:59 +00:00
Roardom
28c99c9736 refactor: cleanup workaround for creating systembot echoes/audibles
When the user changes the bot in the front-end (e.g. clicks the systembot button), it calls the bot pm method with an empty string and the pm method creates audibles/echoes but doesn't create the message if it's an empty string. Feels like an awfully hacky method, so I'm making the logic more explicit.
2025-09-03 03:32:14 +00:00
Roardom
f3bb05a93b fix: eager loading of user for echo and audible eloquent resources 2025-09-03 03:32:14 +00:00
Roardom
67058a702c refactor: inline $which in chatbox api
Makes the code easier to follow.
2025-09-03 03:32:14 +00:00
Roardom
27f8f51362 refactor: inline runbot in chat api 2025-09-03 03:32:14 +00:00
Roardom
7cfb4317c2 refactor: remove unused targeted variable in chat api 2025-09-03 03:32:14 +00:00
Roardom
bf1492e92a refactor: use more readable syntax to parse chatbox /msg command 2025-09-03 03:32:14 +00:00
Roardom
b7b8e42493 refactor: remove dead branches from chat api
These branches are never hit because the same conditions are checked in the first 3 if statements, so they would never be hit by the time they're inside the 4th if statement.
2025-09-03 03:32:14 +00:00
Roardom
5ddbed21a3 refactor: inline trip in chat api
Makes it a bit easier to read and reduces variable scope.
2025-09-03 03:32:14 +00:00
Roardom
66b6eecd32 refactor: simplify system check in chat api 2025-09-03 03:32:14 +00:00
Roardom
de827aa939 refactor: remove redundant message falsey checks in chatbox api
The str_starts_with functions won't return true anyways if it's an empty string and it makes the code easier to read.
2025-09-03 03:32:14 +00:00
Roardom
9858fcde9f refactor: cast message string upfront in chat api
Also don't cast bot command which is not nullable in the database.
2025-09-03 03:32:14 +00:00
Roardom
5fcf20ce44 refactor: simplify chatbox echo return logic 2025-09-03 03:32:14 +00:00
Roardom
dd7fa0ebd3 refactor: remove unused save variable from chatbox 2025-09-03 03:32:13 +00:00
Roardom
e89690ac0d refactor: simplify adjusting cache in chat api
We don't necessarily need to refresh the cache, we only need to append to it.
2025-09-03 03:32:13 +00:00
Roardom
6b8614bc4d refactor: remove unecessary eager loads in chat api 2025-09-03 03:32:13 +00:00
Roardom
6ff6c1a9bf refactor: inline some single-use chat repository methods into chat api 2025-09-03 03:32:13 +00:00
Roardom
820946c2b6 refactor: chatbox user chat status
Only save the user's chat status in one place, and sync it with the server when it's updated.
2025-07-20 10:18:17 +00:00
Roardom
ab0851f73a update: upgrade to phpstan 2 2025-02-24 17:19:39 +00:00
Roardom
8e455ef448 fix: api chat controller json return types
Makes static analysis happy.
2025-02-11 06:06:17 +00:00
HDVinnie
af21147802 remove: hdvinnie/laravel-html-purifier in preparation for octane 2024-10-22 22:10:43 -04:00
Roardom
ad48d9bfb8 fix: check message existence before deletion 2024-09-29 05:32:20 +00:00
Roardom
5a9ae37921 update: use system user id constant in more places 2024-08-26 09:28:44 +00:00
Roardom
73da1a1eb3 add: types to chat repository
Just absolute minimal changes for now to prevent breakage as much as possible.
2024-08-10 03:15:36 +00:00
Roardom
2e91e1157f fix: some user group permissions
These permissions were never meant to be directly edited by staff. They should never have been added to the staff user edit page as it just caused confusion when the settings reset at the daily group change. I've now added these settings to the group directly and allow the settings on the user edit page to override the group settings. I refrained from fixing the can_download permission for now, because so many different things affect it and it will need at 3 separate permissions to control everything it does. Trying to fix it will take much more effort than what can be fixed today. Because of this, I removed the setting from the user edit page to reduce confusion from staff who don't realize it is controlled by the scheduler. Relevant issue: #1820.
2024-07-26 22:35:45 +00:00
Roardom
12903f64ac fix: strict type issues
Don't pass null into functions that don't accept null.
2024-05-23 17:40:16 +00:00
Roardom
2e57262e97 fix: strict types phpstan errors 2024-05-23 15:38:35 +00:00
Roardom
b86475a732 add: strict types to all files 2024-05-23 13:58:29 +00:00
Roardom
7a71cc7935 refactor: simplify echo/audible creation logic
Refactor the code to be more idiomatic code.
2024-05-01 08:26:09 +00:00
Roardom
d59ef3ba8d remove: unused action from chat controller 2024-05-01 05:48:59 +00:00
Roardom
837441d34e refactor: simplify chatroom get echoes/audibles exist condition 2024-05-01 05:48:59 +00:00
Roardom
d32ae88e86 remove: casino/trivia/bet bots
These bots don't currently do anything. Exception: the casino bot accepts donations through a nerdbot command but doesn't currently do anything else with it. If any trivia/casino/bet features need to be brought back, it would be easy enough to view the old code through the git history, but there's probably a bunch that can be improved with its interface as well.
2024-04-30 07:41:27 +00:00
HDVinnie
ed7f17720a update: ChatController 2024-02-23 20:54:26 -05:00
HDVinnie
3f03214e39 PHP Style Change (Laravel Pint CI) 2023-11-07 23:54:38 +00:00
HDVinnie
b3f0386149 cleanup: pt.1 2023-10-12 22:30:52 -04:00
Roardom
13f0b35625 fix: chatbox 2023-09-07 08:04:55 +00:00
Roardom
df1289d4cd update: retrieve user by request rather than authFactory 2023-08-30 09:37:42 +00:00
Roardom
9d4789ba91 refactor: require whitespace before statements 2023-07-07 00:27:13 +00:00
Roardom
738bc7f2d1 refactor: single line delete queries 2023-07-07 00:26:17 +00:00
HDVinnie
5232781f03 Merge pull request #2840 from Roardom/code-cleanup-3
(Refactor) Code Cleanup
2023-06-19 20:14:57 -04:00
Roardom
177c59d88d refactor: swap firstOrFail() for sole() to enforce a single result 2023-06-19 23:18:40 +00:00
Roardom
b5493c5642 refactor: swap where('id', '=', ) for find() 2023-06-19 23:18:40 +00:00
HDVinnie
d3f3510011 remove: unused foreach keys 2023-06-19 10:18:48 -04:00
HDVinnie
3650900c97 update: lint
- not_operator_with_space to false
2023-02-03 16:01:29 -05:00
HDVinnie
472c820f99 update: UNIT3D linting
- github action updated with new ruleset in pint.json
- codebase linted with new ruleset
- contributors can now run `./vendor/bin/pint`
- action workflow will auto correct any lint issues upon commit/opened pull request
2023-02-02 08:02:34 -05:00
StyleCI Bot
e292545306 Apply fixes from StyleCI 2022-05-31 22:06:07 +00:00
Shift
be2d37ed6e Use Illuminate\Support\Carbon 2022-05-31 22:05:34 +00:00
HDVinnie
594b7864d9 refactor: adopt new helpers in laravel 9 2022-03-06 17:20:05 -05:00
HDVinnie
bdd63aa816 update: controllers 2022-02-28 05:06:55 -05:00
HDVinnie
d7cb337f5f chore: streamline query builder orderBy calls with asc and desc arguments 2022-01-08 03:34:17 -05:00