mirror of
https://github.com/ppy/osu.git
synced 2025-02-22 00:33:22 +08:00
Simplify IsTopLevel and IsDeleted properties
This commit is contained in:
parent
b1f7a673e7
commit
0676c880b5
@ -16,20 +16,10 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
[JsonProperty(@"id")]
|
[JsonProperty(@"id")]
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
|
|
||||||
private long? parentId;
|
|
||||||
|
|
||||||
[JsonProperty(@"parent_id")]
|
[JsonProperty(@"parent_id")]
|
||||||
public long? ParentId
|
public long? ParentId { get; set; }
|
||||||
{
|
|
||||||
get => parentId;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
parentId = value;
|
|
||||||
IsTopLevel = value == null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Comment> ChildComments = new List<Comment>();
|
public readonly List<Comment> ChildComments = new List<Comment>();
|
||||||
|
|
||||||
public Comment ParentComment { get; set; }
|
public Comment ParentComment { get; set; }
|
||||||
|
|
||||||
@ -65,18 +55,8 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
[JsonProperty(@"updated_at")]
|
[JsonProperty(@"updated_at")]
|
||||||
public DateTimeOffset? UpdatedAt { get; set; }
|
public DateTimeOffset? UpdatedAt { get; set; }
|
||||||
|
|
||||||
private DateTimeOffset? deletedAt;
|
|
||||||
|
|
||||||
[JsonProperty(@"deleted_at")]
|
[JsonProperty(@"deleted_at")]
|
||||||
public DateTimeOffset? DeletedAt
|
public DateTimeOffset? DeletedAt { get; set; }
|
||||||
{
|
|
||||||
get => deletedAt;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
deletedAt = value;
|
|
||||||
IsDeleted = value != null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonProperty(@"edited_at")]
|
[JsonProperty(@"edited_at")]
|
||||||
public DateTimeOffset? EditedAt { get; set; }
|
public DateTimeOffset? EditedAt { get; set; }
|
||||||
@ -86,9 +66,9 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
|
|
||||||
public User EditedUser { get; set; }
|
public User EditedUser { get; set; }
|
||||||
|
|
||||||
public bool IsTopLevel { get; set; }
|
public bool IsTopLevel => !ParentId.HasValue;
|
||||||
|
|
||||||
public bool IsDeleted { get; set; }
|
public bool IsDeleted => DeletedAt.HasValue;
|
||||||
|
|
||||||
public string GetMessage()
|
public string GetMessage()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user