mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
settings_ui: Use overlays.open_modal in user deactivation settings.
Hiding and instantly showing a modal causes a race condition in Bootstrap since `hide` and `show` calls are asynchronous. See https://getbootstrap.com/docs/4.0/components/modal/#methods Instead, use `overlays.open_modal` which prevents background mouse events when a modal is present. This prevents a user from maybe accidentally clicking on another deactivate button while a modal is present. This also prevents a black screen caused due to this race condition. And since a user can't click on the button while the modal is present, it doesn't make sense to hide it before showing it. So, remove the `hide` call. Fixes #17297
This commit is contained in:
@@ -538,11 +538,10 @@ function confirm_deactivation(row, user_id, status_field) {
|
|||||||
settings_ui.do_settings_change(channel.del, url, {}, status_field, opts);
|
settings_ui.do_settings_change(channel.del, url, {}, status_field, opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
modal_elem.modal("hide");
|
|
||||||
modal_elem.off("click", ".do_deactivate_button");
|
modal_elem.off("click", ".do_deactivate_button");
|
||||||
set_fields();
|
set_fields();
|
||||||
modal_elem.on("click", ".do_deactivate_button", handle_confirm);
|
modal_elem.on("click", ".do_deactivate_button", handle_confirm);
|
||||||
modal_elem.modal("show");
|
overlays.open_modal("#deactivation_user_modal");
|
||||||
}
|
}
|
||||||
|
|
||||||
function handle_deactivation(tbody, status_field) {
|
function handle_deactivation(tbody, status_field) {
|
||||||
|
|||||||
Reference in New Issue
Block a user