mirror of https://github.com/zulip/zulip.git
custom_profile_fields: Refactor toggle `required` field.
Do not send unnecessary extra params when changing the value of `required` field. 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:
parent
d28d9fec0d
commit
f5112446dd
|
@ -597,19 +597,9 @@ function toggle_display_in_profile_summary_profile_field(e) {
|
|||
|
||||
function toggle_required(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,
|
||||
required: $(e.currentTarget).prop("checked"),
|
||||
};
|
||||
const $profile_field_status = $("#admin-profile-field-status").expectOne();
|
||||
|
||||
|
|
Loading…
Reference in New Issue