Cleans up code, fixes tests, adds comments

This commit is contained in:
Shannon
2018-09-14 10:08:09 +10:00
parent 5009dfa0d7
commit 8c90b7fa28
8 changed files with 97 additions and 101 deletions

View File

@@ -21,7 +21,7 @@ namespace Umbraco.Web.Models.ContentEditing
public DateTime CreateDate { get; set; }
[DataMember(Name = "published")]
public bool Published { get; set; }
public bool Published => State == ContentSavedState.Published || State == ContentSavedState.PublishedPendingChanges;
/// <summary>
/// Determines if the content item is a draft
@@ -44,7 +44,7 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "state")]
[JsonConverter(typeof(StringEnumConverter))]
public ContentSavedState? State { get; set; } = null;
public ContentSavedState State { get; set; }
protected bool Equals(ContentItemBasic other)
{

View File

@@ -5,24 +5,29 @@
/// </summary>
public enum ContentSavedState
{
/// <summary>
/// The state has not been set
/// </summary>
NotSet = -1,
/// <summary>
/// The item isn't created yet
/// </summary>
NotCreated,
NotCreated = 1,
/// <summary>
/// The item is saved but isn't published
/// </summary>
Draft,
Draft = 2,
/// <summary>
/// The item is published and there are no pending changes
/// </summary>
Published,
Published = 3,
/// <summary>
/// The item is published and there are pending changes
/// </summary>
PublishedPendingChanges
PublishedPendingChanges = 4
}
}