diff --git a/src/Umbraco.Core/Services/Implement/ContentService.cs b/src/Umbraco.Core/Services/Implement/ContentService.cs index 91dc908900..05eb32d57d 100644 --- a/src/Umbraco.Core/Services/Implement/ContentService.cs +++ b/src/Umbraco.Core/Services/Implement/ContentService.cs @@ -884,19 +884,9 @@ namespace Umbraco.Core.Services.Implement //this will create the correct culture type even if culture is * or null var cultureType = CultureType.Single(culture, _languageRepository.IsDefault(culture)); - //fixme: if PublishCulture or IsPropertyDataValid fails we still need to save! - // publish the culture(s) - var publishCulture = content.PublishCulture(cultureType); - if (!publishCulture) - return new PublishResult(PublishResultType.FailedPublishContentInvalid, evtMsgs, content); - - //validate the property values - if (!_propertyValidationService.Value.IsPropertyDataValid(content, out var invalidProperties, cultureType)) - return new PublishResult(PublishResultType.FailedPublishContentInvalid, evtMsgs, content) - { - InvalidProperties = invalidProperties - }; + // we don't care about the response here, this response will be rechecked below but we need to set the culture info values now. + content.PublishCulture(cultureType); var result = CommitDocumentChangesInternal(scope, content, saveEventArgs, userId, raiseEvents); scope.Complete(); @@ -931,23 +921,13 @@ namespace Umbraco.Core.Services.Implement //fixme: Shouldn't we makes ure that all string cultures here are valid? i.e. no * or null is allowed when using this method - var cultureTypes = cultures.ToDictionary(x => x, x => CultureType.Single(x, _languageRepository.IsDefault(x))); - - //fixme: if PublishCulture or IsPropertyDataValid fails we still need to save! - - if (cultureTypes.Select(x => content.PublishCulture(x.Value)).Any(isValid => !isValid)) - return new PublishResult(PublishResultType.FailedPublishContentInvalid, evtMsgs, content); - - //validate the property values on the cultures trying to be published - foreach (var culture in cultureTypes) - { - if (!_propertyValidationService.Value.IsPropertyDataValid(content, out var invalidProperties, culture.Value)) - return new PublishResult(PublishResultType.FailedPublishContentInvalid, evtMsgs, content) - { - InvalidProperties = invalidProperties - }; - } + var cultureTypes = cultures.Select(x => CultureType.Single(x, _languageRepository.IsDefault(x))); + // publish the culture(s) + // we don't care about the response here, this response will be rechecked below but we need to set the culture info values now. + foreach (var cultureType in cultureTypes) + content.PublishCulture(cultureType); + var result = CommitDocumentChangesInternal(scope, content, saveEventArgs, userId, raiseEvents); scope.Complete(); return result; @@ -1092,6 +1072,7 @@ namespace Umbraco.Core.Services.Implement if (publishing) { + //determine cultures publishing/unpublishing which will be based on previous calls to content.PublishCulture and ClearPublishInfo culturesUnpublishing = content.GetCulturesUnpublishing(); culturesPublishing = variesByCulture ? content.PublishCultureInfos.Values.Where(x => x.IsDirty()).Select(x => x.Culture).ToList() @@ -2505,7 +2486,21 @@ namespace Umbraco.Core.Services.Implement var variesByCulture = content.ContentType.VariesByCulture(); - //First check if mandatory languages fails, if this fails it will mean anything that the published flag on the document will + var cultureTypesToPublish = culturesPublishing.ToDictionary(x => x, x => CultureType.Single(x, _languageRepository.IsDefault(x))); + + // publish the culture(s) + if (!cultureTypesToPublish.All(x => content.PublishCulture(x.Value))) + return new PublishResult(PublishResultType.FailedPublishContentInvalid, evtMsgs, content); + + //validate the property values + Property[] invalidProperties = null; + if (!cultureTypesToPublish.All(x => _propertyValidationService.Value.IsPropertyDataValid(content, out invalidProperties, x.Value))) + return new PublishResult(PublishResultType.FailedPublishContentInvalid, evtMsgs, content) + { + InvalidProperties = invalidProperties + }; + + //Check if mandatory languages fails, if this fails it will mean anything that the published flag on the document will // be changed to Unpublished and any culture currently published will not be visible. if (variesByCulture) { diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbnotificationlist.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantnotificationlist.directive.js similarity index 67% rename from src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbnotificationlist.directive.js rename to src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantnotificationlist.directive.js index 9b6682cb35..dca7cdbb18 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbnotificationlist.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantnotificationlist.directive.js @@ -8,7 +8,7 @@ } var umbNotificationListComponent = { - templateUrl: 'views/components/content/umb-notification-list.html', + templateUrl: 'views/components/content/umb-variant-notification-list.html', bindings: { notifications: "<" }, @@ -17,6 +17,6 @@ }; angular.module("umbraco.directives") - .component('umbNotificationList', umbNotificationListComponent); + .component('umbVariantNotificationList', umbNotificationListComponent); })(); diff --git a/src/Umbraco.Web.UI.Client/src/views/components/content/umb-notification-list.html b/src/Umbraco.Web.UI.Client/src/views/components/content/umb-variant-notification-list.html similarity index 100% rename from src/Umbraco.Web.UI.Client/src/views/components/content/umb-notification-list.html rename to src/Umbraco.Web.UI.Client/src/views/components/content/umb-variant-notification-list.html diff --git a/src/Umbraco.Web.UI.Client/src/views/content/overlays/publish.html b/src/Umbraco.Web.UI.Client/src/views/content/overlays/publish.html index 3a8fd2b200..4ae09049e0 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/overlays/publish.html +++ b/src/Umbraco.Web.UI.Client/src/views/content/overlays/publish.html @@ -36,7 +36,7 @@ {{publishVariantSelectorForm.publishVariantSelector.errorMsg}} - + diff --git a/src/Umbraco.Web.UI.Client/src/views/content/overlays/publishdescendants.html b/src/Umbraco.Web.UI.Client/src/views/content/overlays/publishdescendants.html index 0045198134..2ec74bcf70 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/overlays/publishdescendants.html +++ b/src/Umbraco.Web.UI.Client/src/views/content/overlays/publishdescendants.html @@ -64,7 +64,7 @@ {{publishVariantSelectorForm.publishVariantSelector.errorMsg}} - + diff --git a/src/Umbraco.Web.UI.Client/src/views/content/overlays/save.html b/src/Umbraco.Web.UI.Client/src/views/content/overlays/save.html index 7df5b044db..6116867adb 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/overlays/save.html +++ b/src/Umbraco.Web.UI.Client/src/views/content/overlays/save.html @@ -41,7 +41,7 @@ {{saveVariantSelectorForm.saveVariantSelector.errorMsg}} - + diff --git a/src/Umbraco.Web.UI.Client/src/views/content/overlays/schedule.html b/src/Umbraco.Web.UI.Client/src/views/content/overlays/schedule.html index 88ef5a206a..c856b96e64 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/overlays/schedule.html +++ b/src/Umbraco.Web.UI.Client/src/views/content/overlays/schedule.html @@ -170,7 +170,7 @@
{{scheduleSelectorForm.saveVariantReleaseDate.errorMsg}}
- + diff --git a/src/Umbraco.Web.UI.Client/src/views/content/overlays/sendtopublish.html b/src/Umbraco.Web.UI.Client/src/views/content/overlays/sendtopublish.html index d10b8fab20..6ae777ec83 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/overlays/sendtopublish.html +++ b/src/Umbraco.Web.UI.Client/src/views/content/overlays/sendtopublish.html @@ -34,7 +34,7 @@ {{publishVariantSelectorForm.publishVariantSelector.errorMsg}} - +