removes old notes, makes MediaSaveModelValidator to be consistent
This commit is contained in:
@@ -73,12 +73,6 @@
|
||||
|
||||
function hasAnyData(variant) {
|
||||
|
||||
//** DO NOT MERGE THIS!!!!!! THIS IS FOR TESTING *****
|
||||
//if(variant.name == null || variant.name.length === 0) {
|
||||
// return false;
|
||||
//}
|
||||
|
||||
|
||||
var result = variant.isDirty != null;
|
||||
|
||||
if(result) return true;
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
<div class="umb-list umb-list--condensed" ng-if="!vm.loading">
|
||||
|
||||
<!--Why are we doing the filter on notification type?-->
|
||||
|
||||
<div class="umb-list-item" ng-repeat="variant in vm.variants | filter:vm.dirtyVariantFilter track by variant.compositeId">
|
||||
<ng-form name="publishVariantSelectorForm">
|
||||
<div class="flex">
|
||||
|
||||
@@ -16,12 +16,12 @@ namespace Umbraco.Web.Editors.Filters
|
||||
/// <summary>
|
||||
/// A base class purely used for logging without generics
|
||||
/// </summary>
|
||||
internal class ContentModelValidator
|
||||
internal abstract class ContentModelValidator
|
||||
{
|
||||
protected IUmbracoContextAccessor UmbracoContextAccessor { get; }
|
||||
protected ILogger Logger { get; }
|
||||
|
||||
public ContentModelValidator(ILogger logger, IUmbracoContextAccessor umbracoContextAccessor)
|
||||
protected ContentModelValidator(ILogger logger, IUmbracoContextAccessor umbracoContextAccessor)
|
||||
{
|
||||
Logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
UmbracoContextAccessor = umbracoContextAccessor ?? throw new ArgumentNullException(nameof(umbracoContextAccessor));
|
||||
@@ -38,12 +38,12 @@ namespace Umbraco.Web.Editors.Filters
|
||||
/// If any severe errors occur then the response gets set to an error and execution will not continue. Property validation
|
||||
/// errors will just be added to the ModelState.
|
||||
/// </remarks>
|
||||
internal class ContentModelValidator<TPersisted, TModelSave, TModelWithProperties>: ContentModelValidator
|
||||
internal abstract class ContentModelValidator<TPersisted, TModelSave, TModelWithProperties>: ContentModelValidator
|
||||
where TPersisted : class, IContentBase
|
||||
where TModelSave: IContentSave<TPersisted>
|
||||
where TModelWithProperties : IContentProperties<ContentPropertyBasic>
|
||||
{
|
||||
public ContentModelValidator(ILogger logger, IUmbracoContextAccessor umbracoContextAccessor) : base(logger, umbracoContextAccessor)
|
||||
protected ContentModelValidator(ILogger logger, IUmbracoContextAccessor umbracoContextAccessor) : base(logger, umbracoContextAccessor)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ using Umbraco.Web.Models.ContentEditing;
|
||||
namespace Umbraco.Web.Editors.Filters
|
||||
{
|
||||
/// <summary>
|
||||
/// Validation helper for <see cref="ContentItemSave"/>
|
||||
/// Validator for <see cref="ContentItemSave"/>
|
||||
/// </summary>
|
||||
internal class ContentSaveModelValidator : ContentModelValidator<IContent, ContentItemSave, ContentVariantSave>
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Umbraco.Web.Editors.Filters
|
||||
public override void OnActionExecuting(HttpActionContext actionContext)
|
||||
{
|
||||
var model = (MediaItemSave)actionContext.ActionArguments["contentItem"];
|
||||
var contentItemValidator = new ContentModelValidator<IMedia, MediaItemSave, IContentProperties<ContentPropertyBasic>>(_logger, _umbracoContextAccessor);
|
||||
var contentItemValidator = new MediaSaveModelValidator(_logger, _umbracoContextAccessor);
|
||||
|
||||
if (ValidateUserAccess(model, actionContext))
|
||||
{
|
||||
|
||||
16
src/Umbraco.Web/Editors/Filters/MediaSaveModelValidator.cs
Normal file
16
src/Umbraco.Web/Editors/Filters/MediaSaveModelValidator.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
|
||||
namespace Umbraco.Web.Editors.Filters
|
||||
{
|
||||
/// <summary>
|
||||
/// Validator for <see cref="MediaItemSave"/>
|
||||
/// </summary>
|
||||
internal class MediaSaveModelValidator : ContentModelValidator<IMedia, MediaItemSave, IContentProperties<ContentPropertyBasic>>
|
||||
{
|
||||
public MediaSaveModelValidator(ILogger logger, IUmbracoContextAccessor umbracoContextAccessor) : base(logger, umbracoContextAccessor)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -135,6 +135,7 @@
|
||||
<Compile Include="Dashboards\SettingsDashboards.cs" />
|
||||
<Compile Include="Editors\BackOfficePreviewModel.cs" />
|
||||
<Compile Include="Editors\Filters\ContentSaveModelValidator.cs" />
|
||||
<Compile Include="Editors\Filters\MediaSaveModelValidator.cs" />
|
||||
<Compile Include="Editors\PackageController.cs" />
|
||||
<Compile Include="Editors\KeepAliveController.cs" />
|
||||
<Compile Include="Editors\MacrosController.cs" />
|
||||
|
||||
Reference in New Issue
Block a user