@strapi/content-releases 5.0.0-rc.13 → 5.0.0-rc.15

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.
@@ -906,7 +906,7 @@ const createReleaseActionService = ({ strapi: strapi2 }) => {
906
906
  return contentTypesData;
907
907
  };
908
908
  return {
909
- async create(releaseId, action) {
909
+ async create(releaseId, action, { disableUpdateReleaseStatus = false } = {}) {
910
910
  const { validateEntryData, validateUniqueEntry } = getService("release-validation", {
911
911
  strapi: strapi2
912
912
  });
@@ -939,7 +939,9 @@ const createReleaseActionService = ({ strapi: strapi2 }) => {
939
939
  },
940
940
  populate: { release: { select: ["id"] } }
941
941
  });
942
- getService("release", { strapi: strapi2 }).updateReleaseStatus(release2.id);
942
+ if (!disableUpdateReleaseStatus) {
943
+ getService("release", { strapi: strapi2 }).updateReleaseStatus(release2.id);
944
+ }
943
945
  return releaseAction2;
944
946
  },
945
947
  async findPage(releaseId, query) {
@@ -1528,11 +1530,14 @@ const releaseActionController = {
1528
1530
  releaseActionsArgs.map((releaseActionArgs) => validateReleaseAction(releaseActionArgs))
1529
1531
  );
1530
1532
  const releaseActionService = getService("release-action", { strapi });
1533
+ const releaseService = getService("release", { strapi });
1531
1534
  const releaseActions = await strapi.db.transaction(async () => {
1532
1535
  const releaseActions2 = await Promise.all(
1533
1536
  releaseActionsArgs.map(async (releaseActionArgs) => {
1534
1537
  try {
1535
- const action = await releaseActionService.create(releaseId, releaseActionArgs);
1538
+ const action = await releaseActionService.create(releaseId, releaseActionArgs, {
1539
+ disableUpdateReleaseStatus: true
1540
+ });
1536
1541
  return action;
1537
1542
  } catch (error) {
1538
1543
  if (error instanceof AlreadyOnReleaseError) {
@@ -1545,6 +1550,9 @@ const releaseActionController = {
1545
1550
  return releaseActions2;
1546
1551
  });
1547
1552
  const newReleaseActions = releaseActions.filter((action) => action !== null);
1553
+ if (newReleaseActions.length > 0) {
1554
+ releaseService.updateReleaseStatus(releaseId);
1555
+ }
1548
1556
  ctx.created({
1549
1557
  data: newReleaseActions,
1550
1558
  meta: {