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

Admin users list usability, buttons to delete users #417

Merged
merged 2 commits into from
Mar 20, 2023

Conversation

HebaruSan
Copy link
Contributor

@HebaruSan HebaruSan commented Oct 28, 2021

Motivation

See #413; the admin user list has several annoying layout quirks and doesn't allow the main operation I want to do there: deleting spam users.

Changes

  • Each column of the users table is now a static width, the contents do not overflow onto neighboring cells, and the email and forum cells may be hovered to view the full text in a tooltip
  • The username cells now have Delete buttons that show a confirmation prompt when clicked, and if you confirm that you really want to delete, the user is deleted and the list is refreshed
    Note that since this is intended for nuisance users who aren't really users of the site, it does not do anything to clean up mods created by the user. It just deletes the user.
  • The created column no longer displays seconds or milliseconds
  • The public and admin columns are moved towards the left, after created, so the overall logic is basic info, contact info + socials, description
  • The Twitter, Reddit, and IRC fields are combined into one "Socials" column, twice as wide as the username column, that shows them all plus KerbalX and GitHub, to make horizontal room for other fields
  • The location column is removed completely because it is used nowhere and does nothing
  • The description column is now twice the width of the socials column (4x the width of username), renders markdown with bleach, and has a vertical scrollbar if the total height is greater than 6em

image

image

Depends on #316
Fixes #413.

@HebaruSan HebaruSan added Type: Improvement Area: Backend Related to the Python code that runs inside gunicorn Priority: Low Type: Feature Status: Ready Area: Frontend Related to HTML, JS, CSS, or other browser things labels Oct 28, 2021
@HebaruSan HebaruSan requested a review from DasSkelett October 28, 2021 20:12
@HebaruSan HebaruSan force-pushed the feature/admin-user-deletion branch 2 times, most recently from a1b4a4f to af29287 Compare October 29, 2021 13:37
@DasSkelett
Copy link
Member

Note that since this is intended for nuisance users who aren't really users of the site, it does not do anything to clean up mods created by the user. It just deletes the user.

Then we should make sure we do block the operation whenever there's any other object in the database that refers to this user (mod, mod list, mod pack, following).
We can't rely on the admin having checked all of them (may not even be possible) before pressing the button, and we would end up with objects that have a NULL user/user_id, which we probably don't handle correctly in a lot of places.

Setting all those user_id columns to non-nullable should make the database throw an error that we can catch, another option would be querying each of those tables for rows with a matching user id.

@HebaruSan
Copy link
Contributor Author

I was hoping that we could finish up #316 and rely on the db to do that stuff for us, separate from the frontend-y stuff in this PR. Is that possible?

@DasSkelett
Copy link
Member

Oh okay, I thought you wanted to merge this PR independently of/before #316, because it isn't mentioned anywhere in the description that it depends on it.
But yes, the db can handle most, except deleting files from disk, we'll have to do this ourselves in the backend code. If you want to stick to the /admin/delete_user/<int:user_id> route (instead of using the /api/ one from #316 as well), I should probably factor that code out into a separate function that we can call from this route as well.

@HebaruSan HebaruSan linked an issue Oct 30, 2021 that may be closed by this pull request
@HebaruSan HebaruSan force-pushed the feature/admin-user-deletion branch from 7164a26 to f1cf3a4 Compare November 2, 2021 23:44
@HebaruSan HebaruSan added the Scope: Medium Moderately complex changes requiring non-trivial time and effort to develop and review label Nov 13, 2021
@HebaruSan HebaruSan force-pushed the feature/admin-user-deletion branch from f1cf3a4 to 6af46f9 Compare March 20, 2023 04:39
@HebaruSan HebaruSan merged commit e64751b into KSP-SpaceDock:alpha Mar 20, 2023
@HebaruSan HebaruSan deleted the feature/admin-user-deletion branch March 20, 2023 04:46
@HebaruSan HebaruSan mentioned this pull request Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Backend Related to the Python code that runs inside gunicorn Area: Frontend Related to HTML, JS, CSS, or other browser things Priority: Low Scope: Medium Moderately complex changes requiring non-trivial time and effort to develop and review Status: Ready Type: Feature Type: Improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Admin users page improvements
2 participants