changing the template check to an enabled check instead.
This commit is contained in:
@@ -20,11 +20,5 @@ namespace Umbraco.Web.Features
|
||||
/// Gets the disabled controllers.
|
||||
/// </summary>
|
||||
public TypeList<UmbracoApiControllerBase> Controllers { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Specifies if rendering pipeline should ignore HasTemplate check when handling a request.
|
||||
/// <remarks>This is to allow JSON preview of content with no template set.</remarks>
|
||||
/// </summary>
|
||||
public bool AllowRenderWithoutTemplate { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
22
src/Umbraco.Web/Features/EnabledFeatures.cs
Normal file
22
src/Umbraco.Web/Features/EnabledFeatures.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace Umbraco.Web.Features
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents enabled features.
|
||||
/// </summary>
|
||||
internal class EnabledFeatures
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="EnabledFeatures"/> class.
|
||||
/// </summary>
|
||||
public EnabledFeatures()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Specifies if rendering pipeline should ignore HasTemplate check when handling a request.
|
||||
/// <remarks>This is to allow JSON preview of content with no template set.</remarks>
|
||||
/// </summary>
|
||||
public bool RenderNoTemplate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ namespace Umbraco.Web.Features
|
||||
public UmbracoFeatures()
|
||||
{
|
||||
Disabled = new DisabledFeatures();
|
||||
Enabled = new EnabledFeatures();
|
||||
}
|
||||
|
||||
// note
|
||||
@@ -28,6 +29,11 @@ namespace Umbraco.Web.Features
|
||||
/// </summary>
|
||||
public DisabledFeatures Disabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the enabled features.
|
||||
/// </summary>
|
||||
public EnabledFeatures Enabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a feature is enabled.
|
||||
/// </summary>
|
||||
@@ -39,4 +45,4 @@ namespace Umbraco.Web.Features
|
||||
throw new NotSupportedException("Not a supported feature type.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -395,9 +395,10 @@ namespace Umbraco.Web.Mvc
|
||||
|
||||
//here we need to check if there is no hijacked route and no template assigned, if this is the case
|
||||
//we want to return a blank page, but we'll leave that up to the NoTemplateHandler.
|
||||
//we also check if we're allowed to render even though there's no template (json render in headless).
|
||||
if (publishedContentRequest.HasTemplate == false &&
|
||||
routeDef.HasHijackedRoute == false &&
|
||||
FeaturesResolver.Current.Features.Disabled.AllowRenderWithoutTemplate == false)
|
||||
FeaturesResolver.Current.Features.Enabled.RenderNoTemplate == false)
|
||||
{
|
||||
publishedContentRequest.UpdateOnMissingTemplate(); // will go 404
|
||||
|
||||
|
||||
@@ -329,6 +329,7 @@
|
||||
<Compile Include="Editors\ParameterSwapControllerActionSelector.cs" />
|
||||
<Compile Include="Editors\CodeFileController.cs" />
|
||||
<Compile Include="Editors\TourController.cs" />
|
||||
<Compile Include="Features\EnabledFeatures.cs" />
|
||||
<Compile Include="Models\BackOfficeTourFilter.cs" />
|
||||
<Compile Include="TourFilterResolver.cs" />
|
||||
<Compile Include="Editors\UserEditorAuthorizationHelper.cs" />
|
||||
|
||||
Reference in New Issue
Block a user