IUmbracoUserComponent defaults to RuntimeLevel.Run minlevel now

This commit is contained in:
Stephan
2018-06-20 09:23:46 +02:00
parent 2f4bdf1af5
commit d4e3a66dc6

View File

@@ -73,8 +73,11 @@ namespace Umbraco.Core.Components
var componentTypeList = componentTypes
.Where(x =>
{
// use the min level specified by the attribute if any
// otherwise, user components have Run min level, anything else is Unknown (always run)
var attr = x.GetCustomAttribute<RuntimeLevelAttribute>();
return attr == null || level >= attr.MinLevel;
var minLevel = attr?.MinLevel ?? (x.Implements<IUmbracoUserComponent>() ? RuntimeLevel.Run : RuntimeLevel.Unknown);
return level >= minLevel;
})
.ToList();