@strapi/content-releases 5.1.0 → 5.2.0

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.
@@ -124,7 +124,11 @@ const getEntry = async ({
124
124
  status = "draft"
125
125
  }, { strapi: strapi2 }) => {
126
126
  if (documentId) {
127
- return strapi2.documents(contentType).findOne({ documentId, locale, populate, status });
127
+ const entry = await strapi2.documents(contentType).findOne({ documentId, locale, populate, status });
128
+ if (status === "published" && !entry) {
129
+ return strapi2.documents(contentType).findOne({ documentId, locale, populate, status: "draft" });
130
+ }
131
+ return entry;
128
132
  }
129
133
  return strapi2.documents(contentType).findFirst({ locale, populate, status });
130
134
  };
@@ -486,8 +490,8 @@ const bootstrap = async ({ strapi: strapi2 }) => {
486
490
  const { where } = event.params;
487
491
  deleteReleasesActionsAndUpdateReleaseStatus({
488
492
  contentType: model.uid,
489
- locale: where.locale ?? null,
490
- ...where.documentId && { entryDocumentId: where.documentId }
493
+ locale: where?.locale ?? null,
494
+ ...where?.documentId && { entryDocumentId: where.documentId }
491
495
  });
492
496
  }
493
497
  } catch (error) {