mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
dialog_widget: Remove code related to email field visibility.
The code for hiding and showing email field in the user deactiavtion modal was added in dialog_widget.js. This commit removes it and instead add the code to its relevant module (settings_user.js), since the email field is present only in one modal and not all modals.
This commit is contained in:
@@ -117,10 +117,6 @@ export function launch(conf) {
|
||||
}
|
||||
|
||||
const $submit_button = $dialog.find(".dialog_submit_button");
|
||||
const $send_email_checkbox = $dialog.find(".send_email");
|
||||
const $email_field = $dialog.find(".email_field");
|
||||
|
||||
$email_field.hide();
|
||||
|
||||
// This is used to link the submit button with the form, if present, in the modal.
|
||||
// This makes it so that submitting this form by pressing Enter on an input element
|
||||
@@ -143,14 +139,6 @@ export function launch(conf) {
|
||||
conf.on_click(e);
|
||||
});
|
||||
|
||||
$send_email_checkbox.on("change", () => {
|
||||
if ($send_email_checkbox.is(":checked")) {
|
||||
$email_field.show();
|
||||
} else {
|
||||
$email_field.hide();
|
||||
}
|
||||
});
|
||||
|
||||
overlays.open_modal("dialog_widget_modal", {
|
||||
autoremove: true,
|
||||
on_show() {
|
||||
|
||||
@@ -483,6 +483,20 @@ export function confirm_deactivation(user_id, handle_confirm, loading_spinner) {
|
||||
};
|
||||
const html_body = render_settings_deactivation_user_modal(opts);
|
||||
|
||||
function set_email_field_visibility() {
|
||||
const $send_email_checkbox = $("#dialog_widget_modal").find(".send_email");
|
||||
const $email_field = $("#dialog_widget_modal").find(".email_field");
|
||||
|
||||
$email_field.hide();
|
||||
$send_email_checkbox.on("change", () => {
|
||||
if ($send_email_checkbox.is(":checked")) {
|
||||
$email_field.show();
|
||||
} else {
|
||||
$email_field.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
dialog_widget.launch({
|
||||
html_heading: $t_html(
|
||||
{defaultMessage: "Deactivate {name}?"},
|
||||
@@ -493,6 +507,7 @@ export function confirm_deactivation(user_id, handle_confirm, loading_spinner) {
|
||||
html_submit_button: $t_html({defaultMessage: "Deactivate"}),
|
||||
id: "deactivate-user-modal",
|
||||
on_click: handle_confirm,
|
||||
post_render: set_email_field_visibility,
|
||||
loading_spinner,
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user