modals: Rename close_modal_active to close_active.

This commit is contained in:
Aman Agrawal
2023-10-10 12:31:02 +00:00
committed by Tim Abbott
parent d54a917104
commit 0c7184aaa0
8 changed files with 15 additions and 15 deletions

View File

@@ -22,7 +22,7 @@ import * as ui_report from "./ui_report";
* to avoid interference from other elements. * to avoid interference from other elements.
* *
* 3) For settings, we have a click handler in settings.js * 3) For settings, we have a click handler in settings.js
* that will close the dialog via modals.close_active_modal. * that will close the dialog via modals.close_active.
* *
* 4) We assume that since this is a modal, you will * 4) We assume that since this is a modal, you will
* only ever have one confirm dialog active at any * only ever have one confirm dialog active at any

View File

@@ -281,7 +281,7 @@ export function process_escape_key(e) {
} }
if (modals.is_open()) { if (modals.is_open()) {
modals.close_active_modal(); modals.close_active();
return true; return true;
} }

View File

@@ -90,7 +90,7 @@ export function open_modal(
return; return;
} }
close_active_modal(); close_active();
setTimeout(() => { setTimeout(() => {
open_modal(modal_id, conf); open_modal(modal_id, conf);
}, 10); }, 10);
@@ -179,7 +179,7 @@ export function close_modal(modal_id: string, conf: Pick<ModalConfig, "on_hidden
} }
if (!is_open()) { if (!is_open()) {
blueslip.warn("close_active_modal() called without checking is_open()"); blueslip.warn("close_active() called without checking is_open()");
return; return;
} }
@@ -228,9 +228,9 @@ export function close_modal_if_open(modal_id: string): void {
} }
} }
export function close_active_modal(): void { export function close_active(): void {
if (!is_open()) { if (!is_open()) {
blueslip.warn("close_active_modal() called without checking is_open()"); blueslip.warn("close_active() called without checking is_open()");
return; return;
} }

View File

@@ -17,9 +17,9 @@ function active_modal(): string | undefined {
return `#${CSS.escape($micromodal.attr("id")!)}`; return `#${CSS.escape($micromodal.attr("id")!)}`;
} }
function close_active_modal(): void { function close_active(): void {
if (!is_open()) { if (!is_open()) {
blueslip.warn("close_active_modal() called without checking is_open()"); blueslip.warn("close_active() called without checking is_open()");
return; return;
} }
@@ -62,7 +62,7 @@ export function open_modal(modal_id: string, recursive_call_count: number = 0):
return; return;
} }
close_active_modal(); close_active();
setTimeout(() => { setTimeout(() => {
open_modal(modal_id, recursive_call_count); open_modal(modal_id, recursive_call_count);
}, 10); }, 10);
@@ -119,7 +119,7 @@ export function close_modal(modal_id: string): void {
} }
if (!is_open()) { if (!is_open()) {
blueslip.warn("close_active_modal() called without checking is_open()"); blueslip.warn("close_active() called without checking is_open()");
return; return;
} }

View File

@@ -39,7 +39,7 @@ $(() => {
// event to the parent container otherwise the modal will not open. This // event to the parent container otherwise the modal will not open. This
// is so because this event handler will get fired on any click in settings // is so because this event handler will get fired on any click in settings
// overlay and subsequently close any open modal. // overlay and subsequently close any open modal.
modals.close_active_modal(); modals.close_active();
}); });
}); });

View File

@@ -697,7 +697,7 @@ export function set_up() {
); );
$("#user_deactivate_account_button").on("click", (e) => { $("#user_deactivate_account_button").on("click", (e) => {
// This click event must not get propagated to parent container otherwise the modal // This click event must not get propagated to parent container otherwise the modal
// will not show up because of a call to `close_active_modal` in `settings.js`. // will not show up because of a call to `close_active` in `settings.js`.
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();

View File

@@ -236,7 +236,7 @@ export function on_load_success(
} }
$(".admin_invites_table").on("click", ".revoke", (e) => { $(".admin_invites_table").on("click", ".revoke", (e) => {
// This click event must not get propagated to parent container otherwise the modal // This click event must not get propagated to parent container otherwise the modal
// will not show up because of a call to `close_active_modal` in `settings.js`. // will not show up because of a call to `close_active` in `settings.js`.
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
const $row = $(e.target).closest(".invite_row"); const $row = $(e.target).closest(".invite_row");
@@ -267,7 +267,7 @@ export function on_load_success(
$(".admin_invites_table").on("click", ".resend", (e) => { $(".admin_invites_table").on("click", ".resend", (e) => {
// This click event must not get propagated to parent container otherwise the modal // This click event must not get propagated to parent container otherwise the modal
// will not show up because of a call to `close_active_modal` in `settings.js`. // will not show up because of a call to `close_active` in `settings.js`.
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();

View File

@@ -357,7 +357,7 @@ function start_data_load() {
function handle_deactivation($tbody) { function handle_deactivation($tbody) {
$tbody.on("click", ".deactivate", (e) => { $tbody.on("click", ".deactivate", (e) => {
// This click event must not get propagated to parent container otherwise the modal // This click event must not get propagated to parent container otherwise the modal
// will not show up because of a call to `close_active_modal` in `settings.js`. // will not show up because of a call to `close_active` in `settings.js`.
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();