mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 09:27:43 +00:00
modals: Rename close_modal to close.
This commit is contained in:
@@ -49,7 +49,7 @@ export function initialize(): void {
|
||||
});
|
||||
|
||||
$("#confirm-licenses-modal .dialog_submit_button").on("click", () => {
|
||||
portico_modals.close_modal("confirm-licenses-modal");
|
||||
portico_modals.close("confirm-licenses-modal");
|
||||
create_update_license_request();
|
||||
});
|
||||
|
||||
|
||||
@@ -98,8 +98,8 @@ export function show_dialog_spinner(): void {
|
||||
}
|
||||
|
||||
// Supports a callback to be called once the modal finishes closing.
|
||||
export function close_modal(on_hidden_callback?: () => void): void {
|
||||
modals.close_modal("dialog_widget_modal", {on_hidden: on_hidden_callback});
|
||||
export function close(on_hidden_callback?: () => void): void {
|
||||
modals.close("dialog_widget_modal", {on_hidden: on_hidden_callback});
|
||||
}
|
||||
|
||||
export function launch(conf: DialogWidgetConfig): void {
|
||||
@@ -204,7 +204,7 @@ export function launch(conf: DialogWidgetConfig): void {
|
||||
if (conf.loading_spinner) {
|
||||
show_dialog_spinner();
|
||||
} else if (conf.close_on_submit) {
|
||||
close_modal();
|
||||
close();
|
||||
}
|
||||
$("#dialog_error").hide();
|
||||
conf.on_click(e);
|
||||
@@ -241,7 +241,7 @@ export function submit_api_request(
|
||||
url,
|
||||
data,
|
||||
success(response_data, textStatus, jqXHR) {
|
||||
close_modal();
|
||||
close();
|
||||
if (success_continuation !== undefined) {
|
||||
success_continuation(response_data, textStatus, jqXHR);
|
||||
}
|
||||
|
||||
@@ -1123,7 +1123,7 @@ export function delete_message(msg_id) {
|
||||
(id) => id !== msg_id,
|
||||
);
|
||||
dialog_widget.hide_dialog_spinner();
|
||||
dialog_widget.close_modal();
|
||||
dialog_widget.close();
|
||||
},
|
||||
error(xhr) {
|
||||
currently_deleting_messages = currently_deleting_messages.filter(
|
||||
@@ -1258,7 +1258,7 @@ export function move_topic_containing_message_to_stream(
|
||||
// The main UI will update via receiving the event
|
||||
// from server_events.js.
|
||||
reset_modal_ui();
|
||||
dialog_widget.close_modal();
|
||||
dialog_widget.close();
|
||||
},
|
||||
error(xhr) {
|
||||
reset_modal_ui();
|
||||
@@ -1277,7 +1277,7 @@ export function move_topic_containing_message_to_stream(
|
||||
|
||||
const partial_move_confirmation_modal_callback = () =>
|
||||
handle_message_move_failure_due_to_time_limit(xhr, handle_confirm);
|
||||
dialog_widget.close_modal(partial_move_confirmation_modal_callback);
|
||||
dialog_widget.close(partial_move_confirmation_modal_callback);
|
||||
return;
|
||||
}
|
||||
ui_report.error($t_html({defaultMessage: "Failed"}), xhr, $("#dialog_error"));
|
||||
|
||||
@@ -143,7 +143,7 @@ export function open_modal(
|
||||
if (document.getSelection()?.type === "Range") {
|
||||
return;
|
||||
}
|
||||
close_modal(modal_id);
|
||||
close(modal_id);
|
||||
});
|
||||
|
||||
function on_show_callback(): void {
|
||||
@@ -172,9 +172,9 @@ export function open_modal(
|
||||
|
||||
// `conf` is an object with the following optional properties:
|
||||
// * on_hidden: Callback to run when the modal finishes hiding.
|
||||
export function close_modal(modal_id: string, conf: Pick<ModalConfig, "on_hidden"> = {}): void {
|
||||
export function close(modal_id: string, conf: Pick<ModalConfig, "on_hidden"> = {}): void {
|
||||
if (modal_id === undefined) {
|
||||
blueslip.error("Undefined id was passed into close_modal");
|
||||
blueslip.error("Undefined id was passed into close");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ export function open_modal(modal_id: string, recursive_call_count: number = 0):
|
||||
if (document.getSelection()?.type === "Range") {
|
||||
return;
|
||||
}
|
||||
close_modal(modal_id);
|
||||
close(modal_id);
|
||||
});
|
||||
|
||||
Micromodal.show(modal_id, {
|
||||
@@ -112,9 +112,9 @@ export function open_modal(modal_id: string, recursive_call_count: number = 0):
|
||||
});
|
||||
}
|
||||
|
||||
export function close_modal(modal_id: string): void {
|
||||
export function close(modal_id: string): void {
|
||||
if (modal_id === undefined) {
|
||||
blueslip.error("Undefined id was passed into close_modal");
|
||||
blueslip.error("Undefined id was passed into close");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -243,7 +243,7 @@ $(() => {
|
||||
10,
|
||||
);
|
||||
$("#email_address_visibility").val(selected_val);
|
||||
portico_modals.close_modal("change-email-address-visibility-modal");
|
||||
portico_modals.close("change-email-address-visibility-modal");
|
||||
|
||||
let selected_option_text;
|
||||
|
||||
|
||||
@@ -492,7 +492,7 @@ export function set_up() {
|
||||
const opts = {
|
||||
success_continuation() {
|
||||
channel.set_password_change_in_progress(false);
|
||||
dialog_widget.close_modal();
|
||||
dialog_widget.close();
|
||||
},
|
||||
error_continuation() {
|
||||
dialog_widget.hide_dialog_spinner();
|
||||
@@ -541,7 +541,7 @@ export function set_up() {
|
||||
4000,
|
||||
);
|
||||
}
|
||||
dialog_widget.close_modal();
|
||||
dialog_widget.close();
|
||||
},
|
||||
error_continuation() {
|
||||
dialog_widget.hide_dialog_spinner();
|
||||
@@ -600,7 +600,7 @@ export function set_up() {
|
||||
4000,
|
||||
);
|
||||
}
|
||||
dialog_widget.close_modal();
|
||||
dialog_widget.close();
|
||||
},
|
||||
error_continuation() {
|
||||
dialog_widget.hide_dialog_spinner();
|
||||
@@ -706,7 +706,7 @@ export function set_up() {
|
||||
url: "/json/users/me",
|
||||
success() {
|
||||
dialog_widget.hide_dialog_spinner();
|
||||
dialog_widget.close_modal();
|
||||
dialog_widget.close();
|
||||
window.location.href = "/login/";
|
||||
},
|
||||
error(xhr) {
|
||||
@@ -734,7 +734,7 @@ export function set_up() {
|
||||
}
|
||||
}
|
||||
dialog_widget.hide_dialog_spinner();
|
||||
dialog_widget.close_modal();
|
||||
dialog_widget.close();
|
||||
$("#account-settings-status")
|
||||
.addClass("alert-error")
|
||||
.html(rendered_error_msg)
|
||||
|
||||
@@ -239,7 +239,7 @@ export function add_a_new_bot() {
|
||||
contentType: false,
|
||||
success() {
|
||||
create_avatar_widget.clear();
|
||||
dialog_widget.close_modal();
|
||||
dialog_widget.close();
|
||||
},
|
||||
error(xhr) {
|
||||
ui_report.error($t_html({defaultMessage: "Failed"}), xhr, $("#dialog_error"));
|
||||
@@ -367,7 +367,7 @@ export function set_up() {
|
||||
channel.post({
|
||||
url: "/json/users/" + encodeURIComponent(user_id) + "/reactivate",
|
||||
success() {
|
||||
dialog_widget.close_modal();
|
||||
dialog_widget.close();
|
||||
},
|
||||
error(xhr) {
|
||||
ui_report.error($t_html({defaultMessage: "Failed"}), xhr, $("#dialog_error"));
|
||||
|
||||
@@ -51,7 +51,7 @@ function spectator_default_language_modal_post_render() {
|
||||
.on("click", (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
dialog_widget.close_modal();
|
||||
dialog_widget.close();
|
||||
|
||||
const $link = $(e.target).closest("a[data-code]");
|
||||
Cookies.set(page_params.language_cookie_name, $link.attr("data-code"));
|
||||
@@ -65,7 +65,7 @@ function org_notification_default_language_modal_post_render() {
|
||||
.on("click", (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
dialog_widget.close_modal();
|
||||
dialog_widget.close();
|
||||
|
||||
const $link = $(e.target).closest("a[data-code]");
|
||||
const setting_value = $link.attr("data-code");
|
||||
@@ -85,7 +85,7 @@ function user_default_language_modal_post_render() {
|
||||
.on("click", (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
dialog_widget.close_modal();
|
||||
dialog_widget.close();
|
||||
|
||||
const $link = $(e.target).closest("a[data-code]");
|
||||
const setting_value = $link.attr("data-code");
|
||||
|
||||
@@ -227,7 +227,7 @@ function show_modal(): void {
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success() {
|
||||
dialog_widget.close_modal();
|
||||
dialog_widget.close();
|
||||
},
|
||||
error(xhr) {
|
||||
$("#dialog_error").hide();
|
||||
@@ -281,7 +281,7 @@ function show_modal(): void {
|
||||
return;
|
||||
}
|
||||
|
||||
dialog_widget.close_modal(() => {
|
||||
dialog_widget.close(() => {
|
||||
const html_body = emoji_settings_warning_modal({
|
||||
emoji_name: emoji.name,
|
||||
});
|
||||
|
||||
@@ -53,7 +53,7 @@ function open_linkifier_edit_form(linkifier_id) {
|
||||
const opts = {
|
||||
success_continuation() {
|
||||
$change_linkifier_button.prop("disabled", false);
|
||||
dialog_widget.close_modal();
|
||||
dialog_widget.close();
|
||||
},
|
||||
error_continuation(xhr) {
|
||||
$change_linkifier_button.prop("disabled", false);
|
||||
|
||||
@@ -533,7 +533,7 @@ function open_edit_form_modal(e) {
|
||||
if (Object.keys(deleted_values).length !== 0) {
|
||||
const edit_select_field_modal_callback = () =>
|
||||
show_modal_for_deleting_options(field, deleted_values, update_profile_field);
|
||||
dialog_widget.close_modal(edit_select_field_modal_callback);
|
||||
dialog_widget.close(edit_select_field_modal_callback);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ function show_add_default_streams_modal() {
|
||||
successful_requests = successful_requests + 1;
|
||||
|
||||
if (successful_requests === chosen_streams.size) {
|
||||
dialog_widget.close_modal();
|
||||
dialog_widget.close();
|
||||
}
|
||||
},
|
||||
error(xhr) {
|
||||
|
||||
@@ -318,7 +318,7 @@ export function add_user_group() {
|
||||
success() {
|
||||
$user_group_status.hide();
|
||||
ui_report.success($t_html({defaultMessage: "User group added!"}), $user_group_status);
|
||||
dialog_widget.close_modal();
|
||||
dialog_widget.close();
|
||||
},
|
||||
error(xhr) {
|
||||
$user_group_status.hide();
|
||||
|
||||
@@ -139,7 +139,7 @@ export function mark_all_as_read(args = {}) {
|
||||
blueslip.log("Cleared old_unreads_missing after bankruptcy.");
|
||||
}
|
||||
}
|
||||
dialog_widget.close_modal();
|
||||
dialog_widget.close();
|
||||
},
|
||||
error(xhr) {
|
||||
if (xhr.readyState === 0) {
|
||||
|
||||
@@ -703,7 +703,7 @@ function register_click_handlers() {
|
||||
channel.post({
|
||||
url,
|
||||
success() {
|
||||
dialog_widget.close_modal();
|
||||
dialog_widget.close();
|
||||
},
|
||||
error(xhr) {
|
||||
ui_report.error($t_html({defaultMessage: "Failed"}), xhr, $("#dialog_error"));
|
||||
|
||||
@@ -59,7 +59,7 @@ export function submit_new_status() {
|
||||
old_emoji_info.reaction_type === selected_emoji_info.reaction_type &&
|
||||
old_emoji_info.emoji_code === selected_emoji_info.emoji_code
|
||||
) {
|
||||
dialog_widget.close_modal();
|
||||
dialog_widget.close();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ export function submit_new_status() {
|
||||
emoji_code: selected_emoji_info.emoji_code || "",
|
||||
reaction_type: selected_emoji_info.reaction_type || "",
|
||||
success() {
|
||||
dialog_widget.close_modal();
|
||||
dialog_widget.close();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ run_test("licensechange", ({override}) => {
|
||||
assert.ok(!create_ajax_request_called);
|
||||
assert.ok(confirm_license_modal_shown);
|
||||
|
||||
override(portico_modals, "close_modal", (modal_id) => {
|
||||
override(portico_modals, "close", (modal_id) => {
|
||||
assert.equal(modal_id, "confirm-licenses-modal");
|
||||
confirm_license_modal_shown = false;
|
||||
});
|
||||
|
||||
@@ -536,7 +536,7 @@ test_ui("on_events", ({mock_template, override, override_rewire}) => {
|
||||
assert.equal(text, "translated HTML: User group added!");
|
||||
assert.equal(ele, $("#dialog_error"));
|
||||
};
|
||||
dialog_widget.close_modal = () => {};
|
||||
dialog_widget.close = () => {};
|
||||
|
||||
opts.success();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user