fix: find published relations on components

This commit is contained in:
Alexandre BODIN 2025-10-09 09:08:03 +02:00
parent d6c661f8ab
commit 6a5663977e

View File

@ -127,10 +127,12 @@ const validateStatus = (
const sourceModel = strapi.getModel(sourceUid);
const isDP = contentTypes.hasDraftAndPublish;
const isSourceDP = isDP(sourceModel);
const isSourceDP = isDP(sourceModel)
// Default to draft if not set
if (!isSourceDP) return { status: undefined };
if (!isSourceDP && sourceModel.modelType === 'contentType') {
return { status: undefined };
}
switch (status) {
case 'published':
@ -450,7 +452,7 @@ export default {
publishedAt?: Record<string, any>;
} = {};
if (sourceSchema?.options?.draftAndPublish) {
if (sourceSchema?.options?.draftAndPublish || sourceSchema?.modelType === 'component') {
if (targetSchema?.options?.draftAndPublish) {
if (status === 'published') {
filters.publishedAt = { $notNull: true };