Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
modals: Rename open_modal to open.
Aman Agrawal3498b0737926
diff --git a/web/src/billing/billing.ts b/web/src/billing/billing.tsindex f8039883805..29816282c21 100644--- a/web/src/billing/billing.ts+++ b/web/src/billing/billing.ts@@ -42,7 +42,7 @@ export function initialize(): void {if (new_licenses > current_licenses) {$("#new_license_count_holder").text(new_licenses);$("#current_license_count_holder").text(current_licenses);- portico_modals.open_modal("confirm-licenses-modal");+ portico_modals.open("confirm-licenses-modal");} else {create_update_license_request();}diff --git a/web/src/dialog_widget.ts b/web/src/dialog_widget.tsindex 75809ddb29c..179c9e8f658 100644--- a/web/src/dialog_widget.ts+++ b/web/src/dialog_widget.ts@@ -210,7 +210,7 @@ export function launch(conf: DialogWidgetConfig): void {conf.on_click(e);});- modals.open_modal("dialog_widget_modal", {+ modals.open("dialog_widget_modal", {autoremove: true,on_show() {if (conf.focus_submit_on_open) {diff --git a/web/src/modals.ts b/web/src/modals.tsindex 2ae2079f4ec..61349eb8b39 100644--- a/web/src/modals.ts+++ b/web/src/modals.ts@@ -52,19 +52,19 @@ export function active_modal(): string | undefined {// on_shown: Callback to run when the modal is shown.// on_hide: Callback to run when the modal is triggered to hide.// on_hidden: Callback to run when the modal is hidden.-export function open_modal(+export function open(modal_id: string,conf: ModalConfig & {recursive_call_count?: number} = {},): void {if (modal_id === undefined) {- blueslip.error("Undefined id was passed into open_modal");+ blueslip.error("Undefined id was passed into open");return;}// Don't accept hash-based selector to enforce modals to have unique ids and// since micromodal doesn't accept hash based selectors.if (modal_id.startsWith("#")) {- blueslip.error("hash-based selector passed in to open_modal", {modal_id});+ blueslip.error("hash-based selector passed in to open", {modal_id});return;}@@ -92,7 +92,7 @@ export function open_modal(close_active();setTimeout(() => {- open_modal(modal_id, conf);+ open(modal_id, conf);}, 10);return;}@@ -194,7 +194,7 @@ export function close(modal_id: string, conf: Pick<ModalConfig, "on_hidden"> = {const $micromodal = $(id_selector);// On-hidden hooks should typically be registered in- // overlays.open_modal. However, we offer this alternative+ // overlays.open. However, we offer this alternative// mechanism as a convenience for hooks only known when// closing the modal.$micromodal.find(".modal__container").on("animationend", (event) => {diff --git a/web/src/portico/email_log.js b/web/src/portico/email_log.jsindex 230ce66dbc7..556e05d5ad9 100644--- a/web/src/portico/email_log.js+++ b/web/src/portico/email_log.js@@ -50,6 +50,6 @@ $(() => {});$(".open-forward-email-modal").on("click", (e) => {e.preventDefault();- portico_modals.open_modal("forward_email_modal");+ portico_modals.open("forward_email_modal");});});diff --git a/web/src/portico/portico_modals.ts b/web/src/portico/portico_modals.tsindex b26a79d10aa..46dec13d850 100644--- a/web/src/portico/portico_modals.ts+++ b/web/src/portico/portico_modals.ts@@ -27,16 +27,16 @@ function close_active(): void {Micromodal.close(`${CSS.escape($micromodal.attr("id") ?? "")}`);}-export function open_modal(modal_id: string, recursive_call_count: number = 0): void {+export function open(modal_id: string, recursive_call_count: number = 0): void {if (modal_id === undefined) {- blueslip.error("Undefined id was passed into open_modal");+ blueslip.error("Undefined id was passed into open");return;}// Don't accept hash-based selector to enforce modals to have unique ids and// since micromodal doesn't accept hash based selectors.if (modal_id.startsWith("#")) {- blueslip.error("hash-based selector passed in to open_modal", {modal_id});+ blueslip.error("hash-based selector passed in to open", {modal_id});return;}@@ -64,7 +64,7 @@ export function open_modal(modal_id: string, recursive_call_count: number = 0):close_active();setTimeout(() => {- open_modal(modal_id, recursive_call_count);+ open(modal_id, recursive_call_count);}, 10);return;}diff --git a/web/src/portico/signup.ts b/web/src/portico/signup.tsindex 84ceae6f3eb..5c22e119b6e 100644--- a/web/src/portico/signup.ts+++ b/web/src/portico/signup.ts@@ -234,7 +234,7 @@ $(() => {});$("#new-user-email-address-visibility .change_email_address_visibility").on("click", () => {- portico_modals.open_modal("change-email-address-visibility-modal");+ portico_modals.open("change-email-address-visibility-modal");});$("#change-email-address-visibility-modal .dialog_submit_button").on("click", () => {diff --git a/web/src/read_receipts.js b/web/src/read_receipts.jsindex cadd879d13c..4de04f6cb00 100644--- a/web/src/read_receipts.js+++ b/web/src/read_receipts.js@@ -14,7 +14,7 @@ import * as ui_report from "./ui_report";export function show_user_list(message_id) {$("body").append(render_read_receipts_modal());- modals.open_modal("read_receipts_modal", {+ modals.open("read_receipts_modal", {autoremove: true,on_show() {const message = message_store.get(message_id);diff --git a/web/src/scheduled_messages_popover.js b/web/src/scheduled_messages_popover.jsindex d071c323556..7b57e68b504 100644--- a/web/src/scheduled_messages_popover.js+++ b/web/src/scheduled_messages_popover.js@@ -31,7 +31,7 @@ export function open_send_later_menu() {$("body").append(render_send_later_modal(filtered_send_opts));let interval;- modals.open_modal("send_later_modal", {+ modals.open("send_later_modal", {autoremove: true,on_show() {interval = setInterval(diff --git a/web/src/settings_account.js b/web/src/settings_account.jsindex 4f8e3bbf91b..63b1293e412 100644--- a/web/src/settings_account.js+++ b/web/src/settings_account.js@@ -362,7 +362,7 @@ export function set_up() {$("body").append(render_settings_api_key_modal());setup_api_key_modal();$("#api_key_status").hide();- modals.open_modal("api_key_modal", {+ modals.open("api_key_modal", {autoremove: true,on_show() {$("#get_api_key_password").trigger("focus");diff --git a/web/src/spectators.ts b/web/src/spectators.tsindex fb7e4449083..5d6ee166130 100644--- a/web/src/spectators.ts+++ b/web/src/spectators.ts@@ -40,7 +40,7 @@ export function login_to_access(empty_narrow?: boolean): void {}),);- modals.open_modal("login_to_access_modal", {+ modals.open("login_to_access_modal", {autoremove: true,on_hide() {browser_history.return_to_web_public_hash();diff --git a/web/src/user_profile.js b/web/src/user_profile.jsindex 0814774a1ec..096f33cc6a6 100644--- a/web/src/user_profile.js+++ b/web/src/user_profile.js@@ -370,7 +370,7 @@ export function show_user_profile(user, default_tab_key = "profile-tab") {}$("#user-profile-modal-holder").html(render_user_profile_modal(args));- modals.open_modal("user-profile-modal", {autoremove: true});+ modals.open("user-profile-modal", {autoremove: true});$(".tabcontent").hide();let default_tab = 0;diff --git a/web/tests/billing.test.js b/web/tests/billing.test.jsindex 49de1d3a45d..60e7ea497cf 100644--- a/web/tests/billing.test.js+++ b/web/tests/billing.test.js@@ -112,7 +112,7 @@ run_test("licensechange", ({override}) => {let confirm_license_modal_shown = false;override(helpers, "is_valid_input", () => true);- override(portico_modals, "open_modal", (modal_id) => {+ override(portico_modals, "open", (modal_id) => {assert.equal(modal_id, "confirm-licenses-modal");confirm_license_modal_shown = true;});