momentum-mod / website

Momentum Mod's main website.
https://momentum-mod.org
MIT License
58 stars 59 forks source link

Admins can not completly remove bans #845

Closed GordiNoki closed 1 year ago

GordiNoki commented 1 year ago

Describe the bug Bans are not updated when you try to delete them all To Reproduce Steps to reproduce the behavior:

  1. Go to 'edit profile' page of any user that has bans
  2. Remove every checkbox
  3. Click 'save changes' button
  4. Update page
  5. See that bans haven't changed

Expected behavior "bans" field of user to turn 0, all checkboxes to be disabled

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Website Information

Additional context The reason may be an error when checking the existence of the "bans" field in update data, cause it's value is 0

tsa96 commented 1 year ago

Yup, noticed this yesterday! We're checking for truthiness rather than strict undefined in one place that results in no action if roles is 0.

Gocnak commented 1 year ago

Was this fixed in a recent PR?

GordiNoki commented 1 year ago

Yes, fixed in af7b4cc

tsa96 commented 1 year ago

Ah yeah, I thought this was a frontend change but no, just a backend bug

GordiNoki commented 1 year ago

@tsa96 Have you fixed the same bug with roles tho?

tsa96 commented 1 year ago

Don't see where it would occur in the code for roles. Probably should've added E2E tests for both bans and roles, but busy with other stuff and not sure it's worth a dedicated PR. If you want to, feel free!

GordiNoki commented 1 year ago

Oh, it was fixed long ago. Whatever