Fixed issue with preparing patch operation's value when value has an authority id but is not an instance of VocabularyEntry or FormFieldMetadataValueObject

This commit is contained in:
Giuseppe Digilio
2020-09-11 15:35:50 +02:00
parent fab0a09727
commit a178e215f0

View File

@@ -134,6 +134,8 @@ export class JsonPatchOperationsBuilder {
operationValue = this.prepareAuthorityValue(value);
} else if (value instanceof FormFieldLanguageValueObject) {
operationValue = new FormFieldMetadataValueObject(value.value, value.language);
} else if (value.hasOwnProperty('authority')) {
operationValue = new FormFieldMetadataValueObject(value.value, value.language, value.authority);
} else if (value.hasOwnProperty('value')) {
operationValue = new FormFieldMetadataValueObject(value.value);
} else {
@@ -149,8 +151,8 @@ export class JsonPatchOperationsBuilder {
return operationValue;
}
protected prepareAuthorityValue(value: any) {
let operationValue: any = null;
protected prepareAuthorityValue(value: any): FormFieldMetadataValueObject {
let operationValue: FormFieldMetadataValueObject;
if (isNotEmpty(value.authority)) {
operationValue = new FormFieldMetadataValueObject(value.value, value.language, value.authority);
} else {