Refactor IPublishedContent.Parent()
This commit is contained in:
@@ -157,7 +157,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
pathParts.Add(urlSegment);
|
||||
|
||||
// move to parent node
|
||||
n = n.Parent;
|
||||
n = n.Parent();
|
||||
if (n != null)
|
||||
urlSegment = n.UrlSegment(culture);
|
||||
|
||||
@@ -206,7 +206,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
// "/foo" fails (looking for "/*/foo") we try also "/foo".
|
||||
// this does not make much sense anyway esp. if both "/foo/" and "/bar/foo" exist, but
|
||||
// that's the way it works pre-4.10 and we try to be backward compat for the time being
|
||||
if (content.Parent == null)
|
||||
if (content.Parent() == null)
|
||||
{
|
||||
var rootNode = GetByRoute(preview, "/", true);
|
||||
if (rootNode == null)
|
||||
|
||||
@@ -325,21 +325,18 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
#region Tree
|
||||
|
||||
/// <inheritdoc />
|
||||
public override IPublishedContent Parent
|
||||
public override IPublishedContent Parent()
|
||||
{
|
||||
get
|
||||
// have to use the "current" cache because a PublishedContent can be shared
|
||||
// amongst many snapshots and other content depend on the snapshots
|
||||
switch (_contentNode.ContentType.ItemType)
|
||||
{
|
||||
// have to use the "current" cache because a PublishedContent can be shared
|
||||
// amongst many snapshots and other content depend on the snapshots
|
||||
switch (_contentNode.ContentType.ItemType)
|
||||
{
|
||||
case PublishedItemType.Content:
|
||||
return GetContentById(IsPreviewing, _contentNode.ParentContentId);
|
||||
case PublishedItemType.Media:
|
||||
return GetMediaById(IsPreviewing, _contentNode.ParentContentId);
|
||||
default:
|
||||
throw new Exception($"Panic: unsupported item type \"{_contentNode.ContentType.ItemType}\".");
|
||||
}
|
||||
case PublishedItemType.Content:
|
||||
return GetContentById(IsPreviewing, _contentNode.ParentContentId);
|
||||
case PublishedItemType.Media:
|
||||
return GetMediaById(IsPreviewing, _contentNode.ParentContentId);
|
||||
default:
|
||||
throw new Exception($"Panic: unsupported item type \"{_contentNode.ContentType.ItemType}\".");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user