Fixes: #U4-1819
This commit is contained in:
@@ -29,6 +29,10 @@ namespace Umbraco.Tests
|
||||
new TestItem()
|
||||
{
|
||||
Children = new List<TestItem>()
|
||||
{
|
||||
new TestItem(),
|
||||
new TestItem()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,11 +69,15 @@ namespace Umbraco.Tests
|
||||
|
||||
var flattened = hierarchy.Children.FlattenList(x => x.Children);
|
||||
|
||||
Assert.AreEqual(8, flattened);
|
||||
Assert.AreEqual(10, flattened.Count());
|
||||
}
|
||||
|
||||
private class TestItem
|
||||
{
|
||||
public TestItem()
|
||||
{
|
||||
Children = Enumerable.Empty<TestItem>();
|
||||
}
|
||||
public IEnumerable<TestItem> Children { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ using Umbraco.Core.Configuration;
|
||||
|
||||
namespace Umbraco.Web.Mvc
|
||||
{
|
||||
internal static class AreaRegistrationExtensions
|
||||
internal static class AreaRegistrationExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a custom individual route for the specified controller plugin. Individual routes
|
||||
|
||||
20
src/Umbraco.Web/Mvc/NotChildAction.cs
Normal file
20
src/Umbraco.Web/Mvc/NotChildAction.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Umbraco.Web.Mvc
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to ensure that actions with duplicate names that are not child actions don't get executed when
|
||||
/// we are Posting and not redirecting.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See issue: http://issues.umbraco.org/issue/U4-1819
|
||||
/// </remarks>
|
||||
public class NotChildAction : ActionMethodSelectorAttribute
|
||||
{
|
||||
public override bool IsValidForRequest(ControllerContext controllerContext, System.Reflection.MethodInfo methodInfo)
|
||||
{
|
||||
var isChildAction = controllerContext.IsChildAction;
|
||||
return !isChildAction;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -322,6 +322,7 @@
|
||||
<Compile Include="Dictionary\UmbracoCultureDictionaryFactory.cs" />
|
||||
<Compile Include="Mvc\MemberAuthorizeAttribute.cs" />
|
||||
<Compile Include="Mvc\ControllerFactoryExtensions.cs" />
|
||||
<Compile Include="Mvc\NotChildAction.cs" />
|
||||
<Compile Include="Mvc\SurfaceRouteHandler.cs" />
|
||||
<Compile Include="Search\ExamineIndexerModel.cs" />
|
||||
<Compile Include="Search\LuceneIndexerExtensions.cs" />
|
||||
|
||||
Reference in New Issue
Block a user