Sfoglia il codice sorgente

fix(core): Fix variants not being returned in some language configs

Fixes #1539
Michael Bromley 3 anni fa
parent
commit
6a4e0d4fb3

+ 3 - 2
packages/core/src/service/helpers/list-query-builder/list-query-builder.ts

@@ -345,8 +345,9 @@ export class ListQueryBuilder implements OnApplicationBootstrap {
             qb.andWhere(
                 new Brackets(qb1 => {
                     qb1.where(`${translationsAlias}.languageCode = :languageCode`, { languageCode });
-
-                    if (languageCode !== this.configService.defaultLanguageCode) {
+                    const defaultLanguageCode =
+                        ctx?.channel.defaultLanguageCode ?? this.configService.defaultLanguageCode;
+                    if (languageCode !== defaultLanguageCode) {
                         // If the current languageCode is not the default, then we create a more
                         // complex WHERE clause to allow us to use the non-default translations and
                         // fall back to the default language if no translation exists.