Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

admin2: refactor ban functionality (resolves #151) #437

Merged
merged 20 commits into from
Jan 18, 2024

Conversation

jlillis
Copy link
Contributor

@jlillis jlillis commented Jul 4, 2023

To satisfy #151

This PR redesigns the add ban widget. It can be accessed by selecting a player and clicking "Ban" in the main tab, or clicking "Add ban" from the player tab. When accessed from the main tab it will autofill the target player's IP and serial. You can chose whether to add either the IP or serial (or both) to the ban.

image

Some remaining tasks:

  • Add ability to define custom duration
  • Mask player identifiers when banning from players tab with "streamer mode" on
  • Agree upon and set new default ban durations
  • Consider refactoring server code to resolve misc. errors
  • Add server log and chatbox outputs for "offline" bans
  • Fix server errors when using banip and banserial commands:
[01:08:26] ERROR: [mtasa-resources]\[admin]\admin2\admin_coroutines.lua:38: ...sa-resources]\[admin]\admin2\server\admin_server.lua:410: attempt to call global 'BanIP' (a nil value) [string "?"]
[01:08:26] INFO: ...sa-resources]\[admin]\admin2\server\admin_server.lua:410: attempt to call global 'BanIP' (a nil value)
[01:08:30] ERROR: [mtasa-resources]\[admin]\admin2\admin_coroutines.lua:38: ...sa-resources]\[admin]\admin2\server\admin_server.lua:415: attempt to call global 'isValidSerial' (a nil value) [string "?"]
[01:08:30] INFO: ...sa-resources]\[admin]\admin2\server\admin_server.lua:415: attempt to call global 'isValidSerial' (a nil value)
[01:08:33] ADMIN: STEELMEAT has banned $player ()
[01:08:33] WARNING: [mtasa-resources]\[admin]\admin2\server\admin_functions.lua:32: Bad argument @ 'banPlayer' [Expected player at argument 1, got nil]
  • Fix unban button and command
  • Re-implement "ban details" widget
  • Remove references to ban (community) username

While there are some remaining tasks I consider this ready for testing.

I haven't been able to test this with multiple players so I don't know if everything is working properly, especially the sync of added/deleted bans in the bans tab.

@Dark-Dragon
Copy link
Contributor

Here are a couple of things I ran into while testing (all except the very last are manual bans from the ban tab, not the players tab):

  • I keep being told my serial is invalid when trying to ban my own serial
  • After receiving an error for not providing an IP/Serial or an invalid one the the confirmation message box still popped up
  • Sometimes I had to reselect a ban duration when submitting multiple bans in a row (can't quite tell how to reproduce just yet)
  • Confirmation message box pops up despite not checking IP or Serial
  • Maybe the confirmation message box type should be question rather than warning?
  • After confirming a ban there's a lack of feedback. I'm not sure if the gridlist is supposed to update immediately, but if it is, then it didn't appear to work during my testing. I believe normally there should be a chat output too, shouldn't there?
  • The 1 second ban I presume is just used for testing
  • Maybe the confirmation could say the ban duration again?
  • Generally the widgets in admin2 appear to leave less empty padding space around the sides than this one, might be worth considering to adjust for consistency?
  • Hide sensitive player data should probably mask the IP/Serial if checked when banning through players tab.

@jlillis
Copy link
Contributor Author

jlillis commented Jul 8, 2023

* I keep being told my serial is invalid when trying to ban my own serial

Fixed.

* After receiving an error for not providing an IP/Serial or an invalid one the the confirmation message box still popped up

Fixed.

* Sometimes I had to reselect a ban duration when submitting multiple bans in a row (can't quite tell how to reproduce just yet)

Added a line to reset the ban duration to default when the widget is shown, which should fix this.

* Confirmation message box pops up despite not checking IP or Serial

Fixed.

* Maybe the confirmation message box type should be question rather than warning?

I think it's more of a question rather than a warning but if anyone else feels otherwise it's easy to change.

* After confirming a ban there's a lack of feedback. I'm not sure if the gridlist is supposed to update immediately, but if it is, then it didn't appear to work during my testing. I believe normally there should be a chat output too, shouldn't there?

Partially fixed. I had to dig around the serverside code some more to figure out how the ban list sync was working. New bans should appear in the ban list as soon as they are added. It's not outputting to server log/chatbox currently, added that to my todo list.

* The 1 second ban I presume is just used for testing

Correct.

* Maybe the confirmation could say the ban duration again?

There isn't a ton of room in those messagebox widgets, but I'll play with them and see what works.

* Generally the widgets in admin2 appear to leave less empty padding space around the sides than this one, might be worth considering to adjust for consistency?

Just reduced the horizontal padding by 50%.

* Hide sensitive player data should probably mask the IP/Serial if checked when banning through players tab.

Added to todo list.

@Dutchman101 Dutchman101 mentioned this pull request Aug 25, 2023
@jlillis
Copy link
Contributor Author

jlillis commented Nov 1, 2023

I've finally got around to crossing off the rest of my todo list and am calling this done and ready for more testing. I "fixed" the unimplemented ban/unban commands by just removing them - if there are enough complaints I'll go ahead and get them added back in.

@jlillis jlillis merged commit d8c35b0 into multitheftauto:master Jan 18, 2024
1 check passed
@jlillis jlillis deleted the admin2-bans branch September 1, 2024 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants