Fixes: #U4-1819

This commit is contained in:
Shannon Deminick
2013-03-02 05:46:00 +06:00
parent c137854e01
commit 2877b7bda4
4 changed files with 31 additions and 2 deletions

View File

@@ -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; }
}

View File

@@ -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

View 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;
}
}
}

View File

@@ -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" />