This commit is contained in:
Stephan
2019-02-15 19:32:13 +01:00
parent 8e29dbd494
commit 6a5f8c0ab8
2 changed files with 56 additions and 53 deletions

View File

@@ -13,7 +13,6 @@ namespace Umbraco.Web.PublishedCache.NuCache
internal class PublishedContent : PublishedContentBase
{
private readonly IPublishedSnapshotAccessor _publishedSnapshotAccessor;
private readonly IUmbracoContextAccessor _umbracoContextAccessor;
private readonly ContentNode _contentNode;
private readonly string _urlSegment;
@@ -24,13 +23,13 @@ namespace Umbraco.Web.PublishedCache.NuCache
ContentData contentData,
IPublishedSnapshotAccessor publishedSnapshotAccessor,
IVariationContextAccessor variationContextAccessor,
IUmbracoContextAccessor umbracoContextAccessor) :base(umbracoContextAccessor)
IUmbracoContextAccessor umbracoContextAccessor)
: base(umbracoContextAccessor)
{
_contentNode = contentNode;
ContentData = contentData;
_publishedSnapshotAccessor = publishedSnapshotAccessor;
_umbracoContextAccessor = umbracoContextAccessor;
VariationContextAccessor = variationContextAccessor;
_contentNode = contentNode ?? throw new ArgumentNullException(nameof(contentNode));
ContentData = contentData ?? throw new ArgumentNullException(nameof(contentData));
_publishedSnapshotAccessor = publishedSnapshotAccessor ?? throw new ArgumentNullException(nameof(publishedSnapshotAccessor));
VariationContextAccessor = variationContextAccessor ?? throw new ArgumentNullException(nameof(variationContextAccessor));
_urlSegment = ContentData.Name.ToUrlSegment();
IsPreviewing = ContentData.Published == false;
@@ -72,7 +71,8 @@ namespace Umbraco.Web.PublishedCache.NuCache
public PublishedContent(
ContentNode contentNode,
PublishedContent origin,
IUmbracoContextAccessor umbracoContextAccessor) :base(umbracoContextAccessor)
IUmbracoContextAccessor umbracoContextAccessor)
: base(umbracoContextAccessor)
{
_contentNode = contentNode;
_publishedSnapshotAccessor = origin._publishedSnapshotAccessor;
@@ -91,7 +91,8 @@ namespace Umbraco.Web.PublishedCache.NuCache
// clone for previewing as draft a published content that is published and has no draft
private PublishedContent(
PublishedContent origin,
IUmbracoContextAccessor umbracoContextAccessor) :base(umbracoContextAccessor)
IUmbracoContextAccessor umbracoContextAccessor)
: base(umbracoContextAccessor)
{
_publishedSnapshotAccessor = origin._publishedSnapshotAccessor;
VariationContextAccessor = origin.VariationContextAccessor;
@@ -468,8 +469,8 @@ namespace Umbraco.Web.PublishedCache.NuCache
return this;
var cache = GetAppropriateCache();
if (cache == null) return new PublishedContent(this, _umbracoContextAccessor).CreateModel();
return (IPublishedContent)cache.Get(AsPreviewingCacheKey, () => new PublishedContent(this, _umbracoContextAccessor).CreateModel());
if (cache == null) return new PublishedContent(this, UmbracoContextAccessor).CreateModel();
return (IPublishedContent)cache.Get(AsPreviewingCacheKey, () => new PublishedContent(this, UmbracoContextAccessor).CreateModel());
}
// used by Navigable.Source,...