@strapi/review-workflows 0.0.0-next.840550dc97a3782302ddf918d3a0d07e59dd11eb → 0.0.0-next.8f63e1055db761e0213cb6610f80c55658196ae1
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.
package/dist/server/index.mjs
CHANGED
|
@@ -6561,8 +6561,40 @@ function extendReviewWorkflowContentTypes({ strapi: strapi2 }) {
|
|
|
6561
6561
|
});
|
|
6562
6562
|
}
|
|
6563
6563
|
}
|
|
6564
|
+
function persistRWOnDowngrade({ strapi: strapi2 }) {
|
|
6565
|
+
const { removePersistedTablesWithSuffix, persistTables } = getAdminService("persist-tables");
|
|
6566
|
+
return async ({ contentTypes: contentTypes2 }) => {
|
|
6567
|
+
const getStageTableToPersist = (contentTypeUID) => {
|
|
6568
|
+
const { attributes, tableName } = strapi2.db.metadata.get(contentTypeUID);
|
|
6569
|
+
const joinTableName = attributes[ENTITY_STAGE_ATTRIBUTE].joinTable.name;
|
|
6570
|
+
return {
|
|
6571
|
+
name: joinTableName,
|
|
6572
|
+
dependsOn: [{ name: tableName }]
|
|
6573
|
+
};
|
|
6574
|
+
};
|
|
6575
|
+
const getAssigneeTableToPersist = (contentTypeUID) => {
|
|
6576
|
+
const { attributes, tableName } = strapi2.db.metadata.get(contentTypeUID);
|
|
6577
|
+
const joinTableName = attributes[ENTITY_ASSIGNEE_ATTRIBUTE].joinTable.name;
|
|
6578
|
+
return {
|
|
6579
|
+
name: joinTableName,
|
|
6580
|
+
dependsOn: [{ name: tableName }]
|
|
6581
|
+
};
|
|
6582
|
+
};
|
|
6583
|
+
const enabledRWContentTypes = fp.pipe([
|
|
6584
|
+
getVisibleContentTypesUID,
|
|
6585
|
+
fp.filter((uid) => hasStageAttribute(contentTypes2[uid]))
|
|
6586
|
+
])(contentTypes2);
|
|
6587
|
+
const stageJoinTablesToPersist = enabledRWContentTypes.map(getStageTableToPersist);
|
|
6588
|
+
await removePersistedTablesWithSuffix("_strapi_stage_lnk");
|
|
6589
|
+
await persistTables(stageJoinTablesToPersist);
|
|
6590
|
+
const assigneeJoinTablesToPersist = enabledRWContentTypes.map(getAssigneeTableToPersist);
|
|
6591
|
+
await removePersistedTablesWithSuffix("_strapi_assignee_lnk");
|
|
6592
|
+
await persistTables(assigneeJoinTablesToPersist);
|
|
6593
|
+
};
|
|
6594
|
+
}
|
|
6564
6595
|
const register = async ({ strapi: strapi2 }) => {
|
|
6565
6596
|
strapi2.hook("strapi::content-types.beforeSync").register(migrateStageAttribute);
|
|
6597
|
+
strapi2.hook("strapi::content-types.afterSync").register(persistRWOnDowngrade({ strapi: strapi2 }));
|
|
6566
6598
|
strapi2.hook("strapi::content-types.afterSync").register(migrateReviewWorkflowStagesColor).register(migrateReviewWorkflowStagesRoles).register(migrateReviewWorkflowName).register(migrateWorkflowsContentTypes).register(migrateDeletedCTInWorkflows);
|
|
6567
6599
|
reviewWorkflowsMiddlewares.contentTypeMiddleware(strapi2);
|
|
6568
6600
|
extendReviewWorkflowContentTypes({ strapi: strapi2 });
|
|
@@ -7331,7 +7363,9 @@ const stages$1 = ({ strapi: strapi2 }) => {
|
|
|
7331
7363
|
const entity = await strapi2.documents(model).update({
|
|
7332
7364
|
documentId,
|
|
7333
7365
|
locale,
|
|
7334
|
-
|
|
7366
|
+
// Stage doesn't have DP or i18n enabled, connecting it through the `id`
|
|
7367
|
+
// will be safer than relying on the `documentId` + `locale` + `status` transformation
|
|
7368
|
+
data: { [ENTITY_STAGE_ATTRIBUTE]: fp.pick(["id"], stage) },
|
|
7335
7369
|
populate: [ENTITY_STAGE_ATTRIBUTE]
|
|
7336
7370
|
});
|
|
7337
7371
|
metrics.sendDidChangeEntryStage();
|