Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

integration_url_modal: Support boolean URL params defaulting to true.

Niloth Pc634cdc349f8
diff --git a/docs/webhooks/incoming-webhooks-reference.md b/docs/webhooks/incoming-webhooks-reference.md
index af9c21a1031..6c52a148a9a 100644
--- a/docs/webhooks/incoming-webhooks-reference.md
+++ b/docs/webhooks/incoming-webhooks-reference.md
@@ -113,6 +113,8 @@ offer when generating the integration URL:
The web app UI currently supports the following input types:
- `checkbox`: A checkbox input for presence-only values (true or absent),
disabled by default.
+ - `checkbox_enabled`: A checkbox input for boolean parameters, enabled by
+ default.
- `text`: A text input for string values.
To add support for other input types, you can update
diff --git a/web/src/integration_url_modal.ts b/web/src/integration_url_modal.ts
index 39878376192..6d7c7b97578 100644
--- a/web/src/integration_url_modal.ts
+++ b/web/src/integration_url_modal.ts
@@ -184,13 +184,17 @@ export function show_generate_integration_url_modal(api_key: string): void {
$config_element.find("#integration-url-all-branches").on("change", () => {
show_branch_filtering_ui();
});
- } else if (input_type === "checkbox") {
+ } else if (input_type === "checkbox" || input_type === "checkbox_enabled") {
$config_element = $(
render_generate_integration_url_config_checkbox_modal({key, label}),
);
- $config_element.find(`#integration-url-${key}-checkbox`).on("change", () => {
+ const $input = $config_element.find(`#integration-url-${key}-checkbox`);
+ $input.on("change", () => {
update_url();
});
+ if (input_type === "checkbox_enabled") {
+ $input.prop("checked", true);
+ }
} else if (input_type === "text") {
$config_element = $(
render_generate_integration_url_config_text_modal({key, label}),
@@ -202,6 +206,7 @@ export function show_generate_integration_url_modal(api_key: string): void {
continue;
}
$config_container.append($config_element);
+ update_url();
}
}
@@ -344,10 +349,12 @@ export function show_generate_integration_url_modal(api_key: string): void {
if (branch_names) {
params.set(key, branch_names);
}
- } else if (input_type === "checkbox") {
+ } else if (input_type === "checkbox" || input_type === "checkbox_enabled") {
const is_checked = $(`#integration-url-${key}-checkbox`).is(":checked");
if (is_checked) {
params.set(option.key, "true");
+ } else if (input_type === "checkbox_enabled") {
+ params.set(option.key, "false");
}
} else if (input_type === "text") {
const value = $(`#integration-url-${key}-text`).val()?.toString();