Fixes publishing new variant content that has validation errors
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user