From 7d3a92e1d68882fd195a6ad1fee53d4bda291ff6 Mon Sep 17 00:00:00 2001 From: abdou6666 Date: Fri, 22 Nov 2024 14:27:24 +0100 Subject: [PATCH] fix: minor changes --- api/src/i18n/services/translation.service.spec.ts | 3 +-- api/src/i18n/services/translation.service.ts | 5 +++-- api/src/utils/test/fixtures/setting.ts | 8 -------- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/api/src/i18n/services/translation.service.spec.ts b/api/src/i18n/services/translation.service.spec.ts index dfa2601..6ad5737 100644 --- a/api/src/i18n/services/translation.service.spec.ts +++ b/api/src/i18n/services/translation.service.spec.ts @@ -73,7 +73,7 @@ describe('TranslationService', () => { find: jest.fn().mockResolvedValue([ { translatable: false, - global_fallback: 'global_fallback', + label: 'global_fallback', fallback_message: ['Global fallback message'], }, ]), @@ -175,7 +175,6 @@ describe('TranslationService', () => { fallback_message: ['Global fallback message'], }, } as Settings); - const strings = await service.getSettingStrings(); expect(strings).toEqual([]); }); diff --git a/api/src/i18n/services/translation.service.ts b/api/src/i18n/services/translation.service.ts index 44f22fc..6a4d25d 100644 --- a/api/src/i18n/services/translation.service.ts +++ b/api/src/i18n/services/translation.service.ts @@ -140,8 +140,9 @@ export class TranslationService extends BaseService { return Object.values(settings) .map((group: Record) => Object.entries(group)) .flat() - .filter(([l]) => { - return translatableSettings.find(({ label }) => label === l); + .filter(([l, value]) => { + const found = translatableSettings.find(({ label }) => label === l); + return found && !!value; }) .map(([, v]) => v) .flat(); diff --git a/api/src/utils/test/fixtures/setting.ts b/api/src/utils/test/fixtures/setting.ts index 4d6355f..0cff704 100644 --- a/api/src/utils/test/fixtures/setting.ts +++ b/api/src/utils/test/fixtures/setting.ts @@ -20,14 +20,6 @@ export const settingFixtures: SettingCreateDto[] = [ type: SettingType.text, weight: 1, }, - { - group: 'contact', - label: 'greeting', - value: 'hello', - type: SettingType.text, - weight: 10, - translatable: true, - }, { group: 'contact', label: 'company_name',