mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
users: Fix unable to delete user
Fixes an issue where confirming user deletion is not submitting the user edit form. Also fixes an issue where the user edit submit button is disabled after user deletion confirmation is cancelled. Fixes #2513. Tests performed: - Deleting a user works. - All the users module tests pass. - After cancelling the user deletion confirmation dialog, the user edit submit button is clickable. - On the app pages, submit buttons are disabled when app enabling or disabling is in progress. Signed-off-by: Veiko Aasa <veiko17@disroot.org> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
0d9c81da03
commit
92aa66114c
@ -33,7 +33,11 @@ document.addEventListener('DOMContentLoaded', (event) => {
|
||||
});
|
||||
|
||||
var deleteConfirmed = false;
|
||||
const modal = new bootstrap.Modal('#user-delete-confirm-dialog');
|
||||
const modalEl = document.querySelector('#user-delete-confirm-dialog');
|
||||
const modal = new bootstrap.Modal(modalEl);
|
||||
|
||||
// Make the user edit submit button clickable again when closing modal
|
||||
modalEl.addEventListener('hide.bs.modal', clearButtonDisabling);
|
||||
|
||||
// Show the confirmation dialog if the delete checkbox is selected
|
||||
function onUserUpdateSubmit(event) {
|
||||
|
||||
@ -113,11 +113,10 @@ document.addEventListener('DOMContentLoaded', function(event) {
|
||||
}
|
||||
});
|
||||
|
||||
// When using back/forward browser's bfcache is used and pages won't receive
|
||||
// 'load' events. Instead a 'pageshow' event is available. When a user does
|
||||
// back/forward we want them to be able to submit the forms again. So clear all
|
||||
// the button disabling.
|
||||
window.addEventListener('pageshow', function(event) {
|
||||
/*
|
||||
* Clear button disabling on the page.
|
||||
*/
|
||||
function clearButtonDisabling(event) {
|
||||
for (const button of getSubmitButtons()) {
|
||||
button.classList.remove('running-status-button');
|
||||
if (button.classList.contains('temporarily-disabled')) {
|
||||
@ -131,7 +130,13 @@ window.addEventListener('pageshow', function(event) {
|
||||
for (const element of beforeElements) {
|
||||
element.remove();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// When using back/forward browser's bfcache is used and pages won't receive
|
||||
// 'load' events. Instead a 'pageshow' event is available. When a user does
|
||||
// back/forward we want them to be able to submit the forms again. So clear all
|
||||
// the button disabling.
|
||||
window.addEventListener('pageshow', clearButtonDisabling);
|
||||
|
||||
/*
|
||||
* Select all option for multiple checkboxes.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user