Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix At request translation when entity property has empty value #7362

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading