From cf39b2a54f8a8c47d2476d8e1ba0f219a364ec98 Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 15 Aug 2018 15:23:02 +1000 Subject: [PATCH] Fixes server side check for publishing when a mandatory language isn't published --- src/Umbraco.Web/Editors/ContentController.cs | 21 ++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Umbraco.Web/Editors/ContentController.cs b/src/Umbraco.Web/Editors/ContentController.cs index cf19f30a46..b96926af4f 100644 --- a/src/Umbraco.Web/Editors/ContentController.cs +++ b/src/Umbraco.Web/Editors/ContentController.cs @@ -743,16 +743,17 @@ namespace Umbraco.Web.Editors foreach (var lang in mandatoryLangs) { //Check if a mandatory language is missing from being published - //fixme: This logic is wrong, we need to also check if this language doesn't already have a published version - //if (cultureVariants.Any(x => x.Culture == lang.IsoCode && x.Publish == false)) - //{ - // //cannot continue publishing since a required language that is not currently being published isn't published - // if (!contentItem.PersistedContent.IsCulturePublished(lang.IsoCode)) - // { - // AddCultureValidationError(lang.IsoCode, allLangs, "speechBubbles/contentReqCulturePublishError"); - // canPublish = false; - // } - //} + + var variant = cultureVariants.First(x => x.Culture == lang.IsoCode); + var isPublished = contentItem.PersistedContent.IsCultureAvailable(lang.IsoCode) && contentItem.PersistedContent.IsCulturePublished(lang.IsoCode); + var isPublishing = variant.Publish; + + if (!isPublished && !isPublishing) + { + //cannot continue publishing since a required language that is not currently being published isn't published + AddCultureValidationError(lang.IsoCode, allLangs, "speechBubbles/contentReqCulturePublishError"); + canPublish = false; + } } if (canPublish)