Skip to content

Commit

Permalink
Fix At request translation when entity property has empty value (#7362)
Browse files Browse the repository at this point in the history
  • Loading branch information
daneryl authored and RafaPolit committed Oct 18, 2024
1 parent ba38e93 commit 493e999
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/api/entities.v2/model/Entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class Entity {
if (property.type === 'text' || property.type === 'markdown') {
const isTitleProperty = property instanceof CommonProperty && property.name === 'title';
if (isTitleProperty) return this.title;
return this.metadata[property.name][0].value as string;
return this.metadata[property.name]?.[0]?.value as string;
}

throw new Error('types other than string/markdown are not implemented yet');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ const fixtures: DBFixture = {
factory.template('template1', [
factory.property('text1'),
factory.property('text2', 'markdown'),
factory.property('text3'),
factory.property('empty_text'),
]),
],
entities: [
...factory.entityInMultipleLanguages(['en', 'es', 'pt'], 'entity1', 'template1', {
text1: [{ value: 'original text1' }],
text2: [{ value: 'markdown text' }],
text3: [],
empty_text: [{ value: '' }],
}),
],
Expand All @@ -47,6 +49,7 @@ const fixtures: DBFixture = {
properties: [
factory.idString('text1'),
factory.idString('text2'),
factory.idString('text3'),
factory.idString('empty_text'),
],
commonProperties: [factory.commonPropertiesTitleId('template1')],
Expand Down

0 comments on commit 493e999

Please sign in to comment.