1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-23 11:56:00 +01:00

[Linked fields] Reset linkedIds if cipher type changes (#535)

* Reset linkedIds if cipher type changes

* Only reset linkedId if !editmode
This commit is contained in:
Thomas Rittson 2021-11-04 07:24:45 +10:00 committed by GitHub
parent e2c72a75f9
commit 2db9e1ce0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -102,5 +102,11 @@ export class AddEditCustomFieldsComponent implements OnChanges {
this.cipher.linkedFieldOptions.forEach((linkedFieldOption, id) =>
options.push({ name: this.i18nService.t(linkedFieldOption.i18nKey), value: id }));
this.linkedFieldOptions = options.sort(Utils.getSortFunction(this.i18nService, 'name'));
if (!this.editMode) {
this.cipher.fields
.filter(f => f.type = FieldType.Linked)
.forEach(f => f.linkedId = this.linkedFieldOptions[0].value);
}
}
}