mirror of
https://github.com/zulip/zulip.git
synced 2025-11-17 04:12:02 +00:00
custom_profile_fields: Refactor toggle display_in_profile_summary.
Do not send unnecessary extra params when changing the value of display_in_profile_summary. Instead of searching realm.custom_profile_fields for the field we are editing, we will just use the checkbox value to update the field value, since we don't need to send other params like `name`, `hint`, etc. to the API after API feature level 252 update.
This commit is contained in:
committed by
Tim Abbott
parent
7518d550f2
commit
d28d9fec0d
@@ -581,19 +581,9 @@ function update_profile_fields_checkboxes() {
|
||||
|
||||
function toggle_display_in_profile_summary_profile_field(e) {
|
||||
const field_id = Number.parseInt($(e.currentTarget).attr("data-profile-field-id"), 10);
|
||||
const field = get_profile_field(field_id);
|
||||
|
||||
let field_data;
|
||||
if (field.field_data) {
|
||||
field_data = field.field_data;
|
||||
}
|
||||
|
||||
const data = {
|
||||
name: field.name,
|
||||
hint: field.hint,
|
||||
field_data,
|
||||
display_in_profile_summary: !field.display_in_profile_summary,
|
||||
required: field.required,
|
||||
display_in_profile_summary: $(e.currentTarget).prop("checked"),
|
||||
};
|
||||
const $profile_field_status = $("#admin-profile-field-status").expectOne();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user