From 2db9e1ce0d7a702f07f20ecb916dd8191ff617e1 Mon Sep 17 00:00:00 2001 From: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Date: Thu, 4 Nov 2021 07:24:45 +1000 Subject: [PATCH] [Linked fields] Reset linkedIds if cipher type changes (#535) * Reset linkedIds if cipher type changes * Only reset linkedId if !editmode --- angular/src/components/add-edit-custom-fields.component.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/angular/src/components/add-edit-custom-fields.component.ts b/angular/src/components/add-edit-custom-fields.component.ts index 8d37197096..ffd6731bad 100644 --- a/angular/src/components/add-edit-custom-fields.component.ts +++ b/angular/src/components/add-edit-custom-fields.component.ts @@ -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); + } } }