-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Use form for admin purge user #21070
Conversation
Signed-off-by: jolheiser <john.olheiser@gmail.com>
@@ -151,7 +151,7 @@ | |||
|
|||
<div class="field"> | |||
<button class="ui green button">{{.locale.Tr "admin.users.update_profile"}}</button> | |||
<div class="ui red button show-modal" data-modal="#delete-user-modal" data-url="{{$.Link}}/delete" data-id="{{.User.ID}}">{{.locale.Tr "admin.users.delete_account"}}</div> | |||
<div class="ui red button show-modal" data-modal="#delete-user-modal">{{.locale.Tr "admin.users.delete_account"}}</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two things in my mind:
- Here the
data-id="{{.User.ID}}"
is removed, is it correct? IIRC the JS code will fill somedata-xxx
attributes into the form fields. - In Add option to purge users #18064, the button's CSS class name was changed from
delete-button
toshow-modal
, I am not sure what are the differences and concerns. Now the dialog layout is changed again, could @zeripath take a look at them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will re-test, but you may be right about 1.
About 2, delete-button
is how we link it to the generic JS version afaik.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
show-modal
is also a generic JS version .... indeed, the code for show-modal
and delete-button
are quite similar, that's why I am confused about they two.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I've ran some tests locally again.
The reason data-id
is no longer needed is because this page has the user ID in the URL, which is what is used when deleting.
At the very least, I was able to:
- Attempt to delete a user and correctly get back "You can't, they still have repos", and then
- Select the purge option, which deleted them successfully.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, it seems to happen to work 😀
If @zeripath doesn't have more questions, I will vote L-G-T-M later.
Signed-off-by: jolheiser <john.olheiser@gmail.com>
make lgtm work |
* upstream/main: Update docs comparison.zh-cn.md (go-gitea#21035) Use form for admin purge user (go-gitea#21070) Make labels clickable in the comments section. (go-gitea#21137) Remove fomantic image module (go-gitea#21145) [skip ci] Updated translations via Crowdin Show .editorconfig errors in frontend (go-gitea#21088) Update JS dependencies and lint (go-gitea#21144) Fix PlantUML example in document (go-gitea#21142) chore(security): Support Go Vulnerability Management (go-gitea#21139) [skip ci] Updated licenses and gitignores [skip ci] Updated translations via Crowdin Improve commit status icons (go-gitea#21124) Center-aligning content of WebAuthN page (go-gitea#21127) Allow poster to choose reviewers (go-gitea#21084) Generate go-licenses during tidy again (go-gitea#21108)
Fixes #20998
The basic modal actions were set up for basic confirmation-style modals, however this modal also has a special form input, which instead requires a form in the modal itself.
The basic modal actions are indirectly controlled by JS and are simple
<div>
elements, whereas this requires a<button>
to submit.This appears to be similar to how we do it in (for example) the repo deletion modal.