settings: Fix external account profile field initialization order.

In open_edit_form, we had an initialization order bug where we called
set_up_external_account_field_edit_form, which clears the field name
field if the external account is of the "custom" type, after
populating the initial values for edit form.

This resulted in these fields being displayed as empty in the UI for
this field type. Fix the issue by reordering the initialization.

Fixes: #21262.
This commit is contained in:
yogesh sirsat 2022-02-28 20:06:05 +05:30 committed by Tim Abbott
parent 3ba444096b
commit 1a15d60de4
1 changed files with 4 additions and 3 deletions

View File

@ -281,9 +281,6 @@ function open_edit_form(e) {
profile_field.row.hide();
profile_field.form.show();
const field = get_profile_field(field_id);
// Set initial value in edit form
profile_field.form.find("input[name=name]").val(field.name);
profile_field.form.find("input[name=hint]").val(field.hint);
let field_data = {};
if (field.field_data) {
field_data = JSON.parse(field.field_data);
@ -298,6 +295,10 @@ function open_edit_form(e) {
set_up_external_account_field_edit_form(profile_field, field_data.url_pattern);
}
// Set initial value in edit form
profile_field.form.find("input[name=name]").val(field.name);
profile_field.form.find("input[name=hint]").val(field.hint);
profile_field.form.find(".reset").on("click", () => {
profile_field.form.hide();
profile_field.row.show();