@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.
@@ -101,7 +101,11 @@ const getEntry = async ({
101
101
  status = "draft"
102
102
  }, { strapi: strapi2 }) => {
103
103
  if (documentId) {
104
- return strapi2.documents(contentType).findOne({ documentId, locale, populate, status });
104
+ const entry = await strapi2.documents(contentType).findOne({ documentId, locale, populate, status });
105
+ if (status === "published" && !entry) {
106
+ return strapi2.documents(contentType).findOne({ documentId, locale, populate, status: "draft" });
107
+ }
108
+ return entry;
105
109
  }
106
110
  return strapi2.documents(contentType).findFirst({ locale, populate, status });
107
111
  };
@@ -463,8 +467,8 @@ const bootstrap = async ({ strapi: strapi2 }) => {
463
467
  const { where } = event.params;
464
468
  deleteReleasesActionsAndUpdateReleaseStatus({
465
469
  contentType: model.uid,
466
- locale: where.locale ?? null,
467
- ...where.documentId && { entryDocumentId: where.documentId }
470
+ locale: where?.locale ?? null,
471
+ ...where?.documentId && { entryDocumentId: where.documentId }
468
472
  });
469
473
  }
470
474
  } catch (error) {