Makes State a ContentSavedState enum nullable - otherwise media items was getting a default enum of not created

This commit is contained in:
Warren Buckley
2018-09-12 15:34:48 +01:00
parent b06ba12e42
commit 46ff45c2f0
2 changed files with 4 additions and 6 deletions

View File

@@ -5,9 +5,6 @@ using System.Linq;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Validation;
using Umbraco.Web.WebApi;
namespace Umbraco.Web.Models.ContentEditing
{
@@ -47,7 +44,7 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "state")]
[JsonConverter(typeof(StringEnumConverter))]
public ContentSavedState State { get; set; }
public ContentSavedState? State { get; set; } = null;
protected bool Equals(ContentItemBasic other)
{

View File

@@ -92,14 +92,15 @@ namespace Umbraco.Web.Models.Mapping
}
}
internal class CultureStateResolver : IValueResolver<IContent, ContentItemBasic<ContentPropertyBasic>, ContentSavedState>
internal class CultureStateResolver : IValueResolver<IContent, ContentItemBasic<ContentPropertyBasic>, ContentSavedState?>
{
//WB: Note this is same logic as ContentSavedStateResolver.cs
//But this is for ContentItemBasic instead of ContentVariantDisplay
public ContentSavedState Resolve(IContent source, ContentItemBasic<ContentPropertyBasic> destination, ContentSavedState destMember, ResolutionContext context)
public ContentSavedState? Resolve(IContent source, ContentItemBasic<ContentPropertyBasic> destination, ContentSavedState? destMember, ResolutionContext context)
{
PublishedState publishedState;
bool isEdited;
if (source.ContentType.VariesByCulture())
{