Fixes state issue to ensure that non-created variants show up as not-created
This commit is contained in:
@@ -213,17 +213,23 @@ namespace Umbraco.Core.Models
|
||||
[IgnoreDataMember]
|
||||
public IEnumerable<string> PublishedCultures => _publishInfos?.Keys ?? Enumerable.Empty<string>();
|
||||
|
||||
//fixme should this return false if ID == 0?
|
||||
//fixme should this return false if IsCultureAvailable(culture) is false?
|
||||
/// <inheritdoc />
|
||||
public bool IsCulturePublished(string culture)
|
||||
=> _publishInfos != null && _publishInfos.ContainsKey(culture); //fixme should this return false if ID == 0?
|
||||
=> _publishInfos != null && _publishInfos.ContainsKey(culture);
|
||||
|
||||
//fixme should this return false if ID == 0?
|
||||
//fixme should this return false if IsCultureAvailable(culture) is false?
|
||||
/// <inheritdoc />
|
||||
public bool WasCulturePublished(string culture)
|
||||
=> _publishInfosOrig != null && _publishInfosOrig.ContainsKey(culture); //fixme should this return false if ID == 0?
|
||||
=> _publishInfosOrig != null && _publishInfosOrig.ContainsKey(culture);
|
||||
|
||||
//fixme should this return false if ID == 0?
|
||||
//fixme should this return false if IsCultureAvailable(culture) is false?
|
||||
/// <inheritdoc />
|
||||
public bool IsCultureEdited(string culture)
|
||||
=> !IsCulturePublished(culture) || (_editedCultures != null && _editedCultures.Contains(culture)); //fixme should this return false if ID == 0?
|
||||
=> !IsCulturePublished(culture) || (_editedCultures != null && _editedCultures.Contains(culture));
|
||||
|
||||
/// <inheritdoc/>
|
||||
[IgnoreDataMember]
|
||||
|
||||
@@ -77,23 +77,6 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
|
||||
[DataMember(Name = "publishDate")]
|
||||
public DateTime? PublishDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the content variant for this culture has been created
|
||||
/// </summary>
|
||||
[DataMember(Name = "exists")]
|
||||
public bool Exists { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// Determines if this is the variant currently being edited
|
||||
///// </summary>
|
||||
//[DataMember(Name = "current")]
|
||||
//public bool IsCurrent { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// If the variant is a required variant for validation purposes
|
||||
///// </summary>
|
||||
//[DataMember(Name = "mandatory")]
|
||||
//public bool Mandatory { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -68,7 +68,6 @@ namespace Umbraco.Web.Models.Mapping
|
||||
CreateMap<IContent, ContentVariantDisplay>()
|
||||
.ForMember(dest => dest.PublishDate, opt => opt.MapFrom(src => src.PublishDate))
|
||||
.ForMember(dest => dest.Properties, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.Exists, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.Segment, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.Language, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.State, opt => opt.Ignore())
|
||||
|
||||
Reference in New Issue
Block a user