mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
DefaultContentManager.cs
The new version should always be contentItemRecord.Versions.Max(x => x.Number) + 1; not latestVersion.Number + 1; I have a scenario where user can delete the draft content. In this scenario, I set the published version to have Latest=true and the draft version to have Latest=false. Now if I have to create again a new draft out of the published content, I end up having two versions of the same content items with the same version number.
This commit is contained in:
@@ -481,11 +481,13 @@ namespace Orchard.ContentManagement {
|
||||
|
||||
if (latestVersion != null) {
|
||||
latestVersion.Latest = false;
|
||||
buildingItemVersionRecord.Number = latestVersion.Number + 1;
|
||||
//buildingItemVersionRecord.Number = latestVersion.Number + 1;
|
||||
}
|
||||
else {
|
||||
//else {
|
||||
// buildingItemVersionRecord.Number = contentItemRecord.Versions.Max(x => x.Number) + 1;
|
||||
//}
|
||||
////The new version should always be the next highest available number.
|
||||
buildingItemVersionRecord.Number = contentItemRecord.Versions.Max(x => x.Number) + 1;
|
||||
}
|
||||
|
||||
contentItemRecord.Versions.Add(buildingItemVersionRecord);
|
||||
_contentItemVersionRepository.Create(buildingItemVersionRecord);
|
||||
|
||||
Reference in New Issue
Block a user