Fixes content service to not validate every culture for properties, only the cultures passed in to to the method, removes client side name check,
This commit is contained in:
@@ -945,12 +945,15 @@ namespace Umbraco.Core.Services.Implement
|
||||
if (cultures.Select(content.PublishCulture).Any(isValid => !isValid))
|
||||
return new PublishResult(PublishResultType.FailedPublishContentInvalid, evtMsgs, content);
|
||||
|
||||
//validate the property values
|
||||
if (!_propertyValidationService.Value.IsPropertyDataValid(content, out var invalidProperties))
|
||||
return new PublishResult(PublishResultType.FailedPublishContentInvalid, evtMsgs, content)
|
||||
{
|
||||
InvalidProperties = invalidProperties
|
||||
};
|
||||
//validate the property values on the cultures trying to be published
|
||||
foreach (var culture in cultures)
|
||||
{
|
||||
if (!_propertyValidationService.Value.IsPropertyDataValid(content, out var invalidProperties, culture))
|
||||
return new PublishResult(PublishResultType.FailedPublishContentInvalid, evtMsgs, content)
|
||||
{
|
||||
InvalidProperties = invalidProperties
|
||||
};
|
||||
}
|
||||
|
||||
var result = CommitDocumentChangesInternal(scope, content, saveEventArgs, userId, raiseEvents);
|
||||
scope.Complete();
|
||||
|
||||
@@ -332,37 +332,6 @@
|
||||
// This is a helper method to reduce the amount of code repitition for actions: Save, Publish, SendToPublish
|
||||
function performSave(args) {
|
||||
|
||||
// Check that all variants for publishing have a name.
|
||||
if (args.action === "publish" || args.action === "sendToPublish") {
|
||||
|
||||
if ($scope.content.variants) {
|
||||
var iVariant;
|
||||
for (var i = 0; i < $scope.content.variants.length; i++) {
|
||||
iVariant = $scope.content.variants[i];
|
||||
|
||||
iVariant.notifications = [];// maybe not needed, need to investigate.
|
||||
|
||||
if(iVariant.publish === true) {
|
||||
if (iVariant.name == null) {
|
||||
|
||||
var tokens = [iVariant.language.name];
|
||||
|
||||
return localizationService.localize("publish_contentPublishedFailedByMissingName", tokens).then(value => {
|
||||
|
||||
//note - type 1 is a "Info" based on the c# enum Umbraco.Web.Models.ContentEditing.NotificationStyle
|
||||
iVariant.notifications.push({ "message": value, "type": 1 });
|
||||
|
||||
return $q.reject();
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Used to check validility of nested form - coming from Content Apps mostly
|
||||
//Set them all to be invalid
|
||||
var fieldsToRollback = checkValidility();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -830,7 +830,7 @@ namespace Umbraco.Web.Editors
|
||||
//if there's more than 1 variant, then we need to add the culture specific error
|
||||
//messages based on the variants in error so that the messages show in the publish/save dialog
|
||||
if (variants.Count > 1)
|
||||
AddCultureValidationError(variant.Culture, "speechBubbles/contentCultureCriticalValidationError");
|
||||
AddCultureValidationError(variant.Culture, "publish/contentPublishedFailedByMissingName");
|
||||
else
|
||||
return false; //It's invariant and is missing critical data, it cannot be saved
|
||||
}
|
||||
|
||||
@@ -46,15 +46,7 @@ namespace Umbraco.Web.Editors.Filters
|
||||
public ContentModelValidator(ILogger logger, IUmbracoContextAccessor umbracoContextAccessor) : base(logger, umbracoContextAccessor)
|
||||
{
|
||||
}
|
||||
|
||||
//public void ValidateItem(HttpActionContext actionContext, TModelSave model, IContentProperties<ContentPropertyBasic> modelWithProperties, ContentPropertyCollectionDto dto)
|
||||
//{
|
||||
// //now do each validation step
|
||||
// if (ValidateExistingContent(model, actionContext) == false) return;
|
||||
// if (ValidateProperties(model, modelWithProperties, actionContext) == false) return;
|
||||
// if (ValidatePropertyData(model, modelWithProperties, dto, actionContext.ModelState) == false) return;
|
||||
//}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Ensure the content exists
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user