diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Handlers/BlogPartArchiveHandler.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Handlers/BlogPartArchiveHandler.cs index 52a6cc76f..ebea52fc3 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Handlers/BlogPartArchiveHandler.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Handlers/BlogPartArchiveHandler.cs @@ -6,6 +6,7 @@ using Orchard.Blogs.Services; using Orchard.ContentManagement; using Orchard.ContentManagement.Aspects; using Orchard.ContentManagement.Handlers; +using Orchard.Core.Common.Models; using Orchard.Data; namespace Orchard.Blogs.Handlers { @@ -25,16 +26,16 @@ namespace Orchard.Blogs.Handlers { _workContextAccessor = workContextAccessor; _contentManager = contentManager; - OnPublishing((context, bp) => SavePreviousPublishDate(context.Id)); - OnRemoving((context, bp) => SavePreviousPublishDate(context.Id)); - OnUnpublishing((context, bp) => SavePreviousPublishDate(context.Id)); + OnUpdating((context, cp) => { if(context.ContentItem.Has()) SavePreviousCreatedDate(context.Id);}); + OnRemoving((context, bp) => SavePreviousCreatedDate(context.Id)); + OnUnpublishing((context, bp) => SavePreviousCreatedDate(context.Id)); OnPublished((context, bp) => IncreaseBlogArchive(bp)); OnUnpublished((context, bp) => ReduceBlogArchive(bp)); OnRemoved((context, bp) => ReduceBlogArchive(bp)); } - private void SavePreviousPublishDate(int contentItemId) { + private void SavePreviousCreatedDate(int contentItemId) { if (_previousCreatedUtc.ContainsKey(contentItemId)) { return; } @@ -44,8 +45,8 @@ namespace Orchard.Blogs.Handlers { // retrieve the creation date when it was published if (previousPublishedVersion != null) { var versionCommonPart = previousPublishedVersion.As(); - if (versionCommonPart.VersionCreatedUtc.HasValue) { - _previousCreatedUtc[contentItemId] = versionCommonPart.VersionCreatedUtc.Value; + if (versionCommonPart.CreatedUtc.HasValue) { + _previousCreatedUtc[contentItemId] = versionCommonPart.CreatedUtc.Value; } } }