Fixes publishing new variant content that has validation errors

This commit is contained in:
Shannon
2019-02-19 02:51:05 +11:00
parent c81ff85b41
commit 3ecf4144e7

View File

@@ -1201,6 +1201,10 @@ namespace Umbraco.Web.Editors
variant.Publish = false;
}
//At this stage all variants might have failed validation which means there are no cultures flagged for publishing!
var culturesToPublish = cultureVariants.Where(x => x.Publish).Select(x => x.Culture).ToArray();
canPublish = canPublish && culturesToPublish.Length > 0;
if (canPublish)
{
//try to publish all the values on the model - this will generally only fail if someone is tampering with the request
@@ -1210,8 +1214,6 @@ namespace Umbraco.Web.Editors
if (canPublish)
{
var culturesToPublish = cultureVariants.Where(x => x.Publish).Select(x => x.Culture).ToArray();
//proceed to publish if all validation still succeeds
var publishStatus = Services.ContentService.SaveAndPublish(contentItem.PersistedContent, culturesToPublish, Security.CurrentUser.Id);
wasCancelled = publishStatus.Result == PublishResultType.FailedPublishCancelledByEvent;