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_profile_fields: Uncheck `use_for_user_matching` checkbox.

Niloth Pbe2c4987f99d
diff --git a/web/src/settings_profile_fields.ts b/web/src/settings_profile_fields.ts
index d2ede9c187a..dded1876f2f 100644
--- a/web/src/settings_profile_fields.ts
+++ b/web/src/settings_profile_fields.ts
@@ -235,6 +235,15 @@ function initialize_form_to_defaults(): void {
external_accounts_dropdown_widget.render();
}
+function should_check_user_matching_for_external_account(
+ account_type: string | number | undefined,
+): boolean {
+ const unchecked_account_types = new Set(["atlassian", "mastodon"]);
+ const should_uncheck_checkbox =
+ typeof account_type === "string" && unchecked_account_types.has(account_type);
+ return !should_uncheck_checkbox;
+}
+
function external_account_item_click_callback(
event: JQuery.ClickEvent,
dropdown: tippy.Instance,
@@ -261,6 +270,10 @@ function external_account_item_click_callback(
assert(external_account !== undefined);
$("#profile_field_name").val(external_account.name).prop("disabled", true);
$("#profile_field_hint").val(external_account.hint).prop("disabled", true);
+ $("#profile_field_use_for_user_matching").prop(
+ "checked",
+ should_check_user_matching_for_external_account(external_account.text.toLowerCase()),
+ );
widget.render();
}
@@ -319,7 +332,11 @@ function update_form_for_field_type_selection(): void {
if (is_valid_to_use_for_user_matching(profile_field_type)) {
$("#profile_field_use_for_user_matching").closest(".input-group").show();
- const check_use_for_user_mentions = profile_field_type === field_types.EXTERNAL_ACCOUNT.id;
+ const check_use_for_user_mentions =
+ profile_field_type === field_types.EXTERNAL_ACCOUNT.id &&
+ should_check_user_matching_for_external_account(
+ external_accounts_dropdown_widget.value(),
+ );
$("#profile_field_use_for_user_matching").prop("checked", check_use_for_user_mentions);
} else {
$("#profile_field_use_for_user_matching").closest(".input-group").hide();