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

Fix admin user deletion on profile #495

Merged

Conversation

HebaruSan
Copy link
Contributor

Problem

As of #316, the user profile page now has a "Delete user" button for admins, which opens a confirmation dialog:

image

image

However, no matter what you do, the "Delete account" button in the confirmation popup doesn't work. The call to the server never happens.

Cause

Since the profile editing page has a rich text box, and the profile.coffee/profile.js client file is shared between the profile editing page and the profile viewing page, the rich text editor tries to initialize on page load and throws an exception because there are no textareas, just like in 1e130af.

This exception then stops the client code initialization, so the hooks that make the popup work are not set up.

Changes

  • Now we only try to load the rich text editor if we have a textarea for it to use. This will allow the initialization to complete and the "Delete account" button will work.
  • The confirmation popup now dynamically enables and disables the "Delete account" button as the user types, to provide a cue as to when the input is valid, just like on the admin user list
  • The /api/user/<username>/delete now returns 200 on success instead of 400

@HebaruSan HebaruSan added Type: Bug Area: Backend Related to the Python code that runs inside gunicorn Priority: Low Status: Ready Area: Frontend Related to HTML, JS, CSS, or other browser things Scope: Medium Moderately complex changes requiring non-trivial time and effort to develop and review labels Apr 9, 2023
@HebaruSan HebaruSan merged commit 8c51a7d into KSP-SpaceDock:alpha Apr 9, 2023
@HebaruSan HebaruSan deleted the fix/admin-user-profile-deletion branch April 9, 2023 19:25
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: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant