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.

settings_streams: Delete redundant uses of "update_choice_delete_btn".

Yogesh Sirsatf3830a3e1e67
diff --git a/web/src/settings_profile_fields.js b/web/src/settings_profile_fields.js
index 42fa2cb89d6..7d154bdb663 100644
--- a/web/src/settings_profile_fields.js
+++ b/web/src/settings_profile_fields.js
@@ -144,20 +144,6 @@ function read_external_account_field_data($profile_field_form) {
return field_data;
}
-export function update_choice_delete_btn($container, display_flag) {
- const no_of_choice_row = $container.find(".choice-row").length;
-
- // Disable delete button if there only one choice row
- // Enable choice delete button more one than once choice
- if (no_of_choice_row === 1) {
- if (display_flag === true) {
- $container.find(".choice-row .delete-choice").show();
- } else {
- $container.find(".choice-row .delete-choice").hide();
- }
- }
-}
-
export function get_value_for_new_option(container) {
let value = 0;
for (const row of $(container).find(".choice-row")) {
diff --git a/web/src/settings_streams.js b/web/src/settings_streams.js
index 18e610265a8..f0a55f59cf1 100644
--- a/web/src/settings_streams.js
+++ b/web/src/settings_streams.js
@@ -22,8 +22,6 @@ function add_choice_row($widget) {
if ($widget.closest(".choice-row").next().hasClass("choice-row")) {
return;
}
- const $choices_div = $("#default-stream-choices");
- settings_profile_fields.update_choice_delete_btn($choices_div, true);
create_choice_row();
}
@@ -154,9 +152,7 @@ export function delete_default_stream(stream_id, $default_stream_row, $alert_ele
function delete_choice_row(e) {
const $row = $(e.currentTarget).parent();
- const $container = $row.parent();
$row.remove();
- settings_profile_fields.update_choice_delete_btn($container, false);
// Disable the submit button if no streams are selected.
$("#add-default-stream-modal .dialog_submit_button").prop(
@@ -209,7 +205,6 @@ function show_add_default_streams_modal() {
$("#add-default-stream-modal .dialog_submit_button").prop("disabled", true);
create_choice_row();
- settings_profile_fields.update_choice_delete_btn($("#default-stream-choices"), false);
$("#default-stream-choices").on("click", "button.delete-choice", delete_choice_row);
}