NuCache - fix parent published

This commit is contained in:
Stephan
2018-07-05 17:08:40 +02:00
parent 0af18b2376
commit 75d685ef43
2 changed files with 15 additions and 3 deletions

View File

@@ -415,8 +415,11 @@ namespace Umbraco.Web.PublishedCache.NuCache
if (_contentTypesById.TryGetValue(kit.ContentTypeId, out LinkedNode<PublishedContentType> link) == false || link.Value == null)
return false;
// check whether parent is published
var canBePublished = ParentPublishedLocked(kit);
// and use
kit.Build(link.Value, _publishedSnapshotAccessor, _variationContextAccessor);
kit.Build(link.Value, _publishedSnapshotAccessor, _variationContextAccessor, canBePublished);
return true;
}
@@ -643,6 +646,15 @@ namespace Umbraco.Web.PublishedCache.NuCache
return link?.Value != null;
}
private bool ParentPublishedLocked(ContentNodeKit kit)
{
if (kit.Node.ParentContentId < 0)
return true;
var link = GetParentLink(kit.Node);
var node = link?.Value;
return node?.Published != null;
}
private void AddToParentLocked(ContentNode content)
{
// add to root content index,