Fixes state issue to ensure that non-created variants show up as not-created

This commit is contained in:
Shannon
2018-08-15 15:13:27 +10:00
parent 66a00546d1
commit 2a15feec40
4 changed files with 14 additions and 25 deletions

View File

@@ -53,14 +53,15 @@ namespace Umbraco.Web.Models.Mapping
variant.Language = x;
variant.Name = source.GetCultureName(x.IsoCode);
variant.Exists = source.IsCultureAvailable(x.IsoCode); // segments ??
var publishedState = source.PublishedState == PublishedState.Unpublished //if the entire document is unpublished, then flag every variant as unpublished
? PublishedState.Unpublished
: source.IsCulturePublished(x.IsoCode)
? PublishedState.Published
: PublishedState.Unpublished;
var isEdited = source.Id > 0 && source.IsCultureEdited(x.IsoCode);
//it can only be 'edited' if the content item is persisted and if the variant has a name and it's flagged as edited
var isEdited = source.Id > 0 && source.IsCultureAvailable(x.IsoCode) && source.IsCultureEdited(x.IsoCode);
//now we can calculate the content state
if (!isEdited && publishedState == PublishedState.Unpublished)