Restored type check for NuCache status controller.

Added service located extension method for retrieving creator and writer name.
This commit is contained in:
Andy Butland
2020-02-01 18:19:50 +01:00
parent 50c309e613
commit b8bfdf1441
3 changed files with 22 additions and 6 deletions

View File

@@ -15,6 +15,9 @@
</ItemGroup>
<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Umbraco.Web</_Parameter1>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Umbraco.Tests</_Parameter1>
</AssemblyAttribute>

View File

@@ -21,12 +21,10 @@ namespace Umbraco.Web.Editors
{
get
{
// TODO: do we need this?
//var svc = _publishedSnapshotService as PublishedSnapshotService;
//if (svc == null)
// throw new NotSupportedException("Not running NuCache.");
// return svc;
return _publishedSnapshotService;
var svc = _publishedSnapshotService as PublishedSnapshotService;
if (svc == null)
throw new NotSupportedException("Not running NuCache.");
return svc;
}
}

View File

@@ -28,6 +28,7 @@ namespace Umbraco.Web
private static UmbracoContext UmbracoContext => Current.UmbracoContext;
private static ISiteDomainHelper SiteDomainHelper => Current.Factory.GetInstance<ISiteDomainHelper>();
private static IVariationContextAccessor VariationContextAccessor => Current.VariationContextAccessor;
private static IUserService UserService => Current.Services.UserService;
#region IsComposedOf
@@ -795,6 +796,20 @@ namespace Umbraco.Web
#endregion
#region Writer and creator
public static string CreatorName(this IPublishedContent content)
{
return content.GetCreatorName(UserService);
}
public static string WriterName(this IPublishedContent content)
{
return content.GetWriterName(UserService);
}
#endregion
#region Url
/// <summary>