@strapi/content-manager 5.0.0-rc.26 → 5.0.0-rc.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2388,11 +2388,8 @@ const validateLocale = (sourceUid, targetUid, locale) => {
2388
2388
  const isLocalized = strapi.plugin("i18n").service("content-types").isLocalizedContentType;
2389
2389
  const isSourceLocalized = isLocalized(sourceModel);
2390
2390
  const isTargetLocalized = isLocalized(targetModel);
2391
- let validatedLocale = locale;
2392
- if (!targetModel || !isTargetLocalized)
2393
- validatedLocale = void 0;
2394
2391
  return {
2395
- locale: validatedLocale,
2392
+ locale,
2396
2393
  isSourceLocalized,
2397
2394
  isTargetLocalized
2398
2395
  };
@@ -2495,7 +2492,7 @@ const relations = {
2495
2492
  attribute,
2496
2493
  fieldsToSelect,
2497
2494
  mainField,
2498
- source: { schema: sourceSchema },
2495
+ source: { schema: sourceSchema, isLocalized: isSourceLocalized },
2499
2496
  target: { schema: targetSchema, isLocalized: isTargetLocalized },
2500
2497
  sourceSchema,
2501
2498
  targetSchema,
@@ -2517,7 +2514,8 @@ const relations = {
2517
2514
  fieldsToSelect,
2518
2515
  mainField,
2519
2516
  source: {
2520
- schema: { uid: sourceUid, modelType: sourceModelType }
2517
+ schema: { uid: sourceUid, modelType: sourceModelType },
2518
+ isLocalized: isSourceLocalized
2521
2519
  },
2522
2520
  target: {
2523
2521
  schema: { uid: targetUid },
@@ -2559,9 +2557,12 @@ const relations = {
2559
2557
  if (!fp.isEmpty(publishedAt)) {
2560
2558
  where[`${alias}.published_at`] = publishedAt;
2561
2559
  }
2562
- if (filterByLocale) {
2560
+ if (isTargetLocalized && locale) {
2563
2561
  where[`${alias}.locale`] = locale;
2564
2562
  }
2563
+ if (isSourceLocalized && locale) {
2564
+ where.locale = locale;
2565
+ }
2565
2566
  if ((idsToInclude?.length ?? 0) !== 0) {
2566
2567
  where[`${alias}.id`].$notIn = idsToInclude;
2567
2568
  }
@@ -2579,7 +2580,8 @@ const relations = {
2579
2580
  id: { $notIn: fp.uniq(idsToOmit) }
2580
2581
  });
2581
2582
  }
2582
- const res = await strapi.db.query(targetUid).findPage(strapi.get("query-params").transform(targetUid, queryParams));
2583
+ const dbQuery = strapi.get("query-params").transform(targetUid, queryParams);
2584
+ const res = await strapi.db.query(targetUid).findPage(dbQuery);
2583
2585
  ctx.body = {
2584
2586
  ...res,
2585
2587
  results: await addStatusToRelations(targetUid, res.results)