U4-10853 - fix (scheduled) unpublishing issues

This commit is contained in:
Stephan
2018-01-23 13:04:57 +01:00
parent 05c12d1f27
commit ab9e029525
2 changed files with 3 additions and 19 deletions

View File

@@ -693,27 +693,11 @@ namespace Umbraco.Core.Persistence.Repositories
// else if unpublished then clear published version infos
if (entity.Published)
{
dto.DocumentPublishedReadOnlyDto = new DocumentPublishedReadOnlyDto
{
VersionId = dto.VersionId,
VersionDate = dto.UpdateDate,
Newest = true,
NodeId = dto.NodeId,
Published = true
};
((Content) entity).PublishedVersionGuid = dto.VersionId;
((Content) entity).PublishedDate = dto.UpdateDate;
}
else if (publishedStateChanged)
else
{
dto.DocumentPublishedReadOnlyDto = new DocumentPublishedReadOnlyDto
{
VersionId = default (Guid),
VersionDate = default (DateTime),
Newest = false,
NodeId = dto.NodeId,
Published = false
};
((Content) entity).PublishedVersionGuid = default(Guid);
((Content) entity).PublishedDate = default (DateTime);
}

View File

@@ -884,8 +884,8 @@ namespace Umbraco.Core.Services
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
{
var repository = RepositoryFactory.CreateContentRepository(uow);
var query = Query<IContent>.Builder.Where(x => x.Published && x.ExpireDate <= DateTime.Now);
return repository.GetByQuery(query);
var query = Query<IContent>.Builder.Where(x => x.ExpireDate <= DateTime.Now);
return repository.GetByQuery(query).Where(x => x.HasPublishedVersion);
}
}