Fixed issue with model state marked as invalid on the entire model, where we handle it for each item separately
This commit is contained in:
@@ -913,9 +913,9 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
v.Notifications.AddRange(n.Notifications);
|
||||
}
|
||||
|
||||
//lastly, if it is not valid, add the model state to the outgoing object and throw a 400
|
||||
HandleInvalidModelState(display, cultureForInvariantErrors);
|
||||
|
||||
//lastly, if it is not valid, add the model state to the outgoing object and throw a 400
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return ValidationProblem(display, ModelState);
|
||||
|
||||
@@ -68,6 +68,12 @@ namespace Umbraco.Cms.Web.BackOffice.Filters
|
||||
var model = (ContentItemSave) context.ActionArguments["contentItem"];
|
||||
var contentItemValidator = new ContentSaveModelValidator(_loggerFactory.CreateLogger<ContentSaveModelValidator>(), _propertyValidationService);
|
||||
|
||||
if (context.ModelState.ContainsKey("contentItem"))
|
||||
{
|
||||
// if the entire model is marked as error, remove it, we handle everything separately
|
||||
context.ModelState.Remove("contentItem");
|
||||
}
|
||||
|
||||
if (!ValidateAtLeastOneVariantIsBeingSaved(model, context)) return;
|
||||
if (!contentItemValidator.ValidateExistingContent(model, context)) return;
|
||||
if (!await ValidateUserAccessAsync(model, context)) return;
|
||||
|
||||
Reference in New Issue
Block a user