diff --git a/src/Umbraco.Core/Persistence/Factories/ContentFactory.cs b/src/Umbraco.Core/Persistence/Factories/ContentFactory.cs index 4ea164efdd..c9bc291105 100644 --- a/src/Umbraco.Core/Persistence/Factories/ContentFactory.cs +++ b/src/Umbraco.Core/Persistence/Factories/ContentFactory.cs @@ -51,7 +51,8 @@ namespace Umbraco.Core.Persistence.Factories UpdateDate = dto.ContentVersionDto.VersionDate, ExpireDate = dto.ExpiresDate.HasValue ? dto.ExpiresDate.Value : (DateTime?)null, ReleaseDate = dto.ReleaseDate.HasValue ? dto.ReleaseDate.Value : (DateTime?)null, - Version = dto.ContentVersionDto.VersionId + Version = dto.ContentVersionDto.VersionId, + PublishedState = dto.Published ? PublishedState.Published : PublishedState.Unpublished }; } diff --git a/src/Umbraco.Core/Services/ContentService.cs b/src/Umbraco.Core/Services/ContentService.cs index 7f4d4be062..376024a3ae 100644 --- a/src/Umbraco.Core/Services/ContentService.cs +++ b/src/Umbraco.Core/Services/ContentService.cs @@ -1383,8 +1383,8 @@ namespace Umbraco.Core.Services { content.WriterId = userId; - //Only change the publish state if the "previous" version was actually published - if (changeState && content.Published) + //Only change the publish state if the "previous" version was actually published or marked as unpublished + if (changeState && (content.Published || ((Content)content).PublishedState == PublishedState.Unpublished)) content.ChangePublishedState(PublishedState.Saved); repository.AddOrUpdate(content); diff --git a/src/umbraco.cms/businesslogic/web/Document.cs b/src/umbraco.cms/businesslogic/web/Document.cs index 9ce200957c..000573abcd 100644 --- a/src/umbraco.cms/businesslogic/web/Document.cs +++ b/src/umbraco.cms/businesslogic/web/Document.cs @@ -972,7 +972,7 @@ namespace umbraco.cms.businesslogic.web [Obsolete("Obsolete, Instead of calling this just check if the latest version of the content is published", false)] public bool HasPendingChanges() { - return Content.Published == false; + return Content.Published == false && ((Umbraco.Core.Models.Content)Content).PublishedState != PublishedState.Unpublished; } ///