diff --git a/mdm/common/src/main/java/com/gentics/mesh/core/data/dao/PersistingNodeDao.java b/mdm/common/src/main/java/com/gentics/mesh/core/data/dao/PersistingNodeDao.java index 712af1bc99..0410f15507 100644 --- a/mdm/common/src/main/java/com/gentics/mesh/core/data/dao/PersistingNodeDao.java +++ b/mdm/common/src/main/java/com/gentics/mesh/core/data/dao/PersistingNodeDao.java @@ -1517,6 +1517,11 @@ default boolean update(HibProject project, HibNode node, InternalActionContext a // Update the existing fields newDraftVersion.updateFieldsFromRest(ac, requestModel.getFields()); + // Purge the old draft + if (ac.isPurgeAllowed() && contentDao.isAutoPurgeEnabled( newDraftVersion) && contentDao.isPurgeable(latestDraftVersion)) { + contentDao.purge(latestDraftVersion); + } + // if requested, make the new container the published one if (requestModel.isPublish()) { contentDao.setVersion(newDraftVersion, newDraftVersion.getVersion().nextPublished()); @@ -1524,11 +1529,6 @@ default boolean update(HibProject project, HibNode node, InternalActionContext a batch.add(contentDao.onPublish(newDraftVersion, branch.getUuid())); } - // Purge the old draft - if (ac.isPurgeAllowed() && contentDao.isAutoPurgeEnabled( newDraftVersion) && contentDao.isPurgeable(latestDraftVersion)) { - contentDao.purge(latestDraftVersion); - } - latestDraftVersion = newDraftVersion; batch.add(contentDao.onUpdated(newDraftVersion, branch.getUuid(), DRAFT));